mirror of
https://github.com/Sea-Haven-Industries/meal-order-manager.git
synced 2026-10-07 16:18:54 +00:00
fix(iam): drop githubdeploy workflow_ref OIDC condition
AWS STS does not evaluate GitHub workflow_ref, so that trust condition fail-closes AssumeRoleWithWebIdentity.
This commit is contained in:
parent
f632020b20
commit
cc9b55208f
2 changed files with 6 additions and 29 deletions
|
|
@ -27,6 +27,8 @@ data "aws_iam_policy_document" "github_deploy_assume" {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# AWS STS GitHub condition keys include job_workflow_ref, not workflow_ref.
|
||||||
|
# A workflow_ref condition fail-closes AssumeRoleWithWebIdentity.
|
||||||
condition {
|
condition {
|
||||||
test = "StringLike"
|
test = "StringLike"
|
||||||
variable = "token.actions.githubusercontent.com:job_workflow_ref"
|
variable = "token.actions.githubusercontent.com:job_workflow_ref"
|
||||||
|
|
@ -34,15 +36,6 @@ data "aws_iam_policy_document" "github_deploy_assume" {
|
||||||
"Sea-Haven-Industries/.github/.github/workflows/cd-hcp-fargate.yaml@*",
|
"Sea-Haven-Industries/.github/.github/workflows/cd-hcp-fargate.yaml@*",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
condition {
|
|
||||||
test = "StringLike"
|
|
||||||
variable = "token.actions.githubusercontent.com:workflow_ref"
|
|
||||||
values = [
|
|
||||||
"Sea-Haven-Industries/meal-order-manager/.github/workflows/deploy-api.yaml@refs/heads/main",
|
|
||||||
"Sea-Haven-Industries/meal-order-manager/.github/workflows/deploy-api.yaml@refs/tags/v*",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
"""githubdeploy OIDC trust pins the org reusable and the thin caller."""
|
"""githubdeploy OIDC trust pins the org reusable with AWS-supported claims."""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
@ -11,25 +11,9 @@ def test_github_deploy_trust_uses_org_reusable_and_caller():
|
||||||
assert "repo:Sea-Haven-Industries/meal-order-manager:environment:dev" in text
|
assert "repo:Sea-Haven-Industries/meal-order-manager:environment:dev" in text
|
||||||
assert "repo:Sea-Haven-Industries/meal-order-manager:environment:prod" in text
|
assert "repo:Sea-Haven-Industries/meal-order-manager:environment:prod" in text
|
||||||
assert (
|
assert (
|
||||||
"Sea-Haven-Industries/.github/.github/workflows/cd-hcp-fargate.yaml@*" in text
|
"Sea-Haven-Industries/.github/.github/workflows/cd-hcp-fargate.yaml@*"
|
||||||
)
|
|
||||||
assert "token.actions.githubusercontent.com:workflow_ref" in text
|
|
||||||
assert (
|
|
||||||
"Sea-Haven-Industries/meal-order-manager/.github/workflows/deploy-api.yaml@refs/heads/main"
|
|
||||||
in text
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
"Sea-Haven-Industries/meal-order-manager/.github/workflows/deploy-api.yaml@refs/tags/v*"
|
|
||||||
in text
|
|
||||||
)
|
|
||||||
assert "cd-hcp-spa.yaml" not in text
|
|
||||||
assert "token.actions.githubusercontent.com:workflow_ref" in text
|
|
||||||
assert (
|
|
||||||
"Sea-Haven-Industries/meal-order-manager/.github/workflows/deploy-api.yaml@refs/heads/main"
|
|
||||||
in text
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
"Sea-Haven-Industries/meal-order-manager/.github/workflows/deploy-api.yaml@refs/tags/v*"
|
|
||||||
in text
|
in text
|
||||||
)
|
)
|
||||||
|
assert "token.actions.githubusercontent.com:job_workflow_ref" in text
|
||||||
|
assert "token.actions.githubusercontent.com:workflow_ref" not in text
|
||||||
assert "cd-hcp-spa.yaml" not in text
|
assert "cd-hcp-spa.yaml" not in text
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue