Fix cross-project GitHub task IDOR; scope webhooks per project; add github.manage permission - #25
Merged
Merged
Conversation
Every handler taking a :taskId path param (branches, pull requests) trusted it without verifying it belongs to the caller's own project — only the request body's repo_id/pr_number were project-checked. A caller with tasks.read/write on their own project could substitute a foreign taskId to read or attach GitHub records to a different project's task. Added taskBelongsToProject, called first in every affected handler, plus defense-in-depth re-checks on rows reached via a repo_id/pull_request_id that lacks its own project_id column. Also fixes two webhook bugs found while working on the above: - full_name is only unique per-project, so the webhook lookup could resolve to a different project's row (and use its secret to verify a delivery meant for this one). Moved the webhook route to /projects/:projectId/webhook and scope the repository lookup by that project_id. - a repository with no webhook secret configured skipped HMAC verification entirely and trusted the payload; it now fails closed. Introduces a github.manage custom permission covering the project's GitHub settings tab (connect/disconnect token, link/unlink repos), replacing the broader projects.read/projects.write checks those routes used before. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Minor bump: introduces the github.manage permission, replacing the projects.read/projects.write checks the project settings routes used before (existing role grants will need to add it). Co-Authored-By: Claude Sonnet 5 <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.
Summary
Every handler taking a
:taskIdpath param (branches, pull requests) trusted it without verifying it belongs to the caller's own project — only the request body'srepo_id/pr_numberwere project-checked. A caller withtasks.read/tasks.writeon their own project could substitute a foreigntaskIdto read or attach GitHub records to a different project's task.Fixes
taskBelongsToProject, called first in every affected handler, plus defense-in-depth re-checks on rows reached via arepo_id/pull_request_idthat has noproject_idcolumn of its own.full_namealone, which is only unique per-project — a delivery could be verified against a different project's secret. Moved the route to/projects/:projectId/webhookand scoped the lookup by thatproject_id.github.managecustom permission covering the project's GitHub settings tab (connect/disconnect token, link/unlink repos), replacing the broaderprojects.read/projects.writechecks those routes used before.Versioning
Bumped to
0.4.0(minor) rather than a patch bump, sincegithub.managereplaces existing permission checks — an installation with roles scoped toprojects.read/projects.writefor GitHub access will need to grantgithub.manageinstead.Verification
go test ./...andgo vet ./...pass, including new regression tests for the cross-project cases and the webhook fixes.🤖 Generated with Claude Code