-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
[UII] Allow Fleet Fleet post secret and get secret to accept array of strings #124607
base: main
Are you sure you want to change the base?
Conversation
Add tests Fix tests [CI] Auto commit changes from spotless
b6ac015
to
4fe3ef9
Compare
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.
Pull Request Overview
This PR updates the Fleet secret APIs to allow storing and retrieving secrets as an array of strings in addition to a single string. Key changes include updating the secret request/response classes to support multiple value types, adding appropriate parser logic, and extending YAML tests to cover the multi-value scenarios.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
x-pack/plugin/fleet/src/main/java/org/elasticsearch/xpack/fleet/action/TransportGetSecretAction.java | Adjusts GET secret handling to support a list of strings |
x-pack/plugin/fleet/src/main/java/org/elasticsearch/xpack/fleet/action/PostSecretRequest.java | Updates parsing, serialization, and validation to handle multi-value secrets |
x-pack/plugin/fleet/src/main/java/org/elasticsearch/xpack/fleet/action/GetSecretResponse.java | Modifies response serialization to support returning a string array |
x-pack/plugin/fleet/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/fleet/40_secrets_get.yml | Adds integration test for retrieving multi-value secrets |
x-pack/plugin/fleet/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/fleet/30_secrets_post.yml | Adds integration test for creating multi-value secrets |
x-pack/plugin/fleet/src/test/java/org/elasticsearch/xpack/fleet/action/PostSecretRequestTests.java | Introduces unit tests for validating behavior with multiple and invalid secret values |
Comments suppressed due to low confidence (1)
x-pack/plugin/fleet/src/main/java/org/elasticsearch/xpack/fleet/action/PostSecretRequest.java:60
- The StreamInput deserialization only reads a String, which does not support the new array type. Update the deserialization logic to distinguish between a single string and an array of strings.
this.value = in.readString();
id = in.readString(); | ||
value = in.readString(); | ||
this.id = in.readString(); | ||
this.value = in.readString(); |
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.
The StreamInput deserialization for 'value' only handles a single String. When a multi-value secret is returned, the stream reading should be updated to properly deserialize a String array.
this.value = in.readString(); | |
if (in.readBoolean()) { | |
this.value = in.readString(); | |
} else { | |
this.value = in.readStringArray(); | |
} |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
gradle check
?