Description
Affected rule: PE3 "Credential Access" Affected file: src/skillspector/nodes/analyzers/static_patterns_privilege_escalation.py, lines 198-200 (_PE3_TOKEN_DOCUMENTATION_DIRS)
Summary
There's already careful, purpose-built logic here to distinguish the OAuth compound noun "access token(s)" from an imperative instruction to steal tokens (_is_access_token_documentation_noun, _PE3_TOKEN_ACTION_CONTEXT, etc.) — this is a well-designed exemption, not a missing one. But it's gated on the file living under a documentation-named directory:
_PE3_TOKEN_DOCUMENTATION_DIRS = frozenset(
{"docs", "documentation", "procedures", "references", "examples", "guides"}
)
Note "references" is plural-only. On the official anthropics/skills repo, mcp-builder/reference/mcp_best_practices.md (singular reference/) contains this completely benign OAuth guidance at line 158:
OAuth 2.1:
-
Use secure OAuth 2.1 with certificates from recognized authorities
-
Validate access tokens before processing requests
-
Only accept tokens specifically intended for your server
"Validate access tokens before processing requests" is squarely the case this exemption exists for — no action verb from _PE3_TOKEN_ACTION_CONTEXT matches, no sensitive-source pattern matches. But because the directory is named reference (singular) rather than references (plural), _is_access_token_documentation_noun returns False at the directory check before it ever evaluates the actual context, and the finding fires as PE3/HIGH anyway.
This is a directory-naming gap on real, official skill content, not a theoretical edge case — reference/ is at least as common a convention as references/ for a single reference guide directory.
Proposed fix
Recognize both singular and plural forms:
_PE3_TOKEN_DOCUMENTATION_DIRS = frozenset(
{
"docs", "doc", "documentation",
"procedures", "procedure",
"references", "reference",
"examples", "example",
"guides", "guide",
}
)
Reported by
Benedict Kwok, ZTAI Security Advisors LLC ([email protected]) — found while independently evaluating SkillSpector against several official anthropics/skills skills.
Activity
fix(pe3): env lookbehind and singular reference dir (NVIDIA#415)