Skip to content

aws/config: fix null EvaluationResults crash in CEL program#18751

Closed
kcreddy wants to merge 3 commits intoelastic:mainfrom
kcreddy:aws-config-bug-EvaluationResults-null
Closed

aws/config: fix null EvaluationResults crash in CEL program#18751
kcreddy wants to merge 3 commits intoelastic:mainfrom
kcreddy:aws-config-bug-EvaluationResults-null

Conversation

@kcreddy
Copy link
Copy Markdown
Contributor

@kcreddy kcreddy commented May 1, 2026

Proposed commit message

aws/config: fix null EvaluationResults crash in CEL program

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.

Add type(body.EvaluationResults) == list into the condition to 
safely handle both missing and null values.

Update the system test mock to return null EvaluationResults for
one config rule, covering this scenario.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

How to test this PR locally

Added system test scenario passes.

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.
@kcreddy kcreddy marked this pull request as ready for review May 5, 2026 07:26
@kcreddy kcreddy requested review from a team as code owners May 5, 2026 07:26
@kcreddy kcreddy added Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] bugfix Pull request that fixes a bug issue labels May 5, 2026
@infra-vault-gh-plugin-prod
Copy link
Copy Markdown

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@kcreddy kcreddy self-assigned this May 5, 2026
@efd6
Copy link
Copy Markdown
Contributor

efd6 commented May 5, 2026

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.

@kcreddy
Copy link
Copy Markdown
Contributor Author

kcreddy commented May 5, 2026

This looks like a dup of #18787, but you were here first.

I like that you were also fixing in other places. Lets go with your change. I like that one. Thanks for flagging, I thought I fixed it already last week :(

Closing as duplicate of #18787

@kcreddy kcreddy closed this May 5, 2026
@elastic-vault-github-plugin-prod
Copy link
Copy Markdown

🚀 Benchmarks report

Package aws 👍(14) 💚(4) 💔(4)

Expand to view
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

@elasticmachine
Copy link
Copy Markdown

💚 Build Succeeded

History

cc @kcreddy

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

Labels

bugfix Pull request that fixes a bug issue Integration:aws AWS Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants