Skip to content

Commit e567746

Browse files
committed
feat: split security scanning into dedicated compose-security workflow
Move GitGuardian scanning out of compose-lint.yml into a new compose-security.yml reusable workflow alongside Trivy IaC scanning. Update lint-summary.sh to remove the scanning result parameter.
1 parent f3fe88f commit e567746

File tree

3 files changed

+250
-147
lines changed

3 files changed

+250
-147
lines changed

.github/workflows/compose-lint.yml

Lines changed: 4 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -24,111 +24,13 @@ on:
2424
required: false
2525
type: string
2626
default: 'main'
27-
github-event-before:
28-
description: "GitHub event before SHA (github.event.before)"
29-
required: false
30-
type: string
31-
default: ''
32-
github-event-base:
33-
description: "GitHub event base SHA (github.event.base)"
34-
required: false
35-
type: string
36-
default: ''
37-
github-pull-base-sha:
38-
description: "GitHub pull request base SHA (github.event.pull_request.base.sha)"
39-
required: false
40-
type: string
41-
default: ''
42-
github-default-branch:
43-
description: "GitHub repository default branch (github.event.repository.default_branch)"
44-
required: false
45-
type: string
46-
default: 'main'
47-
event-name:
48-
description: "GitHub event name (github.event_name)"
49-
required: false
50-
type: string
51-
default: 'push'
5227
discord-user-id:
5328
description: "Discord user ID to mention in failure notifications (e.g., '<@123456789>')"
5429
required: false
5530
type: string
5631
default: ''
5732

5833
jobs:
59-
scanning:
60-
name: GitGuardian scan
61-
runs-on: ubuntu-24.04
62-
timeout-minutes: 10
63-
if: ${{ inputs.event-name == 'push' }}
64-
steps:
65-
- name: Checkout target repository
66-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
67-
with:
68-
repository: ${{ inputs.target-repository }}
69-
ref: ${{ inputs.target-ref }}
70-
fetch-depth: 0 # fetch all history so multiple commits can be scanned
71-
72-
- name: Display version information
73-
run: |
74-
echo "📋 Workflow Version Information"
75-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
76-
echo "Target repository: ${{ inputs.target-repository }}"
77-
echo "Target ref: ${{ inputs.target-ref }}"
78-
echo "Runner: ${{ runner.os }} ${{ runner.arch }}"
79-
echo ""
80-
echo "ℹ️ Reusable workflow SHA shown in 'Uses:' line above"
81-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
82-
83-
- name: Configure 1Password Service Account
84-
uses: 1password/load-secrets-action/configure@92467eb28f72e8255933372f1e0707c567ce2259 # v4.0.0
85-
with:
86-
service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
87-
88-
- name: Load GitGuardian credentials
89-
id: op-load-secret
90-
uses: 1password/load-secrets-action@92467eb28f72e8255933372f1e0707c567ce2259 # v4.0.0
91-
with:
92-
unset-previous: true
93-
env:
94-
GITGUARDIAN_API_KEY: "op://Docker/gitguardian/api_key"
95-
96-
- name: GitGuardian scan
97-
run: |
98-
echo ""
99-
echo "🔒 Starting GitGuardian security scanning..."
100-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
101-
echo ""
102-
103-
- name: Run GitGuardian scan
104-
uses: GitGuardian/ggshield-action@ea5c945e66dc6436d976d4c70519c4ff7cadf9ba # v1.49.0
105-
env:
106-
GITHUB_PUSH_BEFORE_SHA: ${{ inputs.github-event-before }}
107-
GITHUB_PUSH_BASE_SHA: ${{ inputs.github-event-base }}
108-
GITHUB_PULL_BASE_SHA: ${{ inputs.github-pull-base-sha }}
109-
GITHUB_DEFAULT_BRANCH: ${{ inputs.github-default-branch }}
110-
GITGUARDIAN_API_KEY: ${{ steps.op-load-secret.outputs.GITGUARDIAN_API_KEY }}
111-
112-
- name: GitGuardian scan complete
113-
if: always()
114-
run: |
115-
echo ""
116-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
117-
if [[ "${{ job.status }}" == "success" ]]; then
118-
echo "🎉 GITGUARDIAN SECURITY SCAN: PASSED"
119-
echo " No secrets or security policy violations detected"
120-
else
121-
echo "💥 GITGUARDIAN SECURITY SCAN: FAILED"
122-
echo " Security issues detected - review output above for details"
123-
echo " Common issues: hardcoded secrets, API keys, passwords in code"
124-
fi
125-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
126-
127-
- name: Unload GitGuardian credentials
128-
uses: 1password/load-secrets-action@92467eb28f72e8255933372f1e0707c567ce2259 # v4.0.0
129-
with:
130-
unset-previous: true
131-
13234
actionlint:
13335
name: Workflow validation
13436
runs-on: ubuntu-24.04
@@ -212,7 +114,7 @@ jobs:
212114
lint-summary:
213115
name: Lint Summary
214116
runs-on: ubuntu-24.04
215-
needs: [scanning, actionlint, lint]
117+
needs: [actionlint, lint]
216118
if: always()
217119
timeout-minutes: 5
218120
steps:
@@ -234,14 +136,13 @@ jobs:
234136
./.compose-workflow/scripts/linting/lint-summary.sh \
235137
--stacks '${{ inputs.stacks }}' \
236138
--yamllint-config .yamllint \
237-
--scanning-result "${{ needs.scanning.result }}" \
238139
--actionlint-result "${{ needs.actionlint.result }}" \
239140
--lint-result "${{ needs.lint.result }}"
240141
241142
notify:
242143
name: Discord Notification
243144
runs-on: ubuntu-24.04
244-
needs: [scanning, actionlint, lint]
145+
needs: [actionlint, lint]
245146
if: always()
246147
steps:
247148
- name: Configure 1Password Service Account
@@ -261,13 +162,10 @@ jobs:
261162
- name: Determine overall lint status
262163
id: lint-status
263164
run: |
264-
# Derive overall status from individual job results
265-
# Success requires: scanning passed/skipped AND actionlint passed AND lint passed
266-
SCANNING="${{ needs.scanning.result }}"
267165
ACTIONLINT="${{ needs.actionlint.result }}"
268166
LINT="${{ needs.lint.result }}"
269167
270-
if [[ ("$SCANNING" == "success" || "$SCANNING" == "skipped") && "$ACTIONLINT" == "success" && "$LINT" == "success" ]]; then
168+
if [[ "$ACTIONLINT" == "success" && "$LINT" == "success" ]]; then
271169
echo "result=success" >> "$GITHUB_OUTPUT"
272170
else
273171
echo "result=failure" >> "$GITHUB_OUTPUT"
@@ -284,7 +182,6 @@ jobs:
284182
description: |
285183
${{ steps.lint-status.outputs.result == 'success' && '✅ **All validation checks passed**' || '❌ **Validation issues detected**' }}
286184
287-
**🔒 Security Scan:** ${{ needs.scanning.result == 'success' && '✅ No secrets detected' || needs.scanning.result == 'skipped' && '⏭️ Skipped (PR/manual)' || '❌ Issues found' }}
288185
**⚙️ Workflow Validation:** ${{ needs.actionlint.result == 'success' && '✅ All workflows valid' || '❌ Issues detected' }}
289186
**📋 Code Quality:** ${{ needs.lint.result == 'success' && '✅ All stacks valid' || '❌ Issues detected' }}
290187
@@ -306,15 +203,8 @@ jobs:
306203
• Test locally: `yamllint --strict stack/compose.yaml`
307204
• Check the **Lint Summary** job for detailed errors' || '' }}
308205
309-
${{ needs.scanning.result == 'failure' && '
310-
**🛡️ Security Alert:**
311-
• GitGuardian detected potential secrets
312-
• Review the **Security Scanning** job for details
313-
• Remove exposed secrets before proceeding
314-
• **This blocks deployment until resolved**' || '' }}
315-
316206
${{ steps.lint-status.outputs.result == 'success' && '🚀 **Ready for deployment**' || '⚠️ **Deployment blocked until issues resolved**' }}
317-
color: ${{ steps.lint-status.outputs.result == 'success' && 0x28a745 || needs.scanning.result == 'failure' && 0xdc3545 || 0xfd7e14 }}
207+
color: ${{ steps.lint-status.outputs.result == 'success' && 0x28a745 || 0xfd7e14 }}
318208
username: "Compose Lint"
319209
avatar_url: "https://cdn-icons-png.flaticon.com/512/2103/2103633.png"
320210

0 commit comments

Comments
 (0)