-
Notifications
You must be signed in to change notification settings - Fork 0
Create main.yml #1
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
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 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,36 @@ | ||||||||||||||||
| on: push | ||||||||||||||||
|
|
||||||||||||||||
| jobs: | ||||||||||||||||
| secret-generator: | ||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
| outputs: | ||||||||||||||||
| handle: ${{ steps.generate-secret.outputs.handle }} | ||||||||||||||||
| steps: | ||||||||||||||||
| - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||||||||||||||||
| with: | ||||||||||||||||
| credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }} | ||||||||||||||||
| instance: ${{ secrets.SECRET_STORE_INSTANCE }} | ||||||||||||||||
| - name: generate secret | ||||||||||||||||
| id: generate-secret | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: | | ||||||||||||||||
| GENERATED_SECRET=$((RANDOM)) | ||||||||||||||||
| echo "::add-mask::$GENERATED_SECRET" | ||||||||||||||||
| SECRET_HANDLE=$(secret-store store-secret "$GENERATED_SECRET") | ||||||||||||||||
| echo "handle=$SECRET_HANDLE" >> "$GITHUB_OUTPUT" | ||||||||||||||||
| secret-consumer: | ||||||||||||||||
| runs-on: macos-latest | ||||||||||||||||
| needs: secret-generator | ||||||||||||||||
| steps: | ||||||||||||||||
| - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||||||||||||||||
| with: | ||||||||||||||||
| credentials: ${{ secrets.SECRET_STORE_CREDENTIALS }} | ||||||||||||||||
| instance: ${{ secrets.SECRET_STORE_INSTANCE }} | ||||||||||||||||
| - name: use secret | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: | | ||||||||||||||||
| SECRET_HANDLE="${{ needs.secret-generator.outputs.handle }}" | ||||||||||||||||
| RETRIEVED_SECRET=$(secret-store retrieve-secret "$SECRET_HANDLE") | ||||||||||||||||
| echo "::add-mask::$RETRIEVED_SECRET" | ||||||||||||||||
| echo "We retrieved our masked secret: $RETRIEVED_SECRET" | ||||||||||||||||
|
Comment on lines
+32
to
+35
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. 🚨 suggestion (security): Avoid echoing secrets even when masked in logs Even with masking, it’s safer not to print secrets at all, as masking can fail in edge cases (e.g., partial matches, formatting). If this is only for debugging, consider removing the echo or guarding it behind a debug flag.
Suggested change
|
||||||||||||||||
| concurrency: | ||||||||||||||||
|
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. issue (bug_risk): Fix the empty
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: trueIf not using concurrency, remove the |
||||||||||||||||
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.
🚨 suggestion (security): Use a stronger source of randomness for generated secrets
$RANDOMhas only 0–32767 possible values and is not cryptographically secure. If this is used as a secret/token, please switch to a higher‑entropy, crypto‑secure source (e.g.,head -c 32 /dev/urandom | base64oropenssl rand -hex 32) to avoid predictability.