Skip to content

Commit

Permalink
[Authz] Migrated authorized routes owned by @elastic/security-generat…
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Oct 29, 2024
1 parent c7b8ca0 commit 67375d6
Show file tree
Hide file tree
Showing 25 changed files with 107 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ export const bulkActionAnonymizationFieldsRoute = (
.post({
access: 'public',
path: ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
security: {
authz: {
requiredPrivileges: ['securitySolution-updateAIAssistantAnonymization'],
},
},
options: {
tags: ['access:securitySolution-updateAIAssistantAnonymization'],
timeout: {
idleSocket: moment.duration(15, 'minutes').asMilliseconds(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export const findAnonymizationFieldsRoute = (
.get({
access: 'public',
path: ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export const getAttackDiscoveryRoute = (router: IRouter<ElasticAssistantRequestH
.get({
access: 'internal',
path: ATTACK_DISCOVERY_BY_CONNECTOR_ID,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ export const cancelAttackDiscoveryRoute = (
.post({
access: 'internal',
path: ATTACK_DISCOVERY_CANCEL_BY_CONNECTOR_ID,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ export const postAttackDiscoveryRoute = (
.post({
access: 'internal',
path: ATTACK_DISCOVERY,
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
options: {
tags: ['access:elasticAssistant'],
timeout: {
idleSocket: ROUTE_HANDLER_TIMEOUT,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ export const getCapabilitiesRoute = (router: IRouter<ElasticAssistantRequestHand
.get({
access: INTERNAL_API_ACCESS,
path: CAPABILITIES,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ export const chatCompleteRoute = (
access: 'public',
path: ELASTIC_AI_ASSISTANT_CHAT_COMPLETE_URL,

options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ export const getEvaluateRoute = (router: IRouter<ElasticAssistantRequestHandlerC
.get({
access: INTERNAL_API_ACCESS,
path: ELASTIC_AI_ASSISTANT_EVALUATE_URL,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ export const postEvaluateRoute = (
.post({
access: INTERNAL_API_ACCESS,
path: ELASTIC_AI_ASSISTANT_EVALUATE_URL,
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
options: {
tags: ['access:elasticAssistant'],
timeout: {
idleSocket: ROUTE_HANDLER_TIMEOUT,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export const deleteKnowledgeBaseRoute = (
.delete({
access: 'internal',
path: ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_URL,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ export const bulkActionKnowledgeBaseEntriesRoute = (router: ElasticAssistantPlug
.post({
access: 'internal',
path: ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_ENTRIES_URL_BULK_ACTION,
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
options: {
tags: ['access:elasticAssistant'],
timeout: {
idleSocket: moment.duration(15, 'minutes').asMilliseconds(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ export const createKnowledgeBaseEntryRoute = (router: ElasticAssistantPluginRout
access: 'internal',
path: ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_ENTRIES_URL,

options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ export const findKnowledgeBaseEntriesRoute = (router: ElasticAssistantPluginRout
.get({
access: 'internal',
path: ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_ENTRIES_URL_FIND,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ export const getKnowledgeBaseStatusRoute = (router: ElasticAssistantPluginRouter
.get({
access: 'internal',
path: ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_URL,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ export const postKnowledgeBaseRoute = (router: ElasticAssistantPluginRouter) =>
.post({
access: 'internal',
path: ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_URL,
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
options: {
tags: ['access:elasticAssistant'],
timeout: {
idleSocket: ROUTE_HANDLER_TIMEOUT,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ export const postActionsConnectorExecuteRoute = (
.post({
access: 'internal',
path: POST_ACTIONS_CONNECTOR_EXECUTE,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ export const bulkPromptsRoute = (router: ElasticAssistantPluginRouter, logger: L
.post({
access: 'public',
path: ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION,
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
options: {
tags: ['access:elasticAssistant'],
timeout: {
idleSocket: moment.duration(15, 'minutes').asMilliseconds(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ export const findPromptsRoute = (router: ElasticAssistantPluginRouter, logger: L
.get({
access: 'public',
path: ELASTIC_AI_ASSISTANT_PROMPTS_URL_FIND,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export const appendConversationMessageRoute = (router: ElasticAssistantPluginRou
.post({
access: 'internal',
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID_MESSAGES,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ export const bulkActionConversationsRoute = (
.post({
access: 'internal',
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION,
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
options: {
tags: ['access:elasticAssistant'],
timeout: {
idleSocket: moment.duration(15, 'minutes').asMilliseconds(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ export const createConversationRoute = (router: ElasticAssistantPluginRouter): v
access: 'public',
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL,

options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ export const deleteConversationRoute = (router: ElasticAssistantPluginRouter) =>
.delete({
access: 'public',
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export const findUserConversationsRoute = (router: ElasticAssistantPluginRouter)
.get({
access: 'public',
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export const readConversationRoute = (router: ElasticAssistantPluginRouter) => {
.get({
access: 'public',
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ export const updateConversationRoute = (router: ElasticAssistantPluginRouter) =>
.put({
access: 'public',
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID,
options: {
tags: ['access:elasticAssistant'],
security: {
authz: {
requiredPrivileges: ['elasticAssistant'],
},
},
})
.addVersion(
Expand Down

0 comments on commit 67375d6

Please sign in to comment.