Skip to content

fix(api): answer a git-credentials repo_id of "org" with 404 instead of an assertion - #667

Merged
ThomasK33 merged 3 commits into
mainfrom
credential-org-repo-id-followup658
Nov 4, 2026
Merged

ThomasK33 merged 3 commits into
mainfrom
credential-org-repo-id-followup658

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Why

Follow-up to #666 (issue #658, SDK 0.1.0 tokens). The clean-context review before that merge found two valid minor gaps, and this PR fixes both.

What changes

  1. POST /api/v1/repos/git-credentials with a body repo_id of "org" hit the handler's repo-claim assertion. The handler panicked: the server answered 500 and logged a panic with a stack trace. That body value names no repository, so the handler now looks it up like any other repo_id and answers 404. The assertion still guards the fallback to the token's repo claim, which requireAuth already checks. This bug was older than fix(auth): accept any non-empty sub and treat a token without repo as org-wide #666.
  2. Docs: the GET /repos, GET /api/repo-urls/{repo_id} and PUT/DELETE /repos/git-credentials rows of docs/reference/http-api.md and the intro of docs/reference/webhooks.md now say that an org-level route also accepts a token with no repo claim. That rule is in effect since fix(auth): accept any non-empty sub and treat a token without repo as org-wide #666 and is described in docs/reference/authentication.md.

Tests

TestCredentialCreate (pg and sqlite) now sends repo_id: "org" with a valid repo-scoped token and expects 404. On main the same test fails: the handler panics with handleCreateCredential: unusable repo key "org" and the client gets EOF.

Refs #658


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

…of an assertion

Change-Id: I51476b40efd52f4264557870ace5b8debf2a8b48
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T14:42:01.824887Z 71b0910 Manual request
🔒 Security Review ✅ Completed 2026-11-04T14:42:52.997185Z 71b0910 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 783d57f42c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 783d57f42c

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

…of an assertion

Change-Id: I9081ddbfa93e114e5704174b123f6da7a29d5f35
Signed-off-by: Thomas Kosiewski <tk@coder.com>
…d-followup658

Change-Id: Id9dd94346e4963a193c3f344ac6911c37440c04c
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 71b0910408

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 71b0910408

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 8ebc5ee Nov 4, 2026
9 of 10 checks passed
@ThomasK33
ThomasK33 deleted the credential-org-repo-id-followup658 branch November 4, 2026 15:25
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