aws/config: fix null EvaluationResults crash in CEL program#18751
Closed
kcreddy wants to merge 3 commits intoelastic:mainfrom
Closed
aws/config: fix null EvaluationResults crash in CEL program#18751kcreddy wants to merge 3 commits intoelastic:mainfrom
kcreddy wants to merge 3 commits intoelastic:mainfrom
Conversation
The GetComplianceDetailsByConfigRule AWS API can return
{"EvaluationResults": null} instead of an empty array when no
compliance results exist for a rule. The CEL program used
has(body.EvaluationResults) && size(body.EvaluationResults) > 0
to check for results, but has() returns true for null values and
size(null) has no overload in CEL, causing a runtime crash.
Replace with size(body.?EvaluationResults.orValue([])) > 0 which
uses optional field access to safely handle both missing and null
values.
Update the system test mock to return null EvaluationResults for
one config rule, covering this scenario.
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
Contributor
|
This looks like a dup of #18787. Except I'm not convinced by the type check. Formally, this change here is more correct, but I think the change there is easier to read with approximately no additional risk. |
Contributor
Author
🚀 Benchmarks reportPackage
|
| Data stream | Previous EPS | New EPS | Diff (%) | Result |
|---|---|---|---|---|
lambda_logs |
11627.91 | 7874.02 | -3753.89 (-32.28%) | 💔 |
securityhub_insights |
1652.89 | 1375.52 | -277.37 (-16.78%) | 💔 |
vpcflow |
8771.93 | 6944.44 | -1827.49 (-20.83%) | 💔 |
ec2_logs |
58823.53 | 40000 | -18823.53 (-32%) | 💔 |
To see the full report comment with /test benchmark fullreport
💚 Build Succeeded
History
cc @kcreddy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed commit message
Checklist
changelog.ymlfile.How to test this PR locally
Added system test scenario passes.