-
Notifications
You must be signed in to change notification settings - Fork 7
Harden dependency supply chain security #463
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
2be41b2
44ae1f4
97bd777
f27f775
4d514b9
e25359d
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,44 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Security Audit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 'Gemfile' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 'Gemfile.lock' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| schedule: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - cron: '0 9 * * *' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ruby-audit: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Ruby Security Audit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| issues: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BUNDLE_FROZEN: "true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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. Suggestion: The pinned SHA
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ruby-version: "3.4" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bundler-cache: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Update advisory database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: bundle exec bundler-audit update | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run bundler-audit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: bundle exec bundler-audit check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+22
to
+30
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Create issue on failure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: failure() && github.event_name != 'pull_request' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EXISTING=$(gh issue list --label "security-audit" --state open --json number --jq 'length') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$EXISTING" -gt 0 ]; then exit 0; fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TITLE_DATE=$(date +%Y-%m-%d) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh label create "security-audit" --description "Automated security audit findings" --color "D93F0B" 2>/dev/null || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh label create "priority:high" --description "High priority" --color "B60205" 2>/dev/null || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh issue create \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --title "Security: Ruby dependency vulnerabilities detected (${TITLE_DATE})" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --label "security-audit,priority:high" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --body "The daily security audit has detected vulnerabilities. See [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+44
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. Suggestion: The label
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -12,7 +12,7 @@ jobs: | |||
| runs-on: ubuntu-latest | ||||
| timeout-minutes: 5 | ||||
| steps: | ||||
| - uses: actions/checkout@v6 | ||||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||||
| - name: SwiftFormat Lint | ||||
| uses: docker://ghcr.io/nicklockwood/swiftformat:latest | ||||
| with: | ||||
|
|
@@ -30,7 +30,7 @@ jobs: | |||
| timeout-minutes: 15 | ||||
| steps: | ||||
| - name: Checkout | ||||
| uses: actions/checkout@v6 | ||||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||||
| - name: Write Smile Config | ||||
| id: write_smile_config | ||||
| # Mask the config so that it doesn't show up in the logs | ||||
|
|
@@ -59,15 +59,15 @@ jobs: | |||
| echo "Current developer directory: $(xcode-select -p)" | ||||
| ls -1 /Applications | grep Xcode || true | ||||
| - name: Cache SwiftPM | ||||
| uses: actions/cache@v5 | ||||
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 | ||||
|
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. Suggestion: The SHA
Suggested change
|
||||
| with: | ||||
| path: | | ||||
| ~/.swiftpm | ||||
| ~/Library/Caches/org.swift.swiftpm | ||||
| key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | ||||
| restore-keys: ${{ runner.os }}-spm- | ||||
| - name: Cache CocoaPods (validator downloads) | ||||
| uses: actions/cache@v5 | ||||
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 | ||||
| with: | ||||
| path: | | ||||
| ~/Library/Caches/CocoaPods | ||||
|
|
||||
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.
This job grants
issues: writeeven when running onpull_requestevents. Sincepull_requestworkflows execute code from the PR branch, it’s safer to keep PR permissions read-only and only grantissues: writefor the scheduled/dispatch run that may create issues (e.g., split into two jobs with differentpermissions+if:conditions).