Skip to content

Feat/ec2 full checks#10

Merged
reecebedding merged 7 commits into
mainfrom
feat/ec2-full-checks
May 18, 2026
Merged

Feat/ec2 full checks#10
reecebedding merged 7 commits into
mainfrom
feat/ec2-full-checks

Conversation

@reecebedding
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Expands the AWS EC2 plugin to collect richer compliance evidence per instance (security groups, EBS volumes, account-owned snapshots and their share permissions, AMIs, and Fast Snapshot Restore state) across multiple configurable AWS regions, and upgrades the plugin to the v2 runner/agent protocol. Also bumps Go and many dependencies, adds a Makefile, and annotates the build artifact with the new plugin protocol version.

Changes:

  • Multi-region scan + full EC2/EBS/AMI/FSR evidence collection composed into a single EC2PolicyInput, plus pagination over DescribeInstances/DescribeVolumes/DescribeSnapshots/DescribeImages/DescribeFastSnapshotRestores.
  • Upgrade to RunnerV2GRPCPlugin, adding an Init method and forwarding PolicyData from Configure, with org.ccf.plugin.protocol.version=2 annotation set on the published OCI artifact.
  • Major dependency / Go toolchain bump (agent v0.7.0-rc1, AWS SDK, OPA, etc.), new Makefile, and .gitignore entry for .config/.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
main.go Implements multi-region scan, snapshot/AMI/FSR collection, V2 plugin interface, region config parsing, helper functions.
Makefile New build/test/run helpers; includes an unconditional opa CLI presence check.
go.mod Go 1.26.1 + bumped/added direct & indirect deps (agent v0.7.0-rc1, AWS SDK, OPA, etc.).
go.sum Checksums updated to match new module graph; contains some stale/partial entries.
.github/workflows/build-and-upload.yml Annotates published OCI artifacts with org.ccf.plugin.protocol.version=2.
.gitignore Ignores local .config/ directory used by make run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile
Comment thread main.go Outdated
}

for _, createVolumePermission := range result.CreateVolumePermissions {
if string(createVolumePermission.Group) == "all" {
Comment thread main.go
Comment on lines +120 to 127
for _, region := range regions {
cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(region))
if err != nil {
l.logger.Error("unable to get instance", "error", err)
l.logger.Error("unable to load SDK config", "region", region, "error", err)
evalStatus = proto.ExecutionStatus_FAILURE
accumulatedErrors = errors.Join(accumulatedErrors, err)
break
continue
}
Comment thread main.go Outdated
Comment on lines +605 to +614
result, err := client.DescribeImages(ctx, &ec2.DescribeImagesInput{
Owners: []string{"self"},
Filters: []types.Filter{
{
Name: aws.String("block-device-mapping.snapshot-id"),
Values: snapshotIDs,
},
},
NextToken: nextToken,
})
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 6 changed files in this pull request and generated 5 comments.

Comment thread Makefile
Comment thread main.go
Comment thread main.go
Comment on lines +537 to +543
result, err := client.DescribeSnapshotAttribute(ctx, &ec2.DescribeSnapshotAttributeInput{
Attribute: types.SnapshotAttributeNameCreateVolumePermission,
SnapshotId: aws.String(snapshotID),
})
if err != nil {
return nil, err
}
Comment thread main.go Outdated
Comment on lines +658 to +680
var nextToken *string

for {
result, err := client.DescribeFastSnapshotRestores(ctx, &ec2.DescribeFastSnapshotRestoresInput{
Filters: []types.Filter{
{
Name: aws.String("snapshot-id"),
Values: snapshotIDs,
},
},
NextToken: nextToken,
})
if err != nil {
return nil, err
}

fastSnapshotRestore = append(fastSnapshotRestore, result.FastSnapshotRestores...)
if aws.ToString(result.NextToken) == "" {
return fastSnapshotRestore, nil
}

nextToken = result.NextToken
}
Comment thread main.go
Comment on lines +743 to +758
parts := strings.Split(regionValue, ",")
regions := make([]string, 0, len(parts))
seen := make(map[string]struct{}, len(parts))
for _, part := range parts {
region := strings.Trim(part, " []\"'")
if region == "" {
continue
}

if _, exists := seen[region]; exists {
continue
}

seen[region] = struct{}{}
regions = append(regions, region)
}
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 6 changed files in this pull request and generated 3 comments.

Comment thread main.go
Comment thread main.go
Comment thread Makefile
@reecebedding reecebedding merged commit 64c9bc9 into main May 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants