Skip to content

Pr3 extractors ir - #8

Open
AtharvKshirsagar wants to merge 19 commits into
mainfrom
pr3-extractors-ir
Open

Pr3 extractors ir#8
AtharvKshirsagar wants to merge 19 commits into
mainfrom
pr3-extractors-ir

Conversation

@AtharvKshirsagar

@AtharvKshirsagar AtharvKshirsagar commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

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)

IAMEdgeExtractor only emits CAN_DO when a statement's Resource resolves to an
in-stack Ref. Three whole classes of privilege were therefore invisible:

Signal Was Now
AWS managed policies (AdministratorAccess, PowerUserAccess) no edge at all expanded to real permissions
Resource: "*" no edge at all edge to synthetic Resource::Wildcard
sts:AssumeRole trust policies not read cross-principal edges

Standalone roles (a CI/deployment role with no compute attached) get a synthetic
principal node — a role holding AdministratorAccess is an escalation regardless
of 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 → function NETWORK_PATH edge.

AuthControlExtractor (extended)

Handles AWS::Lambda::UrlAuthType: AWS_IAM vs NONE.

Precision guardrails

Two filters prevent this from becoming a false-positive generator:

  • Telemetry ≠ privilege. CDK gives every Lambda xray:PutTraceSegments on
    Resource: "*". Wildcard statements on telemetry/read-only services are excluded —
    without this, precision dropped to 46%.
  • Benign execution roles. AWSLambdaBasicExecutionRole and friends are explicitly
    listed 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.py failure on drift-classes, unrelated.

bullhacks3 and others added 19 commits June 30, 2026 21:35
… 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>
@AtharvKshirsagar
AtharvKshirsagar changed the base branch from main to drift-classes August 8, 2026 20:15
@AtharvKshirsagar
AtharvKshirsagar changed the base branch from drift-classes to main August 10, 2026 13:14
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.

4 participants