fix: gate issues.opened provisioning behind allowed_command_users + org membership#48
Open
fix: gate issues.opened provisioning behind allowed_command_users + org membership#48
Conversation
…rg membership ## Why Wave-1 Security auditor flagged this as Bug #4 in `docs/agent-fleet/bugs.md`: comment-driven ChatOps already required `requireOrgMember` AND `allowed_command_users`, but the parallel issue-form provisioning path (`controller_repo`, Cut A) had no such gate. Anyone able to file an issue with the configured `repo-request` label could trigger real org-repo creation, including via the public GitHub API. ## What Two-layer gate inserted *before* validation/enqueue in the `issues.opened` handler's controller_repo branch: 1. **`allowed_command_users`** — same allowlist that comment-driven ChatOps consults. Empty list = open to everyone (back-compat). 2. **`checkOrganizationMembership`** — defence in depth. The sender must be a member of the controller repo's owner org. The function already returns `false` on 404 / network errors, so an uncertain-membership case fails closed. Each rejection posts a specific, actionable error comment back on the issue. Sender is now read out of `context.payload.sender`. ## Source Bug #4, wave-1 Security auditor (`docs/agent-fleet/bugs.md`). ## Test plan - [x] 836 tests pass (was 834; +2 covering: not-allowed-user rejected with `not authorised` comment; sender failing org-membership check rejected with `must be a member` comment) - [x] eslint clean - [ ] After deploy: open a `repo-request`-labelled issue from a non-allowed-list account in `pulseengine/repo-requests` (when `controller_repo.enabled: true`). Bot should refuse rather than provision. ## Risk & rollout - Risk: low. Default behaviour for `allowed_command_users: []` is unchanged (still requires org membership, which existing maintainers already have). Anyone who'd previously rely on "no allowlist + no org check" must now be in the org — which is a sensible default for issue-form provisioning. - Rollout: self-update on merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Bug #4 from
docs/agent-fleet/bugs.md(wave-1 Security auditor — high severity).The issue-form provisioning path had no auth gate. Anyone able to file a labelled issue could trigger org-repo creation. Adds the same allowlist + org-membership gate that comment-driven ChatOps already enforces.
🤖 Generated with Claude Code