Skip to content

security: flag credential paths only when the text asks for them - #169

Open
abu-tahir-0 wants to merge 1 commit into
patsypppe:mainfrom
abu-tahir-0:feat/credential-path-context
Open

abu-tahir-0 wants to merge 1 commit into
patsypppe:mainfrom
abu-tahir-0:feat/credential-path-context

Conversation

@abu-tahir-0

Copy link
Copy Markdown

Closes #160.

Problem

tool-description-injection flagged any mention of .env, .aws or ~/.ssh, so it reported two of the six hard negatives in benchmarks/poisoning_corpus.json: a tool that reads .env variable names only and one that deletes an SSH key after the user confirms. Both descriptions are honest; the rule was matching the noun, not the request.

Solution

A credential path now needs context before it is a finding. The window around it (120 characters each side) must contain either

  • an exfiltration or destination cue (include, send, upload, pass its contents, as the, in this field, ...), or
  • an imperative read (then read, before using this tool, read, copy the .env file, ...).

An explicit safety cue (NAMES only, never the values, without values) suppresses the finding, so a tool that says what it does not return stays clean. A sentence that warns against reading the path ("Never read the .env file") is not an imperative and is not flagged.

Measurement

Poisoning corpus, before → after:

  • hard_benign flagged: 2 → 0 (reads-env-file, deletes-ssh-key clear).
  • poisoned missed: unchanged apart from evasive-base64, which is the subject of a separate PR (security: decode long base64 runs before scanning tool text #168) and remains missed here. Both credential-path injections (imp-block-read-ssh, param-description-injection) are still caught, now via the contextual rule.

Testing

This branch has not been deployed

No deployments
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.

security rule: make the credential-path check context-aware

1 participant