[AlertZero] Proposal step RBAC and supersededBy - #290706
Draft
patrykkopycinski wants to merge 2 commits into
Draft
[AlertZero] Proposal step RBAC and supersededBy#290706patrykkopycinski wants to merge 2 commits into
patrykkopycinski wants to merge 2 commits into
Conversation
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
…get for API-key credentials
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
Implements parts 1 and 3 of security-team#19287 — the RBAC and schema half of proposal safety, on top of #290705.
investigations.createProposalandinvestigations.updateProposalnow verify the execution's own credentials holdmanage_proposals(viasecurity.authz.checkPrivilegesWithRequest(fakeRequest).atSpace(...)) before forwarding toProposalsService, failing closed on check errors. Mirrors therequiredPrivilegesenforcement the HTTP routes already apply — previously any workflow able to resolve the step definition could create or mutate proposals regardless of the caller's privileges.supersededByfield. Added to the proposal schema (zod), create params (immutable, worker-irrelevant), and storage mapping (keyword).ProposalsService.updatepersists it alongside a failed transition;listByWindownow filtersmust_not: exists: supersededByso a recovery chain shows only the live proposal (resolves the pre-wired TODO(Flaky test: visualize lab mode disabling does not break loading saved searches #19258)).securityadded toagenticInvestigationsrequiredPlugins (required forcheckPrivilegesWithRequest), threaded to the step definitions via a start-resolved getter, matching the context-engine pattern.Part 2 (clone-based failure recovery writing
supersededBy) lands in a follow-up stacked on this PR.Implementation notes
security.authz.actions.api.get('manage_proposals')— the bare string never matches for API-key credentials (api_authorization.tsroutes all checks throughactions.api.get). Unit-test mock mirrors the serializer so a bare-string regression fails tests.ProposalsAuthorizationError→ executionfailed; grant parks the proposal on the gate as before. Dismissal stays terminal (no clone path in this PR).End-to-end verification
Dedicated stack (own ES + Kibana, security on), driving the managed
system-create-investigation-proposalworkflow over HTTP with API keys whose role descriptors grant exactly the privileges under test:feature_workflowsManagement.allonlyfailed—ProposalsAuthorizationError: lacks manage_proposals privilege in space [default]api:manage_proposalswaiting_for_input(parked on approval gate)status: pending,expiresAtcarriedGate mutation-tested: removing the
assertManageProposalscall turns both denial tests red; restoring returns 103/103 green.Testing
step_types.test.ts: gate denial (service never called), fail-closed on check error, pass-through on grant; serializer-accurate security mockproposals_service.test.ts:supersededBypersisted on failed transition, rejected on settled proposals, excluded bylistByWindowplugin.test.ts: step definitions registered with security getter; privilege gates wiredtsc0 errors, ESLint clean