mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(iam): read Transcribe from the generated tables (#9388)
Move `transcribe` from NOT_COVERED to NAMESPACES in regen_iam_request_resources.py, so Transcribe requests are checked on the resources they name instead of `*`: a transcription job by its TranscriptionJobName and a vocabulary by its VocabularyName, each by name. The Service Reference lists no resource type for StartTranscriptionJob or CreateVocabulary, which stay on `*`. No other namespace's rows change.
This commit is contained in:
1 parent
ba6a81a0d5
commit
74430d7d40
7 files changed
+97
-7
No files matched your search
+16
@@ -3733,6 +3733,22 @@ class IamRequestResourceEnforcementIntegrationTest {
|
||||
refusedJson(send(configTagger, "sagemaker", "SageMaker.CreateEndpoint", "1.1", request), "sagemaker:AddTags");
|
||||
}
|
||||
|
||||
/**
|
||||
* A Transcribe transcription job is checked on the ARN its name gives, {@code transcription-job/<name>}, so a grant
|
||||
* on one lets the request reach Transcribe, which answers that the job does not exist, and refuses another.
|
||||
*/
|
||||
@Test
|
||||
void aTranscriptionJobIsCheckedOnTheArnItsNameGives() {
|
||||
String job = "res-job-" + suffix();
|
||||
User user = user("res-transcribe");
|
||||
user.policy(allowOn("transcribe:GetTranscriptionJob",
|
||||
"arn:aws:transcribe:" + REGION + ":" + ACCOUNT + ":transcription-job/" + job));
|
||||
send(user, "transcribe", "Transcribe.GetTranscriptionJob", "1.1", "{\"TranscriptionJobName\":\"" + job + "\"}")
|
||||
.statusCode(400).body(containsString("NotFoundException"));
|
||||
refusedJson(send(user, "transcribe", "Transcribe.GetTranscriptionJob", "1.1",
|
||||
"{\"TranscriptionJobName\":\"" + job + "-other\"}"), "transcribe:GetTranscriptionJob");
|
||||
}
|
||||
|
||||
private static ValidatableResponse glue(String operation, String body) {
|
||||
return adminJson("glue", "AWSGlue." + operation).body(body).post("/").then();
|
||||
}
|
||||
|
||||
@@ -2134,6 +2134,24 @@ class ResourceArnBuilderTest {
|
||||
builder.buildResources("sagemaker", "sagemaker:CreateEndpoint", ctx, "us-east-1", ACCOUNT, "aws"));
|
||||
}
|
||||
|
||||
// ── Transcribe ──────────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* A Transcribe request is checked on the transcription job or vocabulary its name names, as {@code <type>/<name>};
|
||||
* the Service Reference lists no resource type for starting a job or creating a vocabulary, so those are checked on
|
||||
* {@code *}.
|
||||
*/
|
||||
@Test
|
||||
void transcribeChecksTheJobOrVocabularyItsNameNames() {
|
||||
setJsonBody("{\"TranscriptionJobName\":\"call-1\"}");
|
||||
assertEquals(List.of("arn:aws:transcribe:us-east-1:000000000000:transcription-job/call-1"),
|
||||
builder.buildResources("transcribe", "transcribe:GetTranscriptionJob", ctx, "us-east-1", ACCOUNT,
|
||||
"aws"));
|
||||
setJsonBody("{\"TranscriptionJobName\":\"call-2\",\"Media\":{\"MediaFileUri\":\"s3://b/k.mp4\"}}");
|
||||
assertEquals(List.of("*"), builder.buildResources("transcribe", "transcribe:StartTranscriptionJob", ctx,
|
||||
"us-east-1", ACCOUNT, "aws"));
|
||||
}
|
||||
|
||||
// ── S3 and S3 Control ───────────────────────────────────────────────────────
|
||||
|
||||
/** The resources an S3 or S3 Control request names, read from the generated table on the route it matches. */
|
||||
|
||||
Reference in new issue
Block a user