Repository navigation
fix(servicequotas): file a quota increase under the account that requested it (#624) - #632
Merged
Merged
Conversation
…ested it (#624) HandleRequest discarded its *RequestContext and the three quota-increase operations hardcoded the literal 000000000000, so two accounts sharing one emulator shared one pile of requests. A consumer reading ListRequestedServiceQuotaChangesByService to decide whether it had already asked for a raise would find another account's request and skip filing its own, and GetRequestedServiceQuotaChange would hand over a request by ID to any caller. The four read-only operations still take no account: the quota table is per-service and identical for every caller, so threading one through them would imply a per-account value substrate does not model and nothing can set. An unattributed request still lands under 000000000000, because that is what substrate's parser answers for a request with no Authorization header. The placeholder is the fallback rather than the default, so a fixture that files an increase without signing keeps working. The shared signing helper the test needs is hoisted out of the #623 test file into signed_request_test.go, since the reason both defects survived a green suite is the same one: nothing in the repository could be a second account. Closes #624
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ServiceQuotasPlugin.HandleRequestdiscarded its*RequestContext(_ *RequestContext) and the three quota-increase operations each hardcoded the literal000000000000. So two accounts sharing one emulator shared one pile of requests:ListRequestedServiceQuotaChangesByServiceto decide whether it had already asked for a raise finds another account's request and skips filing its ownGetRequestedServiceQuotaChangehands over a request by ID to any caller — and an ID is guessableincreaseKey(accountID, id)already keyed by account. It was just always handed the same one.How
HandleRequesttakes a namedreqCtxand passessqAccountID(reqCtx)to the three increase handlers.The four read-only operations still take no account, deliberately. The quota table is per-service and identical for every caller, so threading an account into
ListServices/ListServiceQuotas/GetServiceQuota/GetAWSDefaultServiceQuotawould imply a per-account value substrate does not model and nothing can set.An unattributed request still lands under
000000000000. That is not a leftover: it is whatparser.extractAccountanswers for a request with noAuthorizationheader, so the placeholder is the fallback rather than the default. Existing fixtures that file an increase without signing keep working, and a plugin driven directly by a unit test lands where it always did rather than under"".Why the existing tests could not see this
They are all one caller. Nothing in the repository could authenticate as a second account until #623 added
StartTestServerWithAccounts, so "everyone's requests" and "my requests" were the same set and no assertion could tell them apart. The signing helper is hoisted out of the #623 test file intosigned_request_test.gofor that reason — both defects have the same root cause, a service answering as if there were only ever one account, and both need the same seam to catch.One detail worth naming: the test signs as
servicequotasv20190624, notservicequotas. That versioned form is what aws-sdk-go-v2 puts in the credential scope, andparser.gocarries an alias for exactly it. Signing as the plugin name would test a request no SDK sends — the same class of gap #610 was.Verification
make test(race detector) — green;golangci-lint run ./...— 0 issues;gofmt/go vetclean.sqAccountIDforced to always return the placeholder →TestServiceQuotas_IncreasesAreFiledUnderTheCallerfails.Compatibility
Quota increase requests are now filed under the caller's account instead of
000000000000. A fixture that signs its requests and then asserts on state under the placeholder will need updating; one that does not sign is unaffected.Closes #624