Repository navigation
Conversation
trusted_bots parameter to support Dependabot PRs
- Add allow_bot_actor parameter to enable GitHub bots to trigger Claude Code Action - Implement robust bot write permission validation - Add test coverage for bot scenarios - Update documentation with security considerations This enables automated workflows like documentation updates, CI-triggered code reviews, and scheduled maintenance while maintaining security through explicit opt-in and proper permission validation. Relevant works: anthropics#388 anthropics#280 anthropics#194 anthropics#117
|
In case it's helpful, this may be a duplicate feature of #117. |
|
@burkematthew you are right, I didn't realize it was! I'll let the contribs tell us what to do 😊 |
🎬 Live DemonstrationI've created a demonstration repository that validates this fix works correctly: Demo Repository: https://github.com/yellow-pine/claude-action-dependabot-reproDemo PRs:
Key Validation Points:
The demo uses this branch ( |
|
@ashwin-ant yes, exact same functionality, with different security characteristics is how I'd summarize it perhaps? (I've created this PR and the issue attached without realizing that prior work, despite trying to search for it. I guess wrong keywords.) |
- Add TokenContext to track token source (OIDC vs external) - Implement standardized API error handling with executeApiCall - Add trustedBots parameter to GitHub context - Add constants for bot validation (BOT_SUFFIX, SENDER_TYPE_BOT)
…pport - Add comprehensive actor validation with bot verification - Implement token-first permission checks before actor validation - Support trusted bots bypass for external tokens on pull_request events - Add security validations: bot authenticity, PR authorship, event type - Ensure OIDC tokens always require full actor verification - Rename checkHumanActor to ensureAuthorizedActor for clarity
- Add trusted_bots input parameter to action.yml - Support newline-separated list of trusted bot names - Configure empty default for backward compatibility - Pass parameter through to base action
- Update prepare entrypoint to use TokenContext - Pass TokenContext to permission validation - Update tag mode to use ensureAuthorizedActor - Add getSystemPrompt method to mode interface
- Test OIDC vs external token permission flows - Test trusted bot validation scenarios - Test security edge cases and validation rules - Add mock utilities for GitHub API responses - Achieve 100% coverage for new validation logic
- Document trusted_bots parameter in usage guide - Add 'Working with Dependabot' section to setup guide - Include security best practices and warnings - Update CLAUDE.md with authentication flow notes - Add examples for Dependabot configuration
- Consolidate bot suffix and sender type validation into single check - Use boolean comparison to detect mismatches between expected and actual bot status - Maintain same security guarantees with cleaner, more readable code
- Add allow_bot_actor parameter to enable GitHub bots to trigger Claude Code Action - Implement robust bot write permission validation - Add test coverage for bot scenarios - Update documentation with security considerations This enables automated workflows like documentation updates, CI-triggered code reviews, and scheduled maintenance while maintaining security through explicit opt-in and proper permission validation. Relevant works: anthropics#388 anthropics#280 anthropics#194 anthropics#117
- Add allow_bot_actor parameter to enable GitHub bots to trigger Claude Code Action - Implement robust bot write permission validation - Add test coverage for bot scenarios - Update documentation with security considerations This enables automated workflows like documentation updates, CI-triggered code reviews, and scheduled maintenance while maintaining security through explicit opt-in and proper permission validation. Relevant works: anthropics#388 anthropics#280 anthropics#194 anthropics#117
|
@ashwin-ant looks like #117 is moving forward. I am closing this one to avoid any confusions. Please feel free to reach out if I can be of help. |
Fixes #387 , Addresses #195
Summary
Adds support for Dependabot and other automation bots to trigger Claude Code Action on pull requests when using external tokens (PAT or custom GitHub App).
Related Work
This PR addresses a similar goal as:
While these PRs take different approaches, they all aim to enable bot users to work with Claude Code Action. This PR specifically focuses on the Dependabot use case with a security-first approach.
Problem
Claude Code Action was checking if actors like
dependabot[bot]are repository collaborators, which they never are. This caused all Dependabot PRs to fail even with valid tokens that have write permissions.Solution
This PR introduces a
trusted_botsparameter that allows specific bots to bypass actor permission checks under controlled conditions:trusted_botslist means all actors require full permission checksKey Differences from Other PRs
allowed_botswith wildcard support. This PR usestrusted_botswith explicit bot names only (no wildcards for security)Usage
Security Considerations
pull_requestevents (neverpull_request_target)trusted_botsby default (opt-in security)Testing
Added comprehensive test coverage for all permission validation scenarios, including edge cases around token types, bot validation, and error handling. All new code has 100% test coverage.
Documentation
Updated the setup guide with a new "Working with Dependabot" section that explains configuration and security best practices.
Live Demonstration
Demo repository: https://github.com/yellow-pine/claude-action-dependabot-repro
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]