Skip to content

Conversation

DarshitChanpura
Copy link
Member

@DarshitChanpura DarshitChanpura commented Oct 13, 2025

Description

Implements resource-access-control for workflow and workflow_state.

Related Issues

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

@DarshitChanpura
Copy link
Member Author

CI will resolve once: opensearch-project/security#5677 is merged.

Signed-off-by: Darshit Chanpura <[email protected]>
@DarshitChanpura
Copy link
Member Author

CI blocked by #1252

Copy link
Member

@owaiskazi19 owaiskazi19 left a comment

Choose a reason for hiding this comment

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

1st iteration


dependencies {
// For resource access control
compileOnly group: 'org.opensearch', name:'opensearch-security-spi', version:"3.4.0-SNAPSHOT"
Copy link
Member

Choose a reason for hiding this comment

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

Can we fetch the version from the variable?

testImplementation("org.junit.jupiter:junit-jupiter:${junitJupiterVersion}")
testImplementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${versions.jackson_databind}")

testImplementation 'org.awaitility:awaitility:4.3.0'
Copy link
Member

Choose a reason for hiding this comment

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

Constant for the version

// | Output for ./bin/opensearch-plugin:ERROR: transport error 202: connect failed: Connection refused
// | ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
// | JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:700].
// So instead, we listen to a debugger by saying server=y and suspend=n
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove the comments?

* @return true if resource-authz should be used, false otherwise
*/
public static boolean shouldUseResourceAuthz(String resourceType) {
var client = ResourceSharingClientAccessor.getInstance().getResourceSharingClient();
Copy link
Member

Choose a reason for hiding this comment

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

Can we make it explicit

Suggested change
var client = ResourceSharingClientAccessor.getInstance().getResourceSharingClient();
ResourceSharingClient client = ResourceSharingClientAccessor.getInstance().getResourceSharingClient();

* @param onSuccess consumer function to execute if resource sharing feature is enabled
* @param fallbackOn501 consumer function to execute if resource sharing feature is disabled.
*/
public static void verifyResourceAccessAndProcessRequest(String resourceType, Runnable onSuccess, Runnable fallbackOn501) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public static void verifyResourceAccessAndProcessRequest(String resourceType, Runnable onSuccess, Runnable fallbackOn501) {
public static void verifyResourceAccessAndProcessRequest(String resourceType, Runnable onSuccess, Runnable onFailure) {


private Subject subject;

public PluginClient(Client delegate) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public PluginClient(Client delegate) {
public PluginClient(Client client) {

super(delegate);
}

public PluginClient(Client delegate, Subject subject) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public PluginClient(Client delegate, Subject subject) {
public PluginClient(Client client, Subject subject) {

super(delegate);
}

public PluginClient(Client delegate, Subject subject) {
Copy link
Member

Choose a reason for hiding this comment

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

Where this constructor used?

Request request,
ActionListener<Response> listener
) {
if (subject == null) {
Copy link
Member

Choose a reason for hiding this comment

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

subject would be null with the first constructor call, right?

* Accessor for resource sharing client
*/
public class ResourceSharingClientAccessor {
private ResourceSharingClient CLIENT;
Copy link
Member

Choose a reason for hiding this comment

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

Can make it as thread safe?

Suggested change
private ResourceSharingClient CLIENT;
private final AtomicReference<ResourceSharingClient> client = new AtomicReference<>();

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.

Onboard flow-framework plugin to Centralized Resource AuthZ framework

2 participants