Pr3 extractors ir - #8
Open
AtharvKshirsagar wants to merge 19 commits into
Open
Conversation
… CFN templates - Introduced ReachabilityDriftDetector for detecting architectural drift between two CanonicalIR snapshots. - Added CLI options: --cfn-t2 for a second CFN template and --drift for outputting a DriftReport JSON. - Enhanced existing CLI help descriptions for clarity. - Implemented supporting classes and methods for drift detection, including ComponentMatcher and exposure computation. - Added unit tests to validate drift detection functionality.
Extends Stage 5 beyond reachability drift. Adds PrivilegeDriftDetector (CAN_DO action-set diff: wildcard/admin grant -> BLOCK, destructive-on-datastore -> BLOCK when internet-exposed else WARN, narrowing -> no finding) and ControlDriftDetector (PROTECTED_BY removal: encryption/public-access-block -> BLOCK, versioning/HTTPS/IMDSv2 -> WARN). CompositeDriftDetector runs all classes and returns the worst verdict.
Co-authored-by: atharv <atharv@atharvs-MacBook-Air.local>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds signals to the CanonicalIR that the existing extractors structurally could not see.
No new IR — same model, new node/edge types so the facts exist to diff.
IAMPostureExtractor(new)IAMEdgeExtractoronly emitsCAN_DOwhen a statement'sResourceresolves to anin-stack
Ref. Three whole classes of privilege were therefore invisible:AdministratorAccess,PowerUserAccess)Resource: "*"Resource::Wildcardsts:AssumeRoletrust policiesStandalone roles (a CI/deployment role with no compute attached) get a synthetic
principal node — a role holding
AdministratorAccessis an escalation regardlessof what assumes it.
PublicEntryExtractor(new)A Lambda Function URL is a public HTTPS endpoint on the function itself — no security
group, no load balancer. Invisible to SG-based reachability. Now emits an
Internet → functionNETWORK_PATH edge.AuthControlExtractor(extended)Handles
AWS::Lambda::Url—AuthType: AWS_IAMvsNONE.Precision guardrails
Two filters prevent this from becoming a false-positive generator:
xray:PutTraceSegmentsonResource: "*". Wildcard statements on telemetry/read-only services are excluded —without this, precision dropped to 46%.
AWSLambdaBasicExecutionRoleand friends are explicitlylisted as non-escalating.
Impact
Privilege drift detection 1/10 → 6/10 on the benchmark with detector logic
essentially unchanged — evidence that extraction, not detection, was the bottleneck.
Combined with #: recall 20% → 30%, precision 59% → 94%.
Tests
146 passing. One pre-existing
test_graphdiff.pyfailure ondrift-classes, unrelated.