Skip to content

Conversation

rsharma-figma
Copy link

@rsharma-figma rsharma-figma commented Aug 8, 2025

Summary

At Figma, we noticed that the /security-review command in .claude/commands/security-review.md specifies allowed-tools to restrict permissions, but this wasn't actually being enforced when the GitHub Action runs Claude Code via the CLI. This PR adds support for configurable permission restrictions to ensure Claude Code operates with minimal required permissions during security scans.

Motivation

  • Security: We want to tighten permissions to ensure Claude Code only has read-only access during security reviews
  • Flexibility: We also need the ability to extend permissions when needed (e.g., to include Notion MCP tools for documentation access) - this is not addressed in this PR as MCP configuration options are not yet available in CLI invocation
  • Consistency: Align the GitHub Action behavior with the slash command's permission model

Changes

  1. New allowed-tools input parameter in action.yml

    • Optional configuration for specifying which tools Claude Code can use
    • Defaults to secure read-only tools if not specified
  2. Permission enforcement in github_action_audit.py

    • Passes --allowedTools flag to the Claude CLI (single comma-separated string)
    • Default tools: Read, Glob, Grep, LS, Task, and limited git commands (git diff, git status, git log, git show, git remote show)
  3. Tests for the new functionality

    • Verifies default tools are used when not configured
    • Verifies custom tools override defaults
  4. Documentation updates

    • Added the new parameter to README.md
    • Listed all default allowed tools

Test Plan

  • Added unit tests for permission restrictions
  • All existing tests pass (19 tests total)
  • Verified command construction with mocked subprocess calls

Notes

This is a backward-compatible change - existing workflows will continue to work with the secure defaults applied automatically.

- Add 'allowed-tools' input parameter to action.yml for configuring Claude Code permissions
- Implement --allowedTools flag passing in github_action_audit.py
- Set secure read-only defaults (Read, Glob, Grep, LS, Task, limited git commands)
- Add tests for permission restrictions functionality
- Update documentation with new parameter and default tools list
- Claude CLI handles comma-separated tool specifications natively

This enables tighter security controls while allowing flexibility to extend
permissions for tools like Notion MCP when needed.

## Test Plan
- Added comprehensive tests for default and custom tool configurations
- Verified claude CLI handles tools with commas in specifications correctly
- All existing tests pass
@rsharma-figma rsharma-figma force-pushed the rohan/add-permission-restrictions branch from 95ab961 to db5afdf Compare August 8, 2025 03:37
@rsharma-figma rsharma-figma marked this pull request as ready for review August 8, 2025 03:44
The SimpleClaudeRunner.run_security_audit method now includes --allowedTools
parameter in the Claude command, but the test was still expecting the old
format without this parameter.

Updated test_run_security_audit_success to expect the --allowedTools parameter
with its default value of read-only tools for security scanning.

## Test Plan
- Ran python3 -m pytest claudecode/test_claude_runner.py::TestSimpleClaudeRunner::test_run_security_audit_success -v
- Ran full test suite with python3 -m pytest --tb=short
- All 175 tests now 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.

1 participant