Skip to content

Validate external file path at metadata load time - #9121

Open
Pyolar wants to merge 1 commit into
FirebirdSQL:masterfrom
Pyolar:fix/external-file-path-validation
Open

Validate external file path at metadata load time#9121
Pyolar wants to merge 1 commit into
FirebirdSQL:masterfrom
Pyolar:fix/external-file-path-validation

Conversation

@Pyolar

@Pyolar Pyolar commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

External table paths are stored in RDB$EXTERNAL_FILE at CREATE TABLE time without any check against ExternalFileAccess. The path was only validated when the table was opened, so with a restricted directory list a user could create a table pointing outside the allowed directories and the bad path stayed in metadata.

This moves the check into checkExternalFileAccess(), shared by the metadata loader (met.epp) and ExternalFile::open(). Escaping paths are now rejected at CREATE TABLE with isc_conf_access_denied. Existing databases containing such tables fail on first access instead of keeping the invalid path silently.

Tested with ExternalFileAccess = Restrict: CREATE TABLE with a path outside the list fails with SQLSTATE 28000, tables inside the list work unchanged.

Companion tests: FirebirdSQL/firebird-qa#39

External tables store the file path in RDB$EXTERNAL_FILE at CREATE
TABLE time without any check against the ExternalFileAccess policy.
The path was validated only later, when the table was actually opened,
so a table pointing outside the allowed directories could be created
and the malicious path remained in metadata.

Move the validation into a shared checkExternalFileAccess() helper and
call it both when the relation metadata is loaded (met.epp) and when
the external file is opened (ExternalFile::open).  Paths escaping the
configured directory list are now rejected at CREATE TABLE time with
isc_conf_access_denied, and existing databases with such tables fail
on first access instead of silently carrying the bad path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant