Skip to content

[BUG] API Gateway GetUsagePlans ignores the keyId filter #7653

Open

Description

@mariotoffia

Service

API Gateway (REST APIs, v1)

AWS API Action

GetUsagePlans with its keyId query parameter (aws apigateway get-usage-plans --key-id <id>)

Expected behavior

API Gateway answers GET /usageplans?keyId=<id> with only the usage plans the key is added to. Measured on AWS (eu-west-1, AWS CLI 2.39.3) with two plans and a key added to the first:

Request AWS answer
keyId=<key in the first plan> the first plan only
keyId=<key in both plans> both plans
keyId=<key in no plan> 200 {"item":[]}
keyId=<id of no key> 200 {"item":[]}, not a NotFoundException
keyId= or keyId=%20 every plan, as without the parameter
keyId=<the key id upper-cased> 200 {"item":[]}, the match is exact

Actual behavior

ApiGatewayController.getUsagePlans takes no keyId query parameter and answers every plan of the region, whatever the key. A key in no plan is reported as being in all of them.

A client that reads a key's plans before binding it then believes the key is already bound and skips CreateUsagePlanKey, so the key stays in no plan and every call with it on a method that requires a key answers 403. A client that moves a key between plans removes it from a plan it is not in and gets 404 NotFoundException Usage Plan Key not found from DeleteUsagePlanKey.

The docs state the gap: "Floci does not ... filter GetUsagePlans by keyId" (docs/services/api-gateway.md, "Usage plan stages, throttle and quota").

Reproduction

export AWS_ENDPOINT_URL=http://localhost:4566
A=$(aws apigateway create-usage-plan --name a --query id --output text)
B=$(aws apigateway create-usage-plan --name b --query id --output text)
K=$(aws apigateway create-api-key --name k --enabled --query id --output text)
aws apigateway get-usage-plans --key-id "$K" --query 'items[].name'
# AWS: []      Floci: ["a", "b"]
aws apigateway create-usage-plan-key --usage-plan-id "$A" --key-id "$K" --key-type API_KEY
aws apigateway get-usage-plans --key-id "$K" --query 'items[].name'
# AWS: ["a"]   Floci: ["a", "b"]

Environment

  • Floci version / image tag: mariotoffia/floci:latest built from main at f9d3e906f; the code path is unchanged on main at cf96dad
  • Java SDK version (if applicable): n/a
  • How you're running Floci (Docker / native / mvn quarkus:dev): Docker

Activity

  1. AndreKurait commented on Nov 6, 2026

    @AndreKurait
    Contributor

    Current main (cf96dadfd9) still ignores keyId; existing fix #7655 remains at d23e612ba4. Earlier validation today passed both SDK tests with production unchanged, and 20 AWS controls across two regions confirmed membership, removal and empty/whitespace behavior. All temporary resources were deleted and verified absent. No duplicate fix is needed; keep this issue open until #7655 lands. Pagination remains separate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions