Skip to content

Commit

Permalink
Unauthorized route migration for routes owned by appex-ai-infra,obs-a…
Browse files Browse the repository at this point in the history
…i-assistant,security-generative-ai (elastic#198351)

### Authz API migration for unauthorized routes

This PR migrates unauthorized routes owned by your team to a new
security configuration.
Please refer to the documentation for more information: [Authorization
API](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization)

### **Before migration:**
```ts
router.get({
  path: '/api/path',
  ...
}, handler);
```

### **After migration:**
```ts
router.get({
  path: '/api/path',
  security: {
    authz: {
      enabled: false,
      reason: 'This route is opted out from authorization because ...',
    },
  },
  ...
}, handler);
```

### What to do next?
1. Review the changes in this PR.
2. Elaborate on the reasoning to opt-out of authorization.
3. Routes without a compelling reason to opt-out of authorization should
plan to introduce them as soon as possible.
2. You might need to update your tests to reflect the new security
configuration:
  - If you have snapshot tests that include the route definition.

## Any questions?
If you have any questions or need help with API authorization, please
reach out to the `@elastic/kibana-security` team.

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
kibanamachine and elasticmachine authored Nov 15, 2024
1 parent f716948 commit 61b9e68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x-pack/plugins/inference/server/routes/chat_complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ export function registerChatCompleteRoute({
router.post(
{
path: '/internal/inference/chat_complete',
security: {
authz: {
enabled: false,
reason: 'This route is opted out from authorization',
},
},
validate: {
body: chatCompleteBodySchema,
},
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/inference/server/routes/connectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export function registerConnectorsRoute({
router.get(
{
path: '/internal/inference/connectors',
security: {
authz: {
enabled: false,
reason: 'This route is opted out from authorization',
},
},
validate: {},
},
async (_context, request, response) => {
Expand Down

0 comments on commit 61b9e68

Please sign in to comment.