Repository navigation
ci(staging): no workspace-scoped Railway token in staging; guard against it #91
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
base: staging
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,9 +29,6 @@ jobs: | |
| BOS_STORAGE_ORIGIN: ${{ vars.BOS_STORAGE_ORIGIN || 'https://upload.everything.dev' }} | ||
| BOS_STORAGE_API_KEY: ${{ secrets.BOS_STAGING_STORAGE_API_KEY }} | ||
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_STAGING_TOKEN }} | ||
| RAILWAY_API_TOKEN: ${{ secrets.RAILWAY_STAGING_API_TOKEN }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| RAILWAY_PROJECT_ID: ${{ vars.RAILWAY_STAGING_PROJECT_ID }} | ||
| RAILWAY_ENVIRONMENT_ID: ${{ vars.RAILWAY_STAGING_ENVIRONMENT_ID }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 (Node 24) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,11 @@ export function checkWorkflows(directory: string): string[] { | |
| if (file === "staging.yml" && /secrets\.RAILWAY_TOKEN\b/.test(text)) { | ||
| problems.push(`${file}: reads secrets.RAILWAY_TOKEN, production's Railway token`); | ||
| } | ||
| if (file === "staging.yml" && /^\s*RAILWAY_API_TOKEN\s*:/m.test(text)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only catches the unquoted |
||
| problems.push( | ||
| `${file}: sets RAILWAY_API_TOKEN, a workspace-scoped Railway token that reaches every project in the workspace, production included`, | ||
| ); | ||
| } | ||
| for (const match of text.matchAll( | ||
| /^\s*uses:\s*([^\s#]+\/\.github\/workflows\/[^\s#@]+)@([^\s#]+)/gm, | ||
| )) { | ||
|
|
@@ -33,6 +38,6 @@ if (import.meta.url === `file://${resolve(process.argv[1] ?? "")}`) { | |
| for (const problem of problems) console.error(problem); | ||
| if (problems.length > 0) process.exit(1); | ||
| console.log( | ||
| "Workflows keep staging on its own token, pass no inherited secrets, and pin by SHA.", | ||
| "Workflows keep staging on its own project token, pass no inherited secrets, and pin by SHA.", | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to keep the workspace token out of staging. One side effect: without it the deploy leg can't repoint the service source, so staging falls back to a plain redeploy with the "service source was not repointed" notice (the run before c768e66 shows it). The source is still pinned to rc.29 from last night's run, so when the rc.30 bump lands, staging will publish rc.30 config but keep pulling the rc.29 image until someone repoints it in Railway. Could you note that in the PR, or add "repoint staging's source by hand" to the upgrade steps? cc @itexpert120 since he added these lines yesterday.