fix(pe3): env lookbehind and singular reference dir - #415
Open
benedictkwok wants to merge 3 commits into
Open
Conversation
added 3 commits
August 22, 2026 04:20
Two independent PE3 false-positive fixes, both confirmed against the official anthropics/skills repo (mcp-builder): - The .env pattern had no lookbehind, so it matched Python attribute access (self.env, args.env) as if it were a dotenv file reference. Added (?<!\w) so it only fires when .env is not part of an identifier. - _PE3_TOKEN_DOCUMENTATION_DIRS only recognized the plural "references", so the existing OAuth access-token exemption silently failed to apply under a singular reference/ directory (mcp-builder/reference/). Added singular forms for docs/procedures/references/examples/guides. Both fixes verified against the existing test suite for _is_env_file_reference_in_docs and _is_pe3_documentation_example, and new regression tests added for the attribute-access and singular-directory cases, including negative-space tests confirming real credential-theft instructions with the same vocabulary still fire. Closes NVIDIA#406, NVIDIA#407 Signed-off-by: Benedict Kwok <bkwok.oracle@gmail.com>
main's Security fixes (NVIDIA#393) changed PE2-PE5's doc-context suppression from hard-dropping the finding to tagging it contextual-triage / likely-benign-context and keeping it. Update the two new reference-dir tests added in this branch to assert on the tag instead of absence, matching the pattern NVIDIA#393 already applied to the equivalent negated-credential-access test. Signed-off-by: Benedict Kwok <bkwok.oracle@gmail.com>
…d-and-reference-dir Signed-off-by: Benedict Kwok <bkwok.oracle@gmail.com>
benedictkwok
force-pushed
the
fix/pe3-env-lookbehind-and-reference-dir
branch
from
August 22, 2026 12:08
88e4db4 to
0a93f6f
Compare
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.
Two independent PE3 false-positive fixes, both confirmed against the official anthropics/skills repo (mcp-builder):
The .env pattern had no lookbehind, so it matched Python attribute access (self.env, args.env) as if it were a dotenv file reference. Added (?<!\w) so it only fires when .env is not part of an identifier.
_PE3_TOKEN_DOCUMENTATION_DIRS only recognized the plural "references", so the existing OAuth access-token exemption silently failed to apply under a singular reference/ directory (mcp-builder/reference/). Added singular forms for docs/procedures/references/examples/guides.
Both fixes verified against the existing test suite for _is_env_file_reference_in_docs and _is_pe3_documentation_example, and new regression tests added for the attribute-access and singular-directory cases, including negative-space tests confirming real credential-theft instructions with the same vocabulary still fire.
Testing
make test(unit + integration): 2218 passed, 31 passed, 0 failedmake lint: cleanmake format: cleanCloses #406
Closes #407