Skip to content

Conversation

@jychp
Copy link
Collaborator

@jychp jychp commented Feb 4, 2026

Type of change

  • New feature (non-breaking change that adds functionality)

Summary

This PR clarifies the distinction between two security concepts for API Gateway REST APIs:

  1. anonymous_access (existing): Policy-level access determined by PolicyUniverse analysis of the resource policy. Indicates whether the policy allows anonymous/public access.

  2. exposed_internet (new): Network-level exposure based on endpoint configuration type:

    • EDGE → Internet exposed (default, via CloudFront)
    • REGIONAL → Internet exposed (direct regional access)
    • PRIVATE → NOT internet exposed (VPC-only via VPC Endpoints)

Problem solved: Previously, a PRIVATE API Gateway with an open resource policy would show anonymous_access=true, which is misleading because the API is not actually reachable from the internet. Now users can use exposed_internet to determine network reachability and combine both properties for accurate security assessment.

New properties on APIGatewayRestAPI:

Property Type Description
endpoint_type String The endpoint configuration type (EDGE, REGIONAL, or PRIVATE)
exposed_internet Boolean true for EDGE/REGIONAL endpoints, false for PRIVATE endpoints

Related issues or links

How was this tested?

  • Updated integration tests to verify both REGIONAL and PRIVATE endpoint types
  • test-001 (REGIONAL): endpoint_type='REGIONAL', exposed_internet=true
  • test-002 (PRIVATE): endpoint_type='PRIVATE', exposed_internet=false

Checklist

General

  • I have read the contributing guidelines.
  • The linter passes locally (make lint).
  • I have added/updated tests that prove my fix is effective or my feature works.

Proof of functionality

  • New or updated unit/integration tests.

If you are changing a node or relationship

Notes for reviewers

  • The endpointConfiguration.types field is already returned by the AWS get_rest_apis API and was present in our test data, so no additional API calls are needed.
  • The types field is a list for historical AWS API reasons but in practice contains only one element.
  • This is a non-breaking change - existing queries using anonymous_access will continue to work.

Clarifies the distinction between two security concepts for API Gateway:
- anonymous_access: Policy-level access (from PolicyUniverse analysis)
- exposed_internet: Network-level exposure (from endpoint configuration)

API Gateway endpoint types and their internet exposure:
- EDGE: Internet exposed (default, via CloudFront)
- REGIONAL: Internet exposed (direct regional access)
- PRIVATE: NOT internet exposed (VPC-only via VPC Endpoints)

This allows users to correctly identify APIs that are truly accessible
from the internet vs those that only have permissive policies but are
network-isolated.

Resolves #1452

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Jeremy Chapeau <jeremy@subimage.io>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 4 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="cartography/models/aws/apigateway/apigateway.py">

<violation number="1" location="cartography/models/aws/apigateway/apigateway.py:27">
P2: Consider adding an index for `endpoint_type` since it is a lookup-heavy field for filtering API Gateway exposure and isn’t auto-indexed.

(Based on your team's feedback about indexing security-relevant and lookup-heavy properties.) [FEEDBACK_USED]</violation>

<violation number="2" location="cartography/models/aws/apigateway/apigateway.py:28">
P2: Consider adding an index for `exposed_internet`; it’s a security-relevant filter that will be used in compliance queries and isn’t auto-indexed.

(Based on your team's feedback about indexing security-relevant and lookup-heavy properties.) [FEEDBACK_USED]</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

These security-relevant properties will be used in compliance queries
and should be indexed for efficient filtering.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Jeremy Chapeau <jeremy@subimage.io>
Copy link
Collaborator

@kunaals kunaals left a comment

Choose a reason for hiding this comment

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

tyty this is awesome

@jychp jychp enabled auto-merge (squash) February 4, 2026 21:42
@jychp jychp merged commit afe2597 into master Feb 4, 2026
5 of 8 checks passed
@jychp jychp deleted the jeremy/api-gateway-internet-exposure branch February 4, 2026 21:47
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.

Anonymous access vs Internet exposure

2 participants