Skip to content

fix(pricing,authz): classify pricing's error protocol, and assert over the registry (#653) - #667

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/653-pricing-denial-code
Aug 20, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/653-pricing-denial-code

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Closes #653.

The gap

AuthController.CheckAccess derives its denial code from the service's wire protocol (#595) by reading serviceErrorProtocols. It calls accessDeniedCodeFor(req.Service, "") with no Content-Type, so a service absent from that map cannot be rescued by errorProtocolFor's Content-Type sniff either — it takes the final errProtoQueryXML default and is refused with the bare XML AccessDenied.

pricing was absent. Its plugin already reports AccessDeniedException for the refusals it raises itself (pricing_plugin.go:46), so substrate emitted two codes for one outcome on one service — the drift TestAccessDenied_IAMPluginAgreesWithTheGenericGate exists to prevent, one level down.

Why no test saw it

TestAccessDeniedCode_MatchesTheServiceErrorProtocol asserts the protocol→code property over every registered service — by iterating serviceErrorProtocols itself. A service missing from the map has no entry to iterate, so it is invisible to the test that exists to cover it. config sat in exactly that blind spot until #580; pricing was next.

The new TestAccessDenied_EveryRegisteredPluginHasAnErrorProtocol drives the assertion from the plugin registry: it builds a real registry via RegisterDefaultPlugins and asserts every registry.Names() entry has a mapping. A plugin that lands without one now fails with a message naming it and saying what to add.

Provenance

pricing is classified from its botocore model: "protocol": "json", jsonVersion 1.1, targetPrefix AWSPriceListService. Its own AccessDeniedException shape ("exception": true, "General authentication failure.") corroborates the suffixed spelling — but note it is declared on GetPriceListFileUrl and ListPriceLists and not on GetProducts, the operation the issue reports. So for GetProducts neither spelling is modeled and the protocol rule from #595 alone decides it; the shape confirms rather than supplies it.

Verification

Both new tests and the new table row were confirmed to fail with the map entry removed:

--- FAIL: TestAccessDenied_PricingPluginAgreesWithTheGenericGate
--- FAIL: TestAccessDeniedCodeFor_TracksTheWireProtocol/pricing_is_json_rpc
        expected: "AccessDeniedException"  actual: "AccessDenied"
--- FAIL: TestAccessDenied_EveryRegisteredPluginHasAnErrorProtocol
        plugin "pricing" has no serviceErrorProtocols entry, so its authorization
        denials fall back to the XML AccessDenied regardless of the protocol it
        actually speaks; add "pricing" to serviceErrorProtocols ...

gofmt, go build, go vet, golangci-lint run (0 issues), make test (race) all green.

Compatibility

A pricing authorization denial changes code from AccessDenied to AccessDeniedException. A fixture matching the old string must be updated — it was never a code the Price List SDK could parse.

…r the registry (#653)

AuthController.CheckAccess derives a denial code from the service's wire
protocol and calls accessDeniedCodeFor(service, "") with no Content-Type, so a
service absent from serviceErrorProtocols cannot be rescued by the Content-Type
sniff and takes errorProtocolFor's final errProtoQueryXML default. pricing was
absent, so the generic gate refused a caller with the bare XML AccessDenied
while the plugin's own gate reported AccessDeniedException — two codes for one
outcome on one service, which is #595's complaint restated.

pricing is classified as JSON RPC, per its model's "protocol": "json",
jsonVersion 1.1 and targetPrefix AWSPriceListService. Its own
AccessDeniedException shape corroborates the spelling; it is declared on
GetPriceListFileUrl and ListPriceLists but not on GetProducts, the operation the
report names, so for GetProducts the protocol rule alone decides it.

The property test guarding the mapping iterated serviceErrorProtocols itself, so
a service missing from the map had no entry to iterate and was invisible — the
same blind spot config sat in until #580. The new assertion is driven from the
plugin registry instead: every plugin RegisterDefaultPlugins registers must have
an entry, and one that lands without it fails with a message naming it.

Closes #653
@scttfrdmn
scttfrdmn merged commit 3aa1048 into main Aug 20, 2026
12 checks passed
@scttfrdmn
scttfrdmn deleted the fix/653-pricing-denial-code branch August 20, 2026 07:11
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

Authorization denials on pricing report the XML AccessDenied, and no test can see an unmapped plugin

1 participant