Repository navigation
🤖 fix: a CoderProvisioner keeps every key record with IDs until Coder confirms its key gone - #425
Merged
Merged
Conversation
#424) Change-Id: Iaa18cc18a5f4885026329506558d91f959884569 Signed-off-by: Thomas Kosiewski <tk@coder.com>
…er confirms its key gone (#424) Change-Id: I0b46d9be08ccaca81a9fea4bdb4324b12d30c854 Signed-off-by: Thomas Kosiewski <tk@coder.com>
…lete (#424) Change-Id: I524273d9b6e00e8fd83a9810c172f2c3be163793 Signed-off-by: Thomas Kosiewski <tk@coder.com>
… the applied key (#424) Change-Id: If519b7e06e051ef7efa2cbc01658dc401e53eec4 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
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
A
CoderProvisionerno longer drops a key record that has a key ID before Coder confirms its key gone. Status written by an older operator can hold several records of the target key under different organization IDs. Each such key is now deleted by its recorded IDs before its record goes, and a record whose delete fails stays. This fixes #424 item 1 and documents items 2 and 3 as limits in the user docs.Background
Organization names in Coder can be renamed and reused. An older operator could leave two live target records under different organization IDs. Before this PR, two paths dropped such a record while its key was still valid:
status.urlstays the same.#420 stopped new replacements from building that state. Upgraded status could still hold it.
Implementation
internal/controller/coderprovisioner_controller.go:DeleteProvisionerKeyByIDat the current URL and token. That call returns success only on Coder's own 404 or a key list without that ID. Any other error stops the reconcile before the create, and status keeps the record.status.provisionerKeyIDnow starts a rotation, so it goes through the same delete-by-ID path.tokenBoundToandControlPlaneChangedKeyKept.docs/tutorials/deploy-coderprovisioner.mddocuments the two remaining limits: a legacy record without a UID whose URL now reaches another backend (item 2), and Coder's list-then-delete-by-name race (item 3).Validation
TestCoderProvisionerKey_UpgradedStatusKeepsTargetRecordsruns against a real SDK client and an httptest Coder with two live target keys under different organization IDs:both keys deletedandpublished records: the rotation deletes both keys and the replaced key, records the new key, and deletion of the provisioner leaves no key in Coder.failed delete keeps the record: a failed key list in the older key's organization returns an error, and status keeps both records. The next reconcile deletes both.mainin both of its subtests. Commit 9a75a8f fails on 9aa56d3 inpublished records. Each following fix commit makes them pass.TestVerifierR2OlderPendingPruningfrom the 🤖 fix: a CoderProvisioner replaces only keys it recorded and binds key records to the control plane UID #420 evidence passed onmain. It now fails at its "pruned, key still live" assertion.make verify-vendor,make test,make build,make lint,make test-integration. Docs: the docs-reference diff,mkdocs build --strict,markdownlint-cli2andcspellall pass.Risks
Fixes #424
Refs #420
Generated with
mux• Model:anthropic:claude-opus-5-5• Thinking:high