-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Defend Workflows] Set deprecated flag to true in router for deprecated endpoint API's #197029
[Defend Workflows] Set deprecated flag to true in router for deprecated endpoint API's #197029
Conversation
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing this!
@dasansol92 If these APIs going to be removed in v9.0.0 and you want the Upgrade Assistant to show critical notices for them, please be aware of these pending changes to The tracking issue for APIs that need changes is API Deprecations replace deprecated: true with the deprecated object |
@elasticmachine merge upstream |
💔 Build Failed
Failed CI StepsMetrics [docs]
History |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated
needs to be an object within the version declaration.
You'll need to update the doc links and double check on the deprecation objects w.r.t correct replacement path and severity levels.
@@ -28,6 +28,7 @@ export function registerActionAuditLogRoutes( | |||
access: 'public', | |||
path: ENDPOINT_ACTION_LOG_ROUTE, | |||
options: { authRequired: true, tags: ['access:securitySolution'] }, | |||
deprecated: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated
needs to be declared on .addVersion
because the endpoint is being removed completely and needs to be surfaced in the Upgrade Assistant.
**
* Registers the endpoint activity_log route
* @deprecated
* @removeBy 9.0.0
*
*/
export function registerActionAuditLogRoutes(
router: SecuritySolutionPluginRouter,
endpointContext: EndpointAppContext
) {
router.versioned
.get({
access: 'public',
path: ENDPOINT_ACTION_LOG_ROUTE,
options: { authRequired: true, tags: ['access:securitySolution'] },
})
.addVersion(
{
version: '2023-10-31',
options: {
deprecated: {
documentationUrl: 'https://elastic.co', // add a link to your docs about the change
severity: 'critical',
reason: {
type: 'remove',
},
},
},
validate: {
request: EndpointActionLogRequestSchema,
},
},
withEndpointAuthz(
{ all: ['canIsolateHost'] },
endpointContext.logFactory.get('hostIsolationLogs'),
auditLogRequestHandler(endpointContext)
)
);
}
@@ -81,6 +81,7 @@ export function registerResponseActionRoutes( | |||
access: 'public', | |||
path: ISOLATE_HOST_ROUTE, | |||
options: { authRequired: true, tags: ['access:securitySolution'] }, | |||
deprecated: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move deprecated
into .addVersion
:
/**
* @deprecated use ISOLATE_HOST_ROUTE_V2 instead
*/
router.versioned
.post({
access: 'public',
path: ISOLATE_HOST_ROUTE,
options: { authRequired: true, tags: ['access:securitySolution'] },
})
.addVersion(
{
version: '2023-10-31',
options: {
deprecated: {
documentationUrl: 'https://elastic.co',
severity: 'critical',
reason: {
type: 'migrate',
newApiPath: `${ISOLATE_HOST_ROUTE_V2}`,
newApiMethod: 'post',
},
},
},
validate: {
request: IsolateRouteRequestSchema,
},
},
withEndpointAuthz({ all: ['canIsolateHost'] }, logger, redirectHandler(ISOLATE_HOST_ROUTE_V2))
);
/**
* @deprecated use RELEASE_HOST_ROUTE instead
*/
router.versioned
.post({
access: 'public',
path: UNISOLATE_HOST_ROUTE,
options: { authRequired: true, tags: ['access:securitySolution'] },
})
.addVersion(
{
version: '2023-10-31',
options: {
deprecated: {
documentationUrl: 'https://elastic.co',
severity: 'critical',
reason: {
type: 'migrate',
newApiPath: `${ISOLATE_HOST_ROUTE_V2}`
newApiMethod: 'post',
},
},
},
validate: {
request: UnisolateRouteRequestSchema,
},
},
withEndpointAuthz(
{ all: ['canUnIsolateHost'] },
logger,
redirectHandler(UNISOLATE_HOST_ROUTE_V2)
)
);
Note: RELEASE_HOST_ROUTE doesn't exist. The doc comment should probably be " use UNISOLATE_HOST_ROUTE_v2"
@@ -56,6 +56,7 @@ export function registerPolicyRoutes( | |||
access: 'public', | |||
path: AGENT_POLICY_SUMMARY_ROUTE, | |||
options: { authRequired: true }, | |||
deprecated: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to .addVersion
:
/**
* @deprecated
* @removeBy 9.0.0
*
*/
router.versioned
.get({
access: 'public',
path: AGENT_POLICY_SUMMARY_ROUTE,
options: { authRequired: true },
})
.addVersion(
{
version: '2023-10-31',
options: {
deprecated: {
documentationUrl: 'https://elastic.co', // link to docs explaining the removal
severity: 'critical',
reason: {
type: 'remove',
},
},
},
validate: {
request: GetAgentPolicySummaryRequestSchema,
},
},
withEndpointAuthz(
{ all: ['canAccessEndpointManagement'] },
logger,
getAgentPolicySummaryHandler(endpointAppContext)
)
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated
only needs to be changed to an object for merging to 8.x and main.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
route options deprecated
needs to be an object or expect a linting error: // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo}
Closing this pr since we will handle those changes in a follow up |
Summary
Set
deprecated: true
flag to endpoint api routes.These routes are already marked as deprecated in api docs:
/api/endpoint/policy/summaries
:/api/endpoint/action_log/{agent_id}
/api/endpoint/isolate
/api/endpoint/unisolate