refactor(core): replace update helpers with CRUD verbs - #2859
Open
codyhartsook wants to merge 1 commit into
Open
codyhartsook wants to merge 1 commit into
codyhartsook wants to merge 1 commit into
Conversation
codyhartsook
force-pushed
the
codyhartsook/scoped-authorization-followup
branch
from
September 17, 2026 17:55
f302003 to
8a0b85c
Compare
GetForUpdate implied locking that never happened, while SaveUpdate relied on every caller pairing it with an earlier authorization check. Replace them with the canonical Get and Update operations, with Update authorizing the object identity it writes. ModelConfig keeps its owned-Secret workflow local and preauthorizes update before any side effect, then performs the separately authorized read. Document the operation ordering and cover denied writes without retaining the unrelated matcher and Testify churn. Signed-off-by: Cody Hartsook <[email protected]>
codyhartsook
force-pushed
the
codyhartsook/scoped-authorization-followup
branch
from
September 17, 2026 18:23
8a0b85c to
565c21c
Compare
codyhartsook
marked this pull request as ready for review
September 17, 2026 18:44
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
Follow-up to #2710 and its request to remove Kubernetes helpers named after database transaction concepts.
GetForUpdateandSaveUpdatewithGetandUpdate.kubecrud.Updateauthorize the namespace and name it is about to write.model.Service, but authorize update before the first side effect.Authorization behavior
AgentTemplate uses a plain read-modify-write sequence:
Getauthorizes and reads, thenUpdateauthorizes and writes.ModelConfig preauthorizes update from the request reference, then performs its separately authorized read before writing owned Secrets and retrying the ModelConfig write. A denied update therefore writes neither the API key Secret nor the ModelConfig.
Reads and deletes still authorize before reading, so their denial does not reveal whether the resource exists.
Scope
The unrelated matcher hardening and Testify-only test rewrite are intentionally excluded, keeping this follow-up atomic.
Testing
make -C go lint— 0 issues(cd go && go test -short ./...)— pass