-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ci): harden ingestion-autopilot workflow to avoid service-role key exposure #1572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
BigSimmo
merged 8 commits into
main
from
codex/fix-manual-workflow-service-role-key-exposure
Aug 4, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d0ad4e1
fix(ci): harden ingestion autopilot secrets
BigSimmo 3503806
merge(main): sync ingestion autopilot secret hardening with current main
cursoragent 6cc0b6f
fix(ci): register autopilot workflow secret contract
cursoragent ace81d8
docs: record PR #1572 ingestion-autopilot secret review
cursoragent b90b232
Merge remote-tracking branch 'origin/main' into codex/repair-pr1572-2…
BigSimmo fcefa76
fix(ci): trust default-branch ingestion dispatch
BigSimmo 23d0e79
Merge remote-tracking branch 'origin/main' into codex/repair-pr1572-2…
BigSimmo f3b99dc
test(ci): lock ingestion secret step boundaries
BigSimmo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { readFileSync } from "node:fs"; | ||
| import { join } from "node:path"; | ||
|
|
||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| const workflow = readFileSync(join(process.cwd(), ".github", "workflows", "ingestion-autopilot.yml"), "utf8").replace( | ||
| /\r\n/g, | ||
| "\n", | ||
| ); | ||
|
|
||
| describe("ingestion autopilot workflow secret handling", () => { | ||
| it("does not expose the Supabase service-role key to checkout or install steps", () => { | ||
| // Workflow-level and job-level env both use fewer than 10 spaces; only | ||
| // step-scoped env under Preflight / Run autopilot should inject the secret. | ||
| expect(workflow).not.toMatch(/^(?: {0,6})env:\n(?: {2,8}[^\n]+\n)* {2,8}SUPABASE_SERVICE_ROLE_KEY:/m); | ||
|
|
||
| expect(workflow).not.toMatch(/^ workflow_dispatch:/m); | ||
| expect(workflow).toContain("repository_dispatch:"); | ||
| expect(workflow).toContain("types: [ingestion-autopilot]"); | ||
| expect(workflow).toContain("APPLY_REQUESTED: ${{ github.event.client_payload.apply || 'false' }}"); | ||
|
|
||
| const secretLines = workflow.split("\n").filter((line) => line.includes("SUPABASE_SERVICE_ROLE_KEY:")); | ||
| expect(secretLines).toEqual([ | ||
| " SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}", | ||
| " SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}", | ||
| ]); | ||
|
|
||
| const installIndex = workflow.indexOf(" - name: Install dependencies"); | ||
| const checkoutIndex = workflow.indexOf(" - name: Checkout"); | ||
| const preflightIndex = workflow.indexOf(" - name: Preflight required secrets"); | ||
| const setupIndex = workflow.indexOf(" - name: Setup Node.js"); | ||
| const autopilotIndex = workflow.indexOf(" - name: Run autopilot"); | ||
| expect(checkoutIndex).toBeGreaterThan(-1); | ||
| expect(preflightIndex).toBeGreaterThan(checkoutIndex); | ||
| expect(setupIndex).toBeGreaterThan(preflightIndex); | ||
| expect(installIndex).toBeGreaterThan(-1); | ||
| expect(autopilotIndex).toBeGreaterThan(installIndex); | ||
|
|
||
| const checkoutBlock = workflow.slice(checkoutIndex, preflightIndex); | ||
| const preflightBlock = workflow.slice(preflightIndex, setupIndex); | ||
| expect(checkoutBlock).not.toContain("SUPABASE_SERVICE_ROLE_KEY"); | ||
| expect(preflightBlock).toContain("SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}"); | ||
|
|
||
| const installBlock = workflow.slice(installIndex, autopilotIndex); | ||
| expect(installBlock).not.toContain("SUPABASE_SERVICE_ROLE_KEY"); | ||
|
|
||
| const autopilotBlock = workflow.slice(autopilotIndex); | ||
| expect(autopilotBlock).toContain("SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}"); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.