mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(iam): word the account property key refusal as AWS does (#9161)
A key that satisfies the published shape and is not Namespace/PropertyName answers 'Property key must be in format Namespace/PropertyName: <key>', recorded for a key carrying no separator, with the key as the request sent it. This package described the rule in a sentence of its own instead. The rule itself is unchanged, and the layer AWS applies after it is left out on purpose rather than guessed: an unrecognised namespace is refused there, and building that check needs the set of namespaces AWS recognises, which the recordings do not give. The IAM page says so.
This commit is contained in:
1 parent
1cad7b2b62
commit
6fe1da3219
3 files changed
+33
-5
No files matched your search
@@ -3483,10 +3483,12 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
|
||||
private String accountPropertyNamespace(String key) {
|
||||
int separator = key == null ? -1 : key.indexOf('/');
|
||||
if (separator <= 0 || separator != key.lastIndexOf('/') || separator == key.length() - 1) {
|
||||
// AWS's own fixed text for this refusal, carrying the key exactly as the request
|
||||
// sent it, so nothing here may reword it or trim the key. Which spellings reach it is
|
||||
// this package's reading: no slash, several, and a trailing one share the sentence.
|
||||
// The IAM page carries the recording behind it and what it does and does not cover.
|
||||
throw new AwsException("InvalidInput",
|
||||
"The property key '" + key + "' is not Namespace/PropertyName: a key has "
|
||||
+ "exactly one forward slash, and neither a leading nor a trailing "
|
||||
+ "one.", 400);
|
||||
"Property key must be in format Namespace/PropertyName: " + key, 400);
|
||||
}
|
||||
return key.substring(0, separator);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user