Repository navigation
Edit Santa rules in place - #1187
Merged
Merged
Conversation
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.
Edit Santa rules in place
Closes #1163
Problem
Santa rules could only be created and deleted. Changing a rule's policy or message meant deleting it and creating it again, which threw away the original
created_by, and Delete removed a rule with a single click.Change
API (
osctrl-api)PUT /api/v1/santa/{env}/rules/{id}, which requires environment admin like the other rule routes.409if the edit would duplicate another rule (same type, identifier and scope).404for a rule in another environment and400for invalid input or a non-numeric id.created_byandenvironment_idin the request body are ignored. The rule keeps its original creator.santa: update rule 7 TEAMID EQHXZ8M8AV ALLOWLIST scope=env -> TEAMID EQHXZ8M8AV BLOCKLIST scope=env.santa.Manager.UpdateRulewrites the fields as a map, so clearing a field (custom message, CEL expression) is saved too.Sync
osctrl-tls.UI
confirm(), as on the log sinks page) and names the rule's identifier.Docs
pkg/santa/README.mddocuments the new route.osctrl-api.yamlhas been regenerated.Security / operational impact
500instead of a409.Validation
go test ./pkg/santa/ ./cmd/api/handlers/:TestUpdateRule(manager) covers:created_bykeptTestSantaUpdateRule(handler) covers:created_byin the request ignored409,400and404403go vetandgolangci-lint(santa package and API): 0 issues.gofmtclean.make openapi-checkpasses.cd frontend && npm test(787 tests) andnpm run checkpass:PUTwith the right body and does not call create.Not verified: