x-pack/filebeat/input/cel: accept string values for secret_state#50508
x-pack/filebeat/input/cel: accept string values for secret_state#50508efd6 wants to merge 1 commit intoelastic:mainfrom
Conversation
🤖 GitHub commentsJust comment with:
|
TL;DRThe Buildkite failure is a test flake in Remediation
Investigation detailsRoot Cause
Admission control checks Evidence
Verification
Follow-up
Note 🔒 Integrity filter blocked 2 itemsThe following items were blocked because they don't meet the GitHub integrity level.
To allow these resources, lower tools:
github:
min-integrity: approved # merged | approved | unapproved | noneWhat is this? | From workflow: PR Buildkite Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
|
Flake fixed in #50492. |
|
/test |
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds a new changelog fragment and changes Filebeat's CEL input to accept 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@x-pack/filebeat/input/cel/config.go`:
- Around line 121-122: The YAML unmarshalling branch currently calling
yaml.Unmarshal([]byte(v), &s.m) produces map[interface{}]interface{} for nested
maps (breaking downstream type expectations); update the string case handling in
the secretState logic to normalize nested map keys to strings after
unmarshalling (or switch to gopkg.in/yaml.v3). Specifically, either replace the
yaml.Unmarshal call with yaml.v3's unmarshal into s.m, or keep yaml.v2 and add a
recursive normalization helper (e.g., normalizeMapIfaceToString) that walks the
unmarshalled value and converts map[interface{}]interface{} to
map[string]interface{} before assigning to s.m so downstream CEL/structpb code
and type assertions succeed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 768f98ae-0abc-4d6e-a731-439bdd8c5960
📒 Files selected for processing (5)
changelog/fragments/1778038687-cel-secret-state-unpack.yamlx-pack/filebeat/input/cel/config.gox-pack/filebeat/input/cel/config_test.gox-pack/filebeat/input/cel/input.gox-pack/filebeat/input/cel/input_manager.go
Fleet resolves secrets to their stored string values, so when
secret_state is configured with secret: true in an integration
package, the agent delivers a YAML text string rather than a
parsed map. Change SecretState from map[string]interface{} to a
custom type that implements the ucfg Unpacker interface, accepting
either a map or a string and parsing the string as YAML.
This works around a Fleet bug where type: yaml variables with
secret: true are silently corrupted during policy compilation.
See elastic/kibana#267859
Proposed commit message
Checklist
stresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing the changelog tool.Disruptive User Impact
How to test this PR locally
Related issues
type: yamlvariables withsecret: trueare silently corrupted during policy compilation kibana#267859Use cases
Screenshots
Logs