File tree Expand file tree Collapse file tree
x-pack/platform/plugins/shared/agentic_investigations/server/proposals/step_types Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,10 @@ export const assertManageProposals = async ({
3939 try {
4040 const checkPrivileges = security . authz . checkPrivilegesWithRequest ( request ) ;
4141 const privileges = await checkPrivileges . atSpace ( spaceId , {
42- kibana : [ PROPOSALS_API_PRIVILEGE_MANAGE ] ,
42+ // The serialized form of a feature API privilege is prefixed (see
43+ // api_authorization.ts: requestedPrivileges.map(p => actions.api.get(p)));
44+ // checking the bare string never matches for API-key credentials.
45+ kibana : [ security . authz . actions . api . get ( PROPOSALS_API_PRIVILEGE_MANAGE ) ] ,
4346 } ) ;
4447 if ( ! privileges . hasAllRequested ) {
4548 throw new ProposalsAuthorizationError (
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ const FAKE_REQUEST = { fake: true } as never;
2424const createSecurity = ( hasAllRequested : boolean ) =>
2525 ( {
2626 authz : {
27+ // Mirrors the real serializer: feature API privileges are stored in
28+ // prefixed form (api_authorization.ts routes requests through
29+ // actions.api.get). A gate passing the bare string passes unit tests
30+ // with a naive mock but denies every real API-key caller.
31+ actions : { api : { get : ( privilege : string ) => `api:${ privilege } ` } } ,
2732 checkPrivilegesWithRequest : jest . fn ( ) . mockReturnValue ( {
2833 atSpace : jest . fn ( ) . mockResolvedValue ( { hasAllRequested } ) ,
2934 } ) ,
You can’t perform that action at this time.
0 commit comments