Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Removes messageSigningService api definition from openApi spec #156376

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -3402,46 +3402,6 @@
},
"parameters": []
},
"/message_signing_service/rotate_key_pair": {
"post": {
"summary": "Rotate key pair",
"tags": [
"Message Signing Service"
],
"operationId": "rotate-key-pair",
"parameters": [
{
"schema": {
"type": "boolean"
},
"in": "query",
"name": "acknowledge",
"required": true,
"description": "When set to true, rotate key pair is done. If set to false or missing, it returns an error."
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/error"
}
}
}
},
"/data_streams": {
"get": {
"summary": "List data streams",
Expand Down
27 changes: 0 additions & 27 deletions x-pack/plugins/fleet/common/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2113,33 +2113,6 @@ paths:
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
parameters: []
/message_signing_service/rotate_key_pair:
post:
summary: Rotate key pair
tags:
- Message Signing Service
operationId: rotate-key-pair
parameters:
- schema:
type: boolean
in: query
name: acknowledge
required: true
description: >-
When set to true, rotate key pair is done. If set to false or
missing, it returns an error.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
message:
type: string
'400':
$ref: '#/components/responses/error'
/data_streams:
get:
summary: List data streams
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/fleet/common/openapi/entrypoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ paths:
/agent_policies/delete:
$ref: paths/agent_policies@delete.yaml

# Message signing service
/message_signing_service/rotate_key_pair:
$ref: paths/message_signing_service@rotate_key_pair.yaml

# Data streams endpoints
/data_streams:
$ref: paths/data_streams.yaml
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@
* 2.0.
*/

import { RotateKeyPairSchema } from './message_signing_service';
import { errorMessage, RotateKeyPairSchema } from './message_signing_service';

describe('RotateKeyPairSchema', () => {
it('should throw on `false` values for acknowledge', () => {
expect(() =>
RotateKeyPairSchema.query.validate({
acknowledge: false,
})
).toThrowError(
'You must acknowledge the risks of rotating the key pair with acknowledge=true in the request parameters.'
);
).toThrowError(errorMessage);
});

it('should allow without any query', () => {
expect(() => RotateKeyPairSchema.query.validate({})).toThrowError(
'You must acknowledge the risks of rotating the key pair with acknowledge=true in the request parameters.'
);
expect(() => RotateKeyPairSchema.query.validate({})).toThrowError(errorMessage);
});

it.each([1, 'string'])('should not allow non-boolean `%s` values for acknowledge', (value) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import { schema } from '@kbn/config-schema';

export const errorMessage =
'Warning: this API will cause a key pair to rotate and should not be necessary in normal operation. If you proceed, you may need to reinstall Agents in your network. You must acknowledge the risks of rotating the key pair with acknowledge=true in the request parameters. For more information, reach out to your administrator.';
export const RotateKeyPairSchema = {
query: schema.maybe(
schema.object(
Expand All @@ -19,9 +21,7 @@ export const RotateKeyPairSchema = {
defaultValue: { acknowledge: false },
validate: (value: { acknowledge: boolean }) => {
if (!value || !value.acknowledge) {
throw new Error(
'You must acknowledge the risks of rotating the key pair with acknowledge=true in the request parameters.'
);
throw new Error(errorMessage);
}
},
}
Expand Down