-
Notifications
You must be signed in to change notification settings - Fork 99
GITHUB SECRETS MIGRATION: migrate writer/writer-framework to Infisical #1290
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: dev
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 |
|---|---|---|
|
|
@@ -13,8 +13,13 @@ on: | |
| type: string | ||
| default: "{}" | ||
| secrets: | ||
| AGENT_MANAGER_PAT: | ||
| description: 'Personal Access Token for triggering agent manager repo' | ||
| INFISICAL_ORG_IDENTITY_UUID: | ||
| required: true | ||
| INFISICAL_ORG_PROJECT_SLUG: | ||
| required: true | ||
| INFISICAL_REPO_IDENTITY_UUID: | ||
| required: true | ||
| INFISICAL_REPO_PROJECT_SLUG: | ||
| required: true | ||
|
|
||
| permissions: | ||
|
|
@@ -23,15 +28,31 @@ permissions: | |
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Fetch secrets from Infisical | ||
| uses: WriterInternal/devops-github-actions/infisical-secrets@cf0625c0cb6646c057b9bc81c49c8554b2313e27 # v2.3.0 | ||
| with: | ||
| org-identity-id: ${{ secrets.INFISICAL_ORG_IDENTITY_UUID }} | ||
| org-project-slug: ${{ secrets.INFISICAL_ORG_PROJECT_SLUG }} | ||
| repo-identity-id: ${{ secrets.INFISICAL_REPO_IDENTITY_UUID }} | ||
| repo-project-slug: ${{ secrets.INFISICAL_REPO_PROJECT_SLUG }} | ||
| env-slug: prod | ||
| required-keys: AGENT_MANAGER_PAT | ||
|
|
||
| - name: Trigger agent manager | ||
| env: | ||
| EVENT_TYPE: ${{ inputs.event_type }} | ||
| EXTRA_PAYLOAD: ${{ inputs.extra_payload }} | ||
| run: | | ||
| repo_owner="WriterInternal" | ||
| repo_name="be.agent-manager" | ||
| event_type="${{ inputs.event_type }}" | ||
| event_type="$EVENT_TYPE" | ||
| commit_sha="${{ github.sha }}" | ||
| extra_payload='${{ inputs.extra_payload }}' | ||
| extra_payload="$EXTRA_PAYLOAD" | ||
|
|
||
| echo "Triggering agent manager with event_type=$event_type" | ||
| echo "Extra payload (raw): $extra_payload" | ||
|
|
@@ -48,7 +69,7 @@ jobs: | |
| curl -L \ | ||
| -X POST \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "Authorization: Bearer ${{ secrets.AGENT_MANAGER_PAT }}" \ | ||
| -H "Authorization: Bearer $AGENT_MANAGER_PAT" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| https://api.github.com/repos/$repo_owner/$repo_name/dispatches \ | ||
| -d "{\"event_type\": \"$event_type\", \"client_payload\": $merged_payload}" | ||
|
Comment on lines
69
to
75
Contributor
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. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Fail the job when the dispatch API rejects the migrated PAT. If Infisical returns a missing/mis-scoped Suggested hardening+ : "${AGENT_MANAGER_PAT:?AGENT_MANAGER_PAT was not populated by Infisical}"
+
- curl -L \
+ curl --fail --show-error --silent -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $AGENT_MANAGER_PAT" \#!/bin/bash
# Verify the dispatch curl invocation has explicit HTTP failure handling.
fd -i 'trigger-workflow.yml' .github/workflows --exec awk 'NR>=69 && NR<=75 {print NR ":" $0}' {}🤖 Prompt for AI Agents |
||
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Fetch publish secrets closer to their consumers.
This step exports both
LAUNCHDARKLY_ACCESS_TOKENandPYPI_TOKENbefore dependency install/build commands run, broadening token exposure beyond the upload/publish steps. Prefer fetching each token immediately before the step that needs it, or use step-scoped outputs/env if the composite action supports that.🤖 Prompt for AI Agents