Skip to content

fix(mcp): treat allowed-tools as a permission declaration for LP3#27

Open
CharmingGroot wants to merge 1 commit into
NVIDIA:mainfrom
CharmingGroot:fix/lp3-allowed-tools-field
Open

fix(mcp): treat allowed-tools as a permission declaration for LP3#27
CharmingGroot wants to merge 1 commit into
NVIDIA:mainfrom
CharmingGroot:fix/lp3-allowed-tools-field

Conversation

@CharmingGroot

Copy link
Copy Markdown

Fixes #15.

While reading the MCP least-privilege path I confirmed the reported false positive. LP3 flags standard-compliant skills, and the cause is a field-name mismatch between SkillSpector and the Agent Skills standard.

What this fixes

LP3 ("no declared permissions but code capabilities were detected") fired on skills that declare capabilities through allowed-tools, the field defined by the Agent Skills standard. Two things combined to cause it:

  1. _parse_manifest only extracted permissions and dropped allowed-tools, so the field never reached the analyzer.
  2. mcp_least_privilege only read permissions, so a skill declaring e.g. allowed-tools: [Bash, Read] was treated as having no declaration at all.

_parse_manifest now parses and preserves allowed-tools (both the list form [Bash, Read] and the comma-separated string form Bash, Read), and LP3 treats a non-empty allowed-tools as a valid declaration. LP1/LP4 continue to use the explicit permissions list only, so this change stays scoped to the LP3 false positive in the issue.

Scanning a skill that declares allowed-tools: [Bash, Read] with shell/file-read code no longer reports LP3.

Testing

  • ruff check src/ tests/ and ruff format --check src/ tests/ pass.
  • pytest -m 'not integration' passes (605 passed, 11 skipped). The integration suite needs an LLM endpoint and is unaffected.
  • Added regression tests: allowed-tools parsing in build_context (list, comma-string, and malformed-value forms) and LP3 not firing when allowed-tools is declared. The existing "no declaration" test still asserts LP3 fires.

LP3 fired on standard-compliant skills that declare capabilities via the
Agent Skills `allowed-tools` field: _parse_manifest dropped allowed-tools,
and the analyzer only read `permissions`, so a skill declaring
`allowed-tools: [Bash, Read]` was reported as having no declared permissions.

Parse and preserve `allowed-tools` (list or comma-separated string) in
_parse_manifest, and treat a non-empty allowed-tools alongside `permissions`
when evaluating LP3's "no declared permissions" condition. LP1/LP4 continue
to use the explicit `permissions` list only.

Add regression tests for allowed-tools parsing (both forms) and for LP3 no
longer firing when allowed-tools is declared.

Signed-off-by: CharmingGroot <70020572+CharmingGroot@users.noreply.github.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

Development

Successfully merging this pull request may close these issues.

LP3 fires when capabilities are declared via the standard allowed-tools field instead of permissions

1 participant