Skip to content

Added workspace ACL checks for Alerting and Monitor APIs#1415

Open
nishtham-amazon wants to merge 3 commits intoopensearch-project:mainfrom
nishtham-amazon:main
Open

Added workspace ACL checks for Alerting and Monitor APIs#1415
nishtham-amazon wants to merge 3 commits intoopensearch-project:mainfrom
nishtham-amazon:main

Conversation

@nishtham-amazon
Copy link
Copy Markdown
Collaborator

Description

Add workspace ACL authorization checks to all Alerting and Monitor server-side APIs to enforce workspace-level access control for OpenSearch Serverless (AOSS) data sources.

Changes:

  • MDSEnabledClientService.ts — Added checkWorkspaceAcl() method that:

    • Only runs for AOSS (.aoss.amazonaws.com) data source endpoints; skips for managed domains
    • Extracts the calling principal from x-amzn-aosd-username header and workspace ID from request state
    • Delegates authorization to the workspace plugin's authorizeWorkspace() via the WorkspacePluginStart contract
    • Uses a local WorkspaceAuthorizer interface (structural typing) to avoid non-public import restrictions
    • Added setLogger() for production-ready logging instead of console.log
  • MonitorService.js — Added _enforceWorkspaceAcl() helper and ACL checks to all API methods:

    • Write operations (createMonitor, createWorkflow, deleteMonitor, deleteWorkflow, updateMonitor, executeMonitor, acknowledgeAlerts, acknowledgeChainedAlerts): require library_write
    • Read operations (getMonitor, getMonitors, getWorkflow, searchMonitors): require library_write or library_read
  • AlertService.js — Added same ACL pattern to getAlerts and getWorkflowAlerts

  • plugin.js — Updated start() to inject workspace plugin start contract and logger into all services

  • opensearch_dashboards.json — Added workspace to optionalPlugins

Issues Resolved

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check
here.

Signed-off-by: nishtham <nishtham@amazon.com>
Signed-off-by: nishtham <nishtham@amazon.com>
Comment thread server/services/AlertService.js Outdated
Comment thread server/services/AlertService.js Outdated
Comment thread server/services/MDSEnabledClientService.ts Outdated
Comment on lines +19 to +29
public setWorkspaceStart(workspaceStart: WorkspaceAuthorizer) {
this.workspaceStart = workspaceStart;
}

public setWorkspaceIdGetter(fn: (request: OpenSearchDashboardsRequest) => string | undefined) {
this.workspaceIdGetter = fn;
}

public setLogger(logger: Logger) {
this.logger = logger;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be set once at class instantiation time

Comment thread server/services/MDSEnabledClientService.ts
Comment thread server/services/MonitorService.js Outdated
Signed-off-by: nishtham <nishtham@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants