Skip to content

refactor(iam): drop the hand-routed scopes from the vendored routes - #9160

Merged
pgermosen merged 1 commit into
mainfrom
refactor/iam-drop-hand-routed
Nov 21, 2026
Merged

pgermosen merged 1 commit into
mainfrom
refactor/iam-drop-hand-routed

Conversation

@pgermosen

Copy link
Copy Markdown
Member

Summary

S3 was the one credential scope rest-routes.json listed as hand-routed, authorized by the registry's rules alone. #9155 moved it onto its generated routes, so the list is empty, and this removes the machinery around it. Nothing an IAM check gives changes.

  • regen_rest_routes.py: no HAND_ROUTED, no handRouted section in the file, and no required members for a hand-routed scope's routes. The requires conditions of shared routes stay.
  • rest-routes.json: loses its empty handRouted section.
  • IamRestRoutes: reads every model, and fails to load only when the file has no models.
  • regen_iam_authorized_actions.py: every model's scope is routed (routed_namespaces, route_methods).
  • Tests:
    • The generator tests of hand-routed scopes are removed, and their fixtures lose the hand-routed model.
    • IamRestRoutesTest's denial-status conflict test gets two models of its own, as the hand-routed model was its second.
    • IamRestRouteCoverageTest reads every model, and builds each request from what its route requires.

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

AWS Compatibility

No behavior changes: no scope was hand-routed.

Checklist

  • ./mvnw test passes locally (ran IamRestRoutesTest, IamRestRouteCoverageTest, IamActionRegistryTest, IamAuthorizedActionsTest, IamEnforcementFilterTest and IamRestRouteEnforcementIntegrationTest, not the whole suite)
  • New or updated integration test added
  • Commit messages follow Conventional Commits
  • I have no more than 2 open, non-draft pull requests and no more than 4 open pull requests in total (drafts included) in this repository (maintainers and dependency bots are exempt).

S3 was the one credential scope rest-routes.json listed as hand-routed, authorized by the registry's
rules alone, and #9155 moved it onto its generated routes. The list is empty, so its machinery goes:
regen_rest_routes.py no longer writes handRouted or a hand-routed scope's required members,
IamRestRoutes reads every model, regen_iam_authorized_actions.py takes every model's scope as routed,
and the coverage test builds requests from what a route requires alone.
@pgermosen pgermosen added chore iam AWS Identity and Access Management (IAM) labels Nov 21, 2026
@qodo-code-review

qodo-code-review Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Remove obsolete hand-routed IAM scope handling

✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Remove the unused hand-routed scope field and its generation, parsing, and filtering logic.
• Keep shared-route requirements while generating authorized-action data for every model scope.
• Align IAM route tests and fixtures with the simplified route format.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The changed parser and both generators determine which REST operations are converted into IAM actions.
  • The caller consumes the matched operation and model as one authorization decision, so the parser, generated route table, and action map are propagation hops of one bounded IAM authorization behavior rather than separate capabilities.
Sources

tools/aws/regen_iam_authorized_actions.py[489-490]

    """The credential scopes whose REST routes the vendored routes read: every model's."""
    return sorted({model["credentialScope"] for model in (routes.get("models") or {}).values()})
Behavioral complexity 🟡 Medium 🧩 Compatibility cases

  • Before: the route document, parser, and generators distinguished hand-routed scopes from scopes whose routes were read, and the coverage/action-generation consumers depended on that distinction.
  • After: every model is treated as routed and the handRouted field is removed from the generated contract.
  • New correctness condition: all producers and consumers must agree that every emitted model is intended for route-based IAM resolution; a stale resource or an independently maintained registry-only model must not be silently promoted into route matching.
  • This is a compatibility-contract transition, not complexity inherited from ordinary JSON parsing or map construction.
Sources

tools/aws/regen_iam_authorized_actions.py[489-490]

    """The credential scopes whose REST routes the vendored routes read: every model's."""
    return sorted({model["credentialScope"] for model in (routes.get("models") or {}).values()})
Potential damage 🔴 High 🩹 Confidentiality

  • An incorrectly permissive IAM action mapping can cause a request to be evaluated against a policy action different from the action AWS intended, potentially granting access to protected data or operations.
  • This is a security-enforcement failure within the affected IAM capability, not a claim about unrelated consumers.
  • Reverting the code or regenerating the resource can restore future decisions, but already accepted external requests are not automatically compensated or undone.
  • Code/resource rollback restores subsequent authorization decisions.
  • There is no evidence of automatic audit-driven revocation or compensation for requests accepted under an incorrect action; investigation and any required data or access remediation would be manual.
Assessed commit 6c42c43
Diagram

graph TD
  A["Botocore models"] --> B["Route generator"] --> C["REST routes JSON"]
  C --> D["IAM route parser"] --> F["IAM registry"] --> G["Coverage tests"]
  C --> E["Action generator"] --> F
Loading
High-Level Assessment

Removing the unused format field and its consumers together is the simplest approach. Retaining compatibility for an empty hand-routed list would preserve an exception that no current scope uses.

Files changed (9) +58 / -140

Refactor (4) +26 / -66
IamRestRoutes.javaLoad routes from every model +3/-9

Load routes from every model

• Removes validation of the handRouted field and the scope-skipping branch. A route file must still contain a nonempty models object.

src/main/java/io/floci/aws/services/iam/IamRestRoutes.java

rest-routes.jsonRemove the empty handRouted field +0/-2

Remove the empty handRouted field

• Drops the unused top-level field from the vendored route resource.

src/main/resources/aws/rest-routes.json

regen_iam_authorized_actions.pyTreat every model scope as routed +10/-17

Treat every model scope as routed

• Derives routed namespaces and route methods from all models without a hand-routed exclusion. Documentation is updated to match.

tools/aws/regen_iam_authorized_actions.py

regen_rest_routes.pyStop generating hand-routed route metadata +13/-38

Stop generating hand-routed route metadata

• Removes HAND_ROUTED, the handRouted output field, and required members used only for hand-routed coverage. Shared-route requires conditions remain.

tools/aws/regen_rest_routes.py

Tests (5) +32 / -74
IamActionRegistryTest.javaUse the simplified route fixture +1/-2

Use the simplified route fixture

• Removes the obsolete handRouted field from an IAM action-registry test fixture.

src/test/java/io/floci/aws/services/iam/IamActionRegistryTest.java

IamRestRouteCoverageTest.javaCover every model using shared-route requirements +5/-17

Cover every model using shared-route requirements

• Includes every model in route coverage and builds test requests from each route's requires conditions rather than the removed hand-routed required field.

src/test/java/io/floci/aws/services/iam/IamRestRouteCoverageTest.java

IamRestRoutesTest.javaRemove hand-routed fixtures and preserve denial-status coverage +18/-19

Remove hand-routed fixtures and preserve denial-status coverage

• Removes hand-routed assumptions from parser tests. The conflicting denial-status test now defines two models sharing a scope explicitly.

src/test/java/io/floci/aws/services/iam/IamRestRoutesTest.java

test_regen_iam_authorized_actions.pySimplify authorized-action generator fixtures +6/-8

Simplify authorized-action generator fixtures

• Removes hand-routed models and fields from fixtures and updates the routed-scope test to reflect all model scopes.

tools/aws/test_regen_iam_authorized_actions.py

test_regen_rest_routes.pyRemove obsolete hand-routed generator tests +2/-28

Remove obsolete hand-routed generator tests

• Drops tests for hand-routed rendering and required members. Retains shared-route ambiguity coverage and checks that generated output has no handRouted field.

tools/aws/test_regen_rest_routes.py

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@pgermosen
pgermosen merged commit 1cad7b2 into main Nov 21, 2026
29 checks passed
@pgermosen
pgermosen deleted the refactor/iam-drop-hand-routed branch November 21, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore iam AWS Identity and Access Management (IAM)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant