Skip to content

fix(pe3): env lookbehind and singular reference dir - #415

Open
benedictkwok wants to merge 3 commits into
NVIDIA:mainfrom
benedictkwok:fix/pe3-env-lookbehind-and-reference-dir
Open

fix(pe3): env lookbehind and singular reference dir#415
benedictkwok wants to merge 3 commits into
NVIDIA:mainfrom
benedictkwok:fix/pe3-env-lookbehind-and-reference-dir

Conversation

@benedictkwok

@benedictkwok benedictkwok commented Aug 22, 2026

Copy link
Copy Markdown

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 failed
  • make lint: clean
  • make format: clean

Closes #406
Closes #407

Benedict Kwok 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant