Skip to content

FIX: Detect modern OpenSSH private keys in PathTraversalOutputScorer (#4232) - #4233

Merged
hannahwestra25 merged 3 commits into
microsoft:mainfrom
Kaap10:fix/path-traversal-openssh-private-keys
Nov 23, 2026
Merged

hannahwestra25 merged 3 commits into
microsoft:mainfrom
Kaap10:fix/path-traversal-openssh-private-keys

Conversation

@Kaap10

Copy link
Copy Markdown
Contributor

Description

Extends PathTraversalOutputScorer to detect traversal payloads targeting modern OpenSSH default private key filenames (id_ed25519, id_ecdsa, id_dsa, and FIDO2 id_ed25519_sk/id_ecdsa_sk) alongside id_rsa.

  • Updated _DEFAULT_PATTERNS["Path Traversal to Sensitive File"] in PathTraversalOutputScorer to match id_(?:rsa|dsa|(?:ecdsa|ed25519)(?:_sk)?) while preserving existing _FILE_END boundaries.
  • Added positive regression tests covering id_dsa, id_ecdsa, id_ed25519, id_ecdsa_sk, id_ed25519_sk, backslash separators, percent-encoding, null-byte truncation (%00), and sentence-ending periods.
  • Added negative boundary tests confirming .pub public keys, .bak backups, custom suffixes (id_ed25519_custom), and single-parent walks (../.ssh/id_ed25519) remain False.

Demonstration

For "../../.ssh/id_ed25519":

  • Before: score_value="false" (rationale: "")
  • After: score_value="true" ("Matched: Path Traversal to Sensitive File")

For "../../.ssh/id_ed25519.pub":

  • Before & After: score_value="false" (public key safely excluded by _FILE_END)

Closes #4232

Copilot AI balanced review requested due to automatic review settings November 12, 2026 05:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@Kaap10
Vardhman Gupta (Kaap10) force-pushed the fix/path-traversal-openssh-private-keys branch from 589153c to 51006f1 Compare November 18, 2026 12:38
@hannahwestra25 hannahwestra25 self-assigned this Nov 20, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@hannahwestra25 hannahwestra25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks for contributing!

@hannahwestra25
hannahwestra25 added this pull request to the merge queue Nov 23, 2026
Merged via the queue into microsoft:main with commit 366bc82 Nov 23, 2026
66 checks passed
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.

BUG: PathTraversalOutputScorer misses modern OpenSSH private keys (id_ed25519, id_ecdsa, id_dsa, _sk)

4 participants