r/webdev • • 26d ago

Question Infisical GitHub Actions OIDC authentication failing with 403 OIDC subject not allowed

hi, I'm having trouble getting Infisical OIDC authentication working in my GitHub Actions CI pipeline.
Every time my workflow reaches the Infisical secrets action, it fails with:

Run Infisical/secrets-action@v1.0.16

Error: Access denied: OIDC subject not allowed.

{

"statusCode": 403,

"message": "Access denied: OIDC subject not allowed.",

"error": "ForbiddenError"

}

Request failed with status code 403

here’s the GitHub Actions workflow:

name: ci
on:
push:
branches: [main]

permissions:
id-token: write
contents: read

jobs:
build-and-deploy:
runs-on: ubuntu-26.04

steps:
- name: Checkout repository
uses: actions/checkout@v7

- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 24
cache: npm

- name: Install dependencies
run: npm ci

- name: Fetch secrets from Infisical
uses: Infisical/secrets-action@v1.0.16
with:
method: oidc
identity-id: MY_IDENTITY_ID
project-slug: my-slug
env-slug: prod

- name: Run Jest tests
run: npm run test:ci

- name: Build Vinext app
run: npm run build:vinext

- name: Deploy to Cloudflare
run: npm run deploy:vinext -- --skip-build

Id appreciate any help

0 Upvotes

10 comments sorted by

2

u/heevee 26d ago

What does your Infisical identity configuration look like?

1

u/Low-Insurance-3678 26d ago

what do u want me to share exactly, i will be happy too

iv set the subject and audience and the urls

2

u/heevee 26d ago

Could you show me:

  • Discovery URL
  • Issuer
  • Subject
  • Audience

1

u/Low-Insurance-3678 25d ago

here you go, sorry for the late response wasn’t at home

issuer: https://token.actions.githubusercontent.com
subject: repo:Owner-name/repo-name:ref:refs/heads/main
audience: my github acc link

2

u/No-Molasses-2097 26d ago

That error is almost always the subject allowlist on the Infisical identity, not the workflow permissions. Your id-token permission looks right, so the token GitHub is minting probably does not match the subject pattern you saved. I would add a quick debug step to print the sub claim from the token and compare it character by character with what is in Infisical, especially the repo, ref and environment parts.

1

u/Low-Insurance-3678 24d ago

yep the subject was wrong
thank you man it is fixed now

2

u/conchobarus 25d ago

GitHub changed the format of its subject claims for newly created repos recently so that it contains immutable identifiers instead of just the organization and repo names, which could be spoofed if your GitHub organization were ever closed:
https://github.blog/changelog/2026-04-23-immutable-subject-claims-for-github-actions-oidc-tokens/

This caught me a little bit ago when the same trust provider config I had previously used for setting up OIDC with AWS mysteriously didn’t work on a new repo.

2

u/Low-Insurance-3678 25d ago edited 25d ago

that applies to accs created after july 15 2026
but mine is way old so I assume the subject: repo:org-name/repo-name:ref:refs/heads/main
should work fine

i had it wrong lmaoo it talks about repos created after that date not the account itself
my baad

2

u/Discordbothost 25d ago

easiest way to stop guessing is to look at the sub claim github is actually sending. add a throwaway step before the infisical one (it only prints the claims, not the token):

- run: |
    T=$(curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=YOUR_AUDIENCE" | jq -r .value)
    echo "$T" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/null | jq '{sub, aud, iss}'

then paste that exact sub into the identity's subject field. on newer repos it can look different from the classic repo:owner/name:ref:refs/heads/main that every tutorial shows, which is probably what the other comment about the format change is getting at. also make sure the audience you pass matches the one set on the identity, a mismatch there can show up as a 403 too

1

u/Low-Insurance-3678 24d ago

i was putting the wrong subject syntax
thank you so much