Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,6 @@
"organization": "kyle-sexton",
"issuerUrl": "https://token.actions.githubusercontent.com",
"personalAllowPolicies": [
{
"decision": "allow",
"tokenType": "personal",
"userLogin": "kyle-sexton",
"authorizedPermissions": [],
"rules": {
"aud": "urn:pulumi:org:kyle-sexton",
"sub": "repo:kyle-sexton@153232337/github-iac@1277607417:environment:github-iac-production",
"repository": "kyle-sexton/github-iac",
"repository_id": "1277607417",
"repository_owner_id": "153232337",
"repository_visibility": "private",
"ref": "refs/heads/main",
"ref_type": "branch",
"environment": "github-iac-production",
"event_name": "workflow_dispatch",
"workflow": "github-iac-production-deploy-v1",
"runner_environment": "github-hosted",
"actor_id": "153232337",
"run_attempt": "1"
}
},
{
"decision": "allow",
"tokenType": "personal",
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/pulumi-deploy-guard/guard.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

action_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
contract="$action_path/contracts/kyle-sexton-github-iac-v2.json"
contract="$action_path/contracts/kyle-sexton-github-iac.json"
temporary_directory="$(mktemp -d)"
trap 'rm -rf -- "$temporary_directory"' EXIT

Expand Down Expand Up @@ -71,7 +71,7 @@ run_guard() {
MOCK_POLICY="$policy" \
MOCK_STATE="$state" \
OPERATIONAL_RESOURCE_URNS_JSON="$requested_urns" \
POLICY_CONTRACT='kyle-sexton-github-iac-v2' \
POLICY_CONTRACT='kyle-sexton-github-iac' \
PULUMI_BIN="$mock_pulumi" \
STACK_NAME="${TEST_STACK_NAME:-kyle-sexton/project/production}" \
bash "$action_path/guard.sh" >"$stdout" 2>"$stderr"
Expand Down Expand Up @@ -137,7 +137,7 @@ mkdir -p "$invalid_action_path/contracts"
for operator in '*' '?' '.'; do
jq --arg operator "$operator" \
'.personalAllowPolicies[0].rules.workflow += $operator' \
"$contract" >"$invalid_action_path/contracts/kyle-sexton-github-iac-v2.json"
"$contract" >"$invalid_action_path/contracts/kyle-sexton-github-iac.json"
reset_valid_fixtures
TEST_ACTION_PATH="$invalid_action_path" \
expect_failure "bundled contract rejects Pulumi '$operator' matcher semantics"
Expand Down
13 changes: 4 additions & 9 deletions .github/scripts/pulumi-deploy-guard.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const contract = JSON.parse(
"actions",
"pulumi-deploy-guard",
"contracts",
"kyle-sexton-github-iac-v2.json",
"kyle-sexton-github-iac.json",
),
"utf8",
),
Expand Down Expand Up @@ -79,25 +79,21 @@ test("guard audits the complete personal allow set before exporting state", () =
assert.doesNotMatch(guard, /set -x/u);
});

test("bundled OIDC contract is exact, wildcard-free, and covers both IaC repositories", () => {
test("bundled OIDC contract is exact, wildcard-free, and covers the organization IaC repository", () => {
assert.equal(contract.schemaVersion, 2);
assert.equal(contract.organization, "kyle-sexton");
assert.equal(
contract.issuerUrl,
"https://token.actions.githubusercontent.com",
);
assert.equal(contract.personalAllowPolicies.length, 2);
assert.equal(contract.personalAllowPolicies.length, 1);
assert.deepEqual(
contract.personalAllowPolicies
.map((policy) => policy.rules.repository)
.sort(),
["kyle-sexton/github-iac", "melodic-software/github-iac"],
["melodic-software/github-iac"],
);
const identities = {
"kyle-sexton/github-iac": {
ownerId: "153232337",
repositoryId: "1277607417",
},
"melodic-software/github-iac": {
ownerId: "58273638",
repositoryId: "1277417810",
Expand Down Expand Up @@ -137,7 +133,6 @@ test("bundled OIDC contract is exact, wildcard-free, and covers both IaC reposit
]),
),
{
"kyle-sexton/github-iac": "1277607417",
"melodic-software/github-iac": "1277417810",
},
);
Expand Down
Loading