Repository navigation
FIX: Detect encoded path traversal to sensitive files - #3326
Merged
Roman Lutz (romanlutz) merged 5 commits intoOct 20, 2026
Merged
Roman Lutz (romanlutz) merged 5 commits into
Roman Lutz (romanlutz) merged 5 commits into
Conversation
Merge_Conflict - Pasi (pasmud)
force-pushed
the
fix/encoded-path-traversal-scoring
branch
from
October 19, 2026 10:04
9de4fc6 to
7ad954d
Compare
Contributor
Author
|
@microsoft-github-policy-service agree |
Roman Lutz (romanlutz)
requested changes
Oct 19, 2026
Merge_Conflict - Pasi (pasmud)
force-pushed
the
fix/encoded-path-traversal-scoring
branch
from
October 19, 2026 22:33
7ad954d to
4bb6dcc
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f544d42c-f6a5-4964-823d-2715d94ae0c9
Allow a period before whitespace or the end of model output without accepting literal or encoded filename extensions. Add public scoring regressions for sensitive targets and URL encoding variants. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f544d42c-f6a5-4964-823d-2715d94ae0c9
Roman Lutz (romanlutz)
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PathTraversalOutputScorermissed paths with URL-encoded traversal dots or separators, even when they led to a sensitive file. It also missed.ssh/id_rsa,.aws/credentials, and.envtargets. The default pattern now recognizes literal, URL-encoded, and double URL-encoded traversal segments and separators while still requiring at least two parent segments and a known-sensitive target.Sensitive filenames must be complete, so
.ssh/id_rsa.pub,.aws/credentials.example, and encoded suffixes do not match. A period ending a sentence still allows detection of a path such as../../etc/passwd.. The existing directory-prefix behavior forwindows/system32andproc/selfremains. Custom pattern overrides continue to see the original text.Related to #3324
Tests and Documentation
uv run --frozen -m pytest tests/unit/score/regex -q: 865 passed.uv run --frozen ruff check pyrit/score/true_false/regex/path_traversal_output_scorer.py tests/unit/score/regex/test_path_traversal_output_scorer.py: passed.uv run --frozen ruff format --check pyrit/score/true_false/regex/path_traversal_output_scorer.py tests/unit/score/regex/test_path_traversal_output_scorer.py: both files formatted.uv run --frozen ty check pyrit/score/true_false/regex/path_traversal_output_scorer.py: passed.