Skip to content

Add CloudFormation repair support to InfraFix - #76

Open
duartegonc wants to merge 7 commits into
sr-lab:mainfrom
duartegonc:feat/cloudformation
Open

duartegonc wants to merge 7 commits into
sr-lab:mainfrom
duartegonc:feat/cloudformation

Conversation

@duartegonc

Copy link
Copy Markdown

Summary

This MR adds an initial CloudFormation repair path to InfraFix, reusing GLITCH's intermediate representation and the existing SMT-based repair engine. CloudTrail identifies changed resources, and Cloud Control supplies their live properties.

Included

  • Add a CloudFormation parser with tests for resources, parameters, Ref, GetAtt, dependencies, mappings, conditions, nested values, and comments.
  • Add normalization and repair output support for EC2 instances and S3 bucket ACLs.
  • Add CloudTrail event parsing and change detection, plus Cloud Control state conversion.
  • Add a repair pipeline that scopes the existing solver to changed resources.
  • Use a portable Z3 invocation with a memory limit and process timeout.

Validation

  • CloudFormation parser behavior and source locations.
  • EC2 instance type repair, including parameter references and unchanged state.
  • Cloud Control state taking precedence over CloudTrail request values.
  • S3 bucket ACL repair.
  • CloudTrail lookup across multiple pages.

Result: 16 tests pass.

Limitations

  • Physical-to-logical resource ID correlation is not implemented. EC2 repair tests use logical IDs as stand-ins, so they do not validate repair with real EC2 physical IDs.
  • S3 repair is limited to ACL changes on buckets with an explicit BucketName.
  • IAM roles can be parsed but are not yet repairable.
  • The repair pipeline is programmatic and is not exposed through a CloudTrail repair CLI command.
  • The AWS-backed path has not been tested against a live AWS account.

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.

1 participant