Skip to content

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

Merged
rng1995 merged 7 commits into
NVIDIA:mainfrom
benedictkwok:fix/pe3-env-lookbehind-and-reference-dir
Aug 24, 2026
Merged

fix(pe3): env lookbehind and singular reference dir#415
rng1995 merged 7 commits into
NVIDIA:mainfrom
benedictkwok:fix/pe3-env-lookbehind-and-reference-dir

Conversation

@benedictkwok

@benedictkwok benedictkwok commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

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>

@rng1995 rng1995 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.

[SkillSpector Review]\n\nApproved. The lookbehind avoids member-name false positives while preserving real environment-file detection, and the singular documentation-directory forms are covered by positive and negative tests. Current required checks pass.

@rng1995
rng1995 enabled auto-merge (squash) August 24, 2026 18:09
@rng1995
rng1995 merged commit d486d0a into NVIDIA:main Aug 24, 2026
5 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

2 participants