🐛 Fix nil pointer dereferences in EC2, Elasticsearch, Config, Inspector#6924
Merged
🐛 Fix nil pointer dereferences in EC2, Elasticsearch, Config, Inspector#6924
Conversation
- EC2: guard device.Ebs, instance.Monitoring, instance.State against nil - Elasticsearch: nil-check EncryptionAtRestOptions and NodeToNodeEncryptionOptions (matching OpenSearch pattern) - Config: nil-check RecordingGroup before accessing fields - Inspector: nil-check ScanStatus and AmiId before dereferencing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
aws_ec2.go): Guarddevice.Ebs,instance.Monitoring, andinstance.Stateagainst nil before accessing their fields ingatherInstanceInfo. Instance-store volumes have nilEbs, and the Monitoring/State pointers can also be nil.aws_es.go): Nil-checkEncryptionAtRestOptionsandNodeToNodeEncryptionOptionsbefore accessing.Enabled, matching the existing pattern inaws_opensearch.go.aws_config.go): Nil-checkRecordingGroupbefore accessing.ResourceTypes,.AllSupported, and.IncludeGlobalResourceTypes.aws_inspector.go): Nil-checkScanStatusbefore accessing.Reasonand.StatusCode. Nil-checkAmiId(*string) before dereferencing it.Test plan
go build ./providers/aws/...) -- verified locallymql run aws -c "aws.ec2.instances { state, detailedMonitoring, deviceMappings }"against an account with instance-store backed instancesmql run aws -c "aws.es.domains { encryptionAtRestEnabled, nodeToNodeEncryptionEnabled }"against an account with legacy ES domainsmql run aws -c "aws.config.recorders"against an account where some recorders have no recording groupmql run aws -c "aws.inspector.coverages { statusReason, statusCode, ec2Instance }"against an account with Inspector coverage🤖 Generated with Claude Code