Skip to content

Conversation

@rithin-pullela-aws
Copy link
Contributor

@rithin-pullela-aws rithin-pullela-aws commented Oct 30, 2025

Description

This PR addresses some security issues:
Connector:

  • Prevent 500 errors when connector params like Action type, method, and URL are NULL.
  • Prevent User input reflection in connector. protocol
  • Prevent 500 level errors when Connector creds and backend roles are not not valid

Agent:

  • Prevent printing unknown Agent ID
  • Prevent printing unknown trace/ message ID in traces API
  • Prevent 500 error when agent ID is unknown

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

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.

Signed-off-by: rithin-pullela-aws <[email protected]>
Copy link
Collaborator

@mingshl mingshl left a comment

Choose a reason for hiding this comment

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

LGTM

@rithin-pullela-aws
Copy link
Contributor Author

Failed because of irrelevant error:

REPRODUCE WITH: ./gradlew ':opensearch-ml-plugin:test' --tests 'org.opensearch.ml.action.prediction.PredictionITTests.testPredictionWithDataFrame_FitRCF' -Dtests.seed=29336B35042075 -Dtests.security.manager=false -Dtests.locale=en-MV -Dtests.timezone=Europe/Samara -Druntime.java=24

PredictionITTests > testPredictionWithDataFrame_FitRCF FAILED
    CircuitBreakingException[Disk Circuit Breaker is open, please check your resources!]
        at __randomizedtesting.SeedInfo.seed([29336B35042075:981D7B7DE6199531]:0)
        at app//org.opensearch.ml.utils.MLNodeUtils.checkOpenCircuitBreaker(MLNodeUtils.java:138)
        at app//org.opensearch.ml.task.MLTaskRunner.checkCBAndExecute(MLTaskRunner.java:157)
        at app//org.opensearch.ml.task.MLTaskRunner.lambda$dispatchTask$0(MLTaskRunner.java:116)
        at app//org.opensearch.core.action.ActionListener$1.onResponse(ActionListener.java:82)
        at app//org.opensearch.ml.task.MLTaskDispatcher.dispatchTaskWithRoundRobin(MLTaskDispatcher.java:99)
        at app//org.opensearch.ml.task.MLTaskDispatcher.dispatchTaskWithRoundRobin(MLTaskDispatcher.java:177)
        at app//org.opensearch.ml.task.MLTaskDispatcher.dispatch(MLTaskDispatcher.java:69)
        at app//org.opensearch.ml.task.MLTaskRunner.dispatchTask(MLTaskRunner.java:111)
        at app//org.opensearch.ml.task.MLTaskRunner.run(MLTaskRunner.java:94)
        at app//org.opensearch.ml.action.training.TransportTrainingTaskAction.doExecute(TransportTrainingTaskAction.java:42)
        at app//org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:220)
        at app//org.opensearch.action.support.TransportAction.execute(TransportAction.java:190)
        at app//org.opensearch.action.support.TransportAction.execute(TransportAction.java:109)
        at app//org.opensearch.transport.client.node.NodeClient.executeLocally(NodeClient.java:113)
        at app//org.opensearch.transport.client.node.NodeClient.doExecute(NodeClient.java:100)
        at app//org.opensearch.transport.client.support.AbstractClient.execute(AbstractClient.java:501)
        at app//org.opensearch.transport.client.FilterClient.doExecute(FilterClient.java:83)
        at app//org.opensearch.transport.client.support.AbstractClient.execute(AbstractClient.java:501)
        at app//org.opensearch.transport.client.support.AbstractClient.execute(AbstractClient.java:488)
        at app//org.opensearch.ml.action.MLCommonsIntegTestCase.trainModel(MLCommonsIntegTestCase.java:263)
        at app//org.opensearch.ml.action.MLCommonsIntegTestCase.trainBatchRCFWithDataFrame(MLCommonsIntegTestCase.java:233)
        at app//org.opensearch.ml.action.prediction.PredictionITTests.setUp(PredictionITTests.java:77)

@rithin-pullela-aws rithin-pullela-aws had a problem deploying to ml-commons-cicd-env-require-approval October 31, 2025 00:20 — with GitHub Actions Failure
@rithin-pullela-aws rithin-pullela-aws had a problem deploying to ml-commons-cicd-env-require-approval October 31, 2025 00:20 — with GitHub Actions Error
@rithin-pullela-aws rithin-pullela-aws had a problem deploying to ml-commons-cicd-env-require-approval October 31, 2025 01:07 — with GitHub Actions Failure
@rithin-pullela-aws rithin-pullela-aws had a problem deploying to ml-commons-cicd-env-require-approval October 31, 2025 06:10 — with GitHub Actions Failure
@rithin-pullela-aws rithin-pullela-aws had a problem deploying to ml-commons-cicd-env-require-approval October 31, 2025 06:10 — with GitHub Actions Error
if (parser.currentToken() != XContentParser.Token.VALUE_STRING
&& parser.currentToken() != XContentParser.Token.VALUE_NULL) {
throw new IllegalArgumentException(
"Credential values must be strings, found invalid type: " + parser.currentToken()
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to avoid putting credential token in the exception string ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

parser.currentToken does not print the value itself but rather the type of object.

});
assertEquals("Connector protocol is null", exception.getMessage());
assertEquals(
"Connector protocol is null. Please use one of [aws_sigv4, http, mcp_sse, mcp_streamable_http]",
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to use ConnectorProtocols.VALID_PROTOCOLS here also, Otherwise we need to keep on changing this exception string here whenever we add new protocols.
Or use contains() API and remove the protocol list part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants