Skip to content

fix: parse space-separated allowed-tools strings (fixes #327) - #330

Open
Bimpebabs wants to merge 1 commit into
NVIDIA:mainfrom
Bimpebabs:fix-327-allowed-tools-parsing
Open

fix: parse space-separated allowed-tools strings (fixes #327)#330
Bimpebabs wants to merge 1 commit into
NVIDIA:mainfrom
Bimpebabs:fix-327-allowed-tools-parsing

Conversation

@Bimpebabs

@Bimpebabs Bimpebabs commented Aug 1, 2026

Copy link
Copy Markdown

Fixes #327

What

Fixes the allowed-tools parsing bug where space-separated tool names were treated as a single tool, causing false positives on fully-declared skills.

Why

The current parsing splits on commas but not whitespace. A declaration like allowed-tools: Bash Read is parsed as a single tool named Bash Read, which never matches any actual tool name. This causes the LP1 check to fire on skills that have correctly declared their tools.

How

  • build_context.py: split the allowed-tools string on whitespace (spaces, tabs, newlines) when no comma is present. Comma-separated strings continue to work as before.
  • mcp_least_privilege.py: same fix in _normalize_allowed_tools for consistency.
  • Added test cases for: space-separated, mixed whitespace, single-tool space-separated, and the existing comma-separated and list forms.

Testing

  • Added 4 new test cases covering the parsing variations
  • All 41 existing tests pass (38 pass, 2 skipped, 1 pre-existing Windows-specific failure unrelated to this change)
  • Manual verification with a test skill file

Manual verification

Tested on: Windows 11, Python 3.14

Steps:

  1. Created a test skill with allowed-tools: Bash Read (space-separated)
  2. Ran skillspector scan on the test skill
  3. Confirmed LP1 does not fire for the declared tools
  4. Ran the same test with allowed-tools: Bash, Read (comma-separated) — backward compat confirmed
  5. Ran with allowed-tools: [Bash, Read] (list form) — backward compat confirmed

Result: PASS — space-separated parsed correctly, LP1 false positive eliminated, backward compatibility maintained.

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

[Automated SkillSpector Review]

Requesting changes. The space-separated allowed-tools behavior is correct and its focused tests pass (11 tests), but the exact patch fails the repository format gate: ruff format --check reports that src/skillspector/nodes/build_context.py would be reformatted. Please run Ruff format on that file and update the PR.

[str(p) for p in permissions] if isinstance(permissions, list) else []
)
# `allowed-tools` (Agent Skills standard) — accept list or comma string.
# `allowed-tools` (Agent Skills standard) — accept list, comma string, or space-separated string.

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.

Blocking CI issue: the exact head fails ruff format --check; Ruff reports this file would be reformatted. Please run ruff format src/skillspector/nodes/build_context.py and commit the result. The focused behavior tests already pass.

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.

Space-separated allowed-tools is parsed as a single tool name, so LP1 fires on fully-declared skills

2 participants