Github ActionsのIDトークンでsubクレームの形式が変わってた
こんばんは、情報システム室の夏目です。
先日、個人開発でGihtub Actionsを使ってAWSにデプロイしようとしたらAssume Roleができないという事象が発生しました。
個人開発では色々とテンプレート化しているのもあって、何故できないんだと混乱しましたが、対処できたので共有します。
原因
Github Actionsで発行するIDトークンにおいて、subクレームの値の形式が変わったことが原因でした。
- 以前:
repo:octocat/my-repo:ref:refs/heads/main - 現在:
repo:octocat@123456/my-repo@456789:ref:refs/heads/main
アナウンスそのものは2026/04/23に行われていたので、見落としていました。
セキュリティ対策として、subクレームの値に変更可能な値だけではなく、所有者ID(123456)とリポジトリID(456789)を含めるようになりました。
名前を変更したり、削除を行ったオーガニゼーションにおいて、新しく作成した人がsubクレームを再現し不正アクセスできてしまう可能性があったので、変更したということです。
- All repositories created after July 15, 2026 will automatically use the new immutable subject claim format.
- Repository renames and transfers after July 15, 2026 will also adopt the new format.
- Existing repositories won’t be affected unless you explicitly opt in.
既存のリポジトリには影響がないのですが、2026/07/15以降に作成されたリポジトリでは有効化されています。
そのため以前作ったテンプレートのままではsubクレームの値が異なりAssume Roleできなかったということです。
IAM Roleの信頼ポリシーに記載しているsubクレームの条件を修正したらAssume Roleできました。
どうやってIDの値を調べるの?
gh (GithubのCLI)を使う場合
$ gh api repos/org-name/repo-name \
--jq '{
owner: .owner.login,
owner_id: .owner.id,
repository: .name,
repository_id: .id
}'
{
"owner": "org-name",
"owner_id": 111111111,
"repository": "repo-name",
"repository_id": 222222222
}
これで所有者ID(111111111)とリポジトリID(222222222)を取得することができました。
REST APIから取得する場合
$ curl -fsSL \
-H 'Accept: application/vnd.github+json' \
https://api.github.com/repos/org-name/repo-name |
jq '{
owner: .owner.login,
owner_id: .owner.id,
repository: .name,
repository_id: .id
}'
{
"owner": "org-name",
"owner_id": 111111111,
"repository": "repo-name",
"repository_id": 222222222
}
パブリックリポジトリであればPersonal Access Token (PAT)なしでも取得できます。
プライベートリポジトリではPATを着けてリクエストします。
$ curl -fsSL \
-H 'Accept: application/vnd.github+json' \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/org-name/repo-name |
jq '{
owner: .owner.login,
owner_id: .owner.id,
repository: .name,
repository_id: .id
}'
まとめ
以上、Github ActionsのIDトークンでsubクレームの値の形式が変わったという話でした。
何かの役に立てれば幸いです。




