Skip to content

fix(security): contain profile paths under their schemas root - #1134

Merged
catinspace-au merged 1 commit into
mainfrom
fix/codeql-70-profile-path-containment
Nov 11, 2026
Merged

catinspace-au merged 1 commit into
mainfrom
fix/codeql-70-profile-path-containment

Conversation

@catinspace-au

Copy link
Copy Markdown
Contributor

The API can write a profile ref (header.type). The resolver joins it onto a schemas directory. It refused .. and rebuilt the ref from non-empty segments. It followed symlinks, so a link inside the tree could read any file the pod could access.

Every join in _resolve_profile_yaml_path resolves the candidate and its root with os.path.realpath. Candidates outside the root are refused. That covers the explicit profiles dir, DFE_ENGINE_SCHEMAS_DIR, the schemas root and the fallback.

CodeQL's py/path-injection query models realpath plus a startswith check as a barrier. This resolves code-scanning alert 70.

The API can write a profile ref (header.type). The resolver joins it onto a schemas directory. It refused `..` and rebuilt the ref from non-empty segments. It followed symlinks, so a link inside the tree could read any file the pod could access.

Every join in _resolve_profile_yaml_path resolves the candidate and its root with os.path.realpath. Candidates outside the root are refused. That covers the explicit profiles dir, DFE_ENGINE_SCHEMAS_DIR, the schemas root and the fallback.

CodeQL's py/path-injection query models realpath plus a startswith check as a barrier. This resolves code-scanning alert 70.
@catinspace-au
catinspace-au marked this pull request as ready for review November 11, 2026 09:42
@catinspace-au
catinspace-au merged commit a232ff0 into main Nov 11, 2026
19 checks passed
@catinspace-au
catinspace-au deleted the fix/codeql-70-profile-path-containment branch November 11, 2026 09:42
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