Skip to content

Guard local-driver extensions location in storage path validation - #28077

Open
br41nslug wants to merge 2 commits into
mainfrom
fix-storage-validation-local
Open

Guard local-driver extensions location in storage path validation#28077
br41nslug wants to merge 2 commits into
mainfrom
fix-storage-validation-local

Conversation

@br41nslug

Copy link
Copy Markdown
Member

What's Changed

  • EXTENSIONS_LOCATION check now compares the un-prefixed path, so a local-driver extensions location is guarded too.

Tested Scenarios

  • added unit tests

Review Notes / Questions / Concerns

  • I would like to lorem ipsum
  • Special attention should be paid to dolor sit amet

Checklist

Leave unchecked where not applicable

  • Tests added/updated
  • Documentation PR created in directus/docs
  • OpenAPI updated
  • SDK (@directus/sdk) updated to reflect the changes
  • Types (@directus/types) updated to reflect the changes
  • GraphQL schema updated to reflect the changes
  • System data (@directus/system-data) updated for changes to system collections/fields/relations
  • Database migration added for schema/system changes
  • Environment variables documented for new/changed config
  • App translations added for new user-facing strings
  • Security implications apply

Fixes CMS-2391

@linear-code

linear-code Bot commented Aug 11, 2026

Copy link
Copy Markdown

CMS-2391

@ComfortablyCoding ComfortablyCoding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, see points below.

Additional bypasses to what is listed:

  • Still possible bypass via PATCH as it may check against one storage due to fallback but store in db based storage
    assertValidStoragePath(data.filename_disk, data.storage);

// Block setting path to the extension path on the extensions storage location.
if (env['EXTENSIONS_LOCATION'] && env['EXTENSIONS_LOCATION'] === location) {
if (extensionPath && filePath.startsWith(extensionPath + '/')) {
if (extensionPath && normalizedFilePath.startsWith(extensionPath + '/')) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EXTENSIONS_PATH='.' will result in extensionPath being '' due to sanitize which bypasses this guard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants