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

Authorized route migration for routes owned by @elastic/security-defend-workflows #198197

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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export const getAssetsStatusRoute = (router: IRouter, osqueryContext: OsqueryApp
.get({
access: 'internal',
path: '/internal/osquery/assets',
options: { tags: [`access:${PLUGIN_ID}-writePacks`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-writePacks`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export const updateAssetsRoute = (router: IRouter, osqueryContext: OsqueryAppCon
.post({
access: 'internal',
path: '/internal/osquery/assets/update',
options: { tags: [`access:${PLUGIN_ID}-writePacks`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-writePacks`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export const getAgentDetailsRoute = (router: IRouter, osqueryContext: OsqueryApp
.get({
access: 'internal',
path: '/internal/osquery/fleet_wrapper/agents/{id}',
options: { tags: [`access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export const getAgentPoliciesRoute = (router: IRouter, osqueryContext: OsqueryAp
.get({
access: 'internal',
path: '/internal/osquery/fleet_wrapper/agent_policies',
options: { tags: [`access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export const getAgentPolicyRoute = (router: IRouter, osqueryContext: OsqueryAppC
.get({
access: 'internal',
path: '/internal/osquery/fleet_wrapper/agent_policies/{id}',
options: { tags: [`access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export const getAgentStatusForAgentPolicyRoute = (
.get({
access: 'internal',
path: '/internal/osquery/fleet_wrapper/agent_status',
options: { tags: [`access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export const getAgentsRoute = (router: IRouter, osqueryContext: OsqueryAppContex
.get({
access: 'internal',
path: '/internal/osquery/fleet_wrapper/agents',
options: { tags: [`access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export const getPackagePoliciesRoute = (router: IRouter, osqueryContext: Osquery
.get({
access: 'internal',
path: '/internal/osquery/fleet_wrapper/package_policies',
options: { tags: [`access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ export const findLiveQueryRoute = (router: IRouter<DataRequestHandlerContext>) =
.get({
access: 'public',
path: '/api/osquery/live_queries',
options: { tags: ['api', `access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
options: { tags: ['api'] },
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ export const getLiveQueryDetailsRoute = (router: IRouter<DataRequestHandlerConte
.get({
access: 'public',
path: '/api/osquery/live_queries/{id}',
options: { tags: [`access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export const getLiveQueryResultsRoute = (router: IRouter<DataRequestHandlerConte
.get({
access: 'public',
path: '/api/osquery/live_queries/{id}/results/{actionId}',
options: { tags: [`access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export const createPackRoute = (router: IRouter, osqueryContext: OsqueryAppConte
.post({
access: 'public',
path: '/api/osquery/packs',
options: { tags: [`access:${PLUGIN_ID}-writePacks`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-writePacks`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export const deletePackRoute = (router: IRouter, osqueryContext: OsqueryAppConte
.delete({
access: 'public',
path: '/api/osquery/packs/{id}',
options: { tags: [`access:${PLUGIN_ID}-writePacks`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-writePacks`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export const findPackRoute = (router: IRouter) => {
.get({
access: 'public',
path: '/api/osquery/packs',
options: { tags: [`access:${PLUGIN_ID}-readPacks`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-readPacks`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export const readPackRoute = (router: IRouter) => {
.get({
access: 'public',
path: '/api/osquery/packs/{id}',
options: { tags: [`access:${PLUGIN_ID}-readPacks`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-readPacks`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export const updatePackRoute = (router: IRouter, osqueryContext: OsqueryAppConte
.put({
access: 'public',
path: '/api/osquery/packs/{id}',
options: { tags: [`access:${PLUGIN_ID}-writePacks`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-writePacks`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export const privilegesCheckRoute = (router: IRouter, osqueryContext: OsqueryApp
.get({
access: 'internal',
path: '/internal/osquery/privileges_check',
options: {
tags: [`access:${PLUGIN_ID}-readLiveQueries`],
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-readLiveQueries`],
},
},
})
.addVersion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export const createSavedQueryRoute = (router: IRouter, osqueryContext: OsqueryAp
.post({
access: 'public',
path: '/api/osquery/saved_queries',
options: { tags: [`access:${PLUGIN_ID}-writeSavedQueries`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-writeSavedQueries`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export const deleteSavedQueryRoute = (router: IRouter, osqueryContext: OsqueryAp
.delete({
access: 'public',
path: '/api/osquery/saved_queries/{id}',
options: { tags: [`access:${PLUGIN_ID}-writeSavedQueries`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-writeSavedQueries`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export const findSavedQueryRoute = (router: IRouter, osqueryContext: OsqueryAppC
.get({
access: 'public',
path: '/api/osquery/saved_queries',
options: { tags: [`access:${PLUGIN_ID}-readSavedQueries`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-readSavedQueries`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export const readSavedQueryRoute = (router: IRouter, osqueryContext: OsqueryAppC
.get({
access: 'public',
path: '/api/osquery/saved_queries/{id}',
options: { tags: [`access:${PLUGIN_ID}-readSavedQueries`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-readSavedQueries`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export const updateSavedQueryRoute = (router: IRouter, osqueryContext: OsqueryAp
.put({
access: 'public',
path: '/api/osquery/saved_queries/{id}',
options: { tags: [`access:${PLUGIN_ID}-writeSavedQueries`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-writeSavedQueries`],
},
},
})
.addVersion(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ export const createStatusRoute = (router: IRouter, osqueryContext: OsqueryAppCon
.get({
access: 'internal',
path: '/internal/osquery/status',
options: { tags: [`access:${PLUGIN_ID}-read`] },
security: {
authz: {
requiredPrivileges: [`${PLUGIN_ID}-read`],
},
},
})
.addVersion(
{
Expand Down