Skip to content

feat(embed): pin OIDC job_workflow_ref + scope discovery to user - #39

Merged
baladithyab merged 1 commit into
mainfrom
feat/embed-hardening-jwfr-and-discovery-scope
May 28, 2026
Merged

baladithyab merged 1 commit into
mainfrom
feat/embed-hardening-jwfr-and-discovery-scope

Conversation

@baladithyab

Copy link
Copy Markdown
Owner

Two follow-up hardening changes from yesterday's TODO list.

1. Pin OIDC job_workflow_ref in the Worker

authorizeForEmbedUpload now requires the OIDC token's job_workflow_ref claim to start with baladithyab/web-embed-workflows/.github/workflows/static-passthrough.yml@. Closes the last open path: previously any caller workflow under our owner with id-token: write could upload, even one we'd never reviewed. Now ONLY our audited reusable workflow can.

2. Scope discovery to +user:baladithyab

GH search query now scopes to our user. Defense-in-depth: validate() also rejects manifests whose source owner doesn't match. Strangers adding the codeseys-embed topic stop leaking into /projects.

Tests

184 / 184 (was 178; +6 OIDC pin tests covering missing claim, wrong workflow file, wrong repo, ref-as-SHA, ref-as-tag, prefix-substring forgery).

🤖 Generated with the help of Claude

Two hardening changes that close the last open trust boundaries on
the project-embed pipeline:

1. **OIDC job_workflow_ref pin** (src/lib/github-oidc.ts):
   authorizeForEmbedUpload now requires job_workflow_ref to start with
   'baladithyab/web-embed-workflows/.github/workflows/static-passthrough.yml@'.
   Previously, any caller workflow under repository_owner === 'baladithyab'
   with id-token: write could mint a valid OIDC token and upload to any
   slug. Now ONLY our reviewed reusable workflow can — even if some
   unrelated workflow in one of our repos later sets id-token: write.
   Six new tests cover: missing claim, wrong workflow file, wrong repo,
   ref-as-SHA, ref-as-tag, prefix-substring forgery.

2. **Discovery scope to ALLOWED_OWNER** (src/scripts/sync-project-manifests.ts):
   GitHub search query is now 'topic:codeseys-embed user:baladithyab'.
   Strangers adding the topic no longer leak into /projects.
   Defense-in-depth: validate() now also rejects manifests whose source
   owner doesn't match.

184 / 184 tests passing (was 178; +6 OIDC pin tests). Astro check clean.
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed

URL: https://1a780c79-codeseys-personal-website.codeseys.workers.dev
Commit: d0f8948f3efd1636efdfa6324970603afa10f98a
Worker version: uploaded but not promoted (production at codeseys.io is unchanged)

Updated on every push to this PR.

@baladithyab
baladithyab merged commit 100f773 into main May 28, 2026
3 checks passed
@baladithyab
baladithyab deleted the feat/embed-hardening-jwfr-and-discovery-scope branch May 28, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant