Skip to content

🐛 Fix AWS provider panics and Route53 tag fetching#6979

Merged
preslavgerchev merged 3 commits intomainfrom
preslav/fix-aws-panic
Mar 18, 2026
Merged

🐛 Fix AWS provider panics and Route53 tag fetching#6979
preslavgerchev merged 3 commits intomainfrom
preslav/fix-aws-panic

Conversation

@preslavgerchev
Copy link
Copy Markdown
Contributor

Summary

  • Set StateIsNull on nil returns for singular resource accessors in aws_route53.go and aws_ecs.go — 11 return nil, nil statements across 9 functions were missing plugin.StateIsSet | plugin.StateIsNull, which could cause panics when the runtime accessed unset fields.
  • Fix Route53 hosted zone tag fetching — the hosted zone ID from AWS includes a /hostedzone/ prefix (e.g. /hostedzone/Z1234), but the tagging API expects the bare ID. Tags were never being matched to zones.

Test plan

  • Build and install the AWS provider (make providers/build/aws && make providers/install/aws)
  • Verify Route53 hosted zones return tags: mql run aws -c "aws.route53.hostedZones { tags }"
  • Verify nil resource accessors don't panic: mql run aws -c "aws.route53.hostedZones { queryLoggingConfig }"
  • Verify ECS task definitions with optional fields don't panic: mql run aws -c "aws.ecs.taskDefinitions { ephemeralStorage }"

🤖 Generated with Claude Code

preslavgerchev and others added 2 commits March 18, 2026 20:38
Fix singular resource accessor functions in aws_route53.go and aws_ecs.go
that returned nil, nil without first setting plugin.StateIsSet | plugin.StateIsNull,
which could cause panics when the runtime tried to use the unset field.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The hosted zone ID from AWS includes a `/hostedzone/` prefix (e.g.
`/hostedzone/Z1234`), but the tagging API expects just the bare ID.
Strip the prefix before batch-fetching and looking up tags.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

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

Fixes nil-pointer panics when optional ECS/Route53 resource fields are absent, and fixes Route53 tag fetching by stripping the hosted zone ID prefix.

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

5 504 tests  ±0   5 500 ✅ ±0   2m 3s ⏱️ -12s
  410 suites ±0       4 💤 ±0 
   31 files   ±0       0 ❌ ±0 

Results for commit 998dd75. ± Comparison against base commit a0a64af.

Add guidance to CLAUDE.md about always setting plugin.StateIsSet | plugin.StateIsNull
before returning nil, nil from singular resource accessor functions.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@preslavgerchev preslavgerchev merged commit 35270c7 into main Mar 18, 2026
12 checks passed
@preslavgerchev preslavgerchev deleted the preslav/fix-aws-panic branch March 18, 2026 19:11
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants