-
Notifications
You must be signed in to change notification settings - Fork 721
created terraform #13
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: main
Are you sure you want to change the base?
Changes from 13 commits
21faabf
6613eff
bbb97aa
c7e7d12
438bcc9
d782154
4425041
74d0365
6b4c582
6b62387
169b100
43a2dc6
0b7cd18
135d33d
eef392f
918f30d
5af7b19
ea1538a
faaa4dd
75573fc
f71a036
5fce991
3f19b5b
a8d254b
59d4e1b
4424b28
8c7103e
d2f8b75
71f6604
2fcf285
472dd2c
fdd9a5d
854381c
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,91 @@ | ||||||||||||||
| name: Go Code Quality | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| workflow_call: | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| code-quality: | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
|
|
||||||||||||||
| strategy: | ||||||||||||||
| fail-fast: false | ||||||||||||||
|
|
||||||||||||||
| matrix: | ||||||||||||||
| go-version: ["1.21", "1.22", "1.23"] | ||||||||||||||
|
|
||||||||||||||
| steps: | ||||||||||||||
| # ============================== | ||||||||||||||
| # Checkout Repository | ||||||||||||||
| # ============================== | ||||||||||||||
|
|
||||||||||||||
| - name: Checkout Code | ||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||
|
|
||||||||||||||
|
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify checkout steps explicitly disable credential persistence
rg -n -C2 'uses:\s*actions/checkout@' .github/workflows
rg -n 'persist-credentials:\s*false' .github/workflowsRepository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 945 🏁 Script executed: cat -n .github/workflows/code-quality-check.yml | sed -n '15,30p'Repository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 596 🏁 Script executed: cat -n .github/workflows/cd-k8s.yml | sed -n '14,22p'Repository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 391 🌐 Web query:
💡 Result: Best-practice answer (security): set persist-credentials: false on actions/checkout unless you specifically need later steps to run authenticated git commands using the checkout token. Why: actions/checkout can persist the auth token in the local git config so scripts can run authenticated git commands, and the token is removed during post-job cleanup; opting out via persist-credentials: false prevents that persistence. [1][2] Recommended pattern - Always harden checkout steps: - uses: actions/checkout@v4 (or newer) - with: persist-credentials: false This ensures the token is not persisted to the repository’s git configuration for subsequent steps. [1][2] When you might keep it enabled - Only when you truly need later steps to run authenticated git operations without manually reconfiguring credentials (for example, actions that assume the persisted credentials are available after checkout). [1][3] Additional defense-in-depth (separate from persist-credentials) - Constrain GITHUB_TOKEN permissions (e.g., use a permissions block / least privilege) so that even if credentials were exposed, the blast radius is reduced. [4] Concrete example - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false This is the explicit remediation repeatedly called out by the checkout action maintainers’ guidance and security discussions. [2][5] Citations:
Add The Suggested patch - name: Checkout Code
uses: actions/checkout@v4
+ with:
+ persist-credentials: false📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.25.2)[warning] 21-26: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 22-22: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||
| # ============================== | ||||||||||||||
| # Setup Go Environment | ||||||||||||||
| # ============================== | ||||||||||||||
|
|
||||||||||||||
| - name: Setup Go ${{ matrix.go-version }} | ||||||||||||||
| uses: actions/setup-go@v5 | ||||||||||||||
| with: | ||||||||||||||
| go-version: ${{ matrix.go-version }} | ||||||||||||||
|
|
||||||||||||||
| # ============================== | ||||||||||||||
| # Verify Go Installation | ||||||||||||||
| # ============================== | ||||||||||||||
|
|
||||||||||||||
| - name: Verify Go Version | ||||||||||||||
| run: go version | ||||||||||||||
|
|
||||||||||||||
| # ============================== | ||||||||||||||
| # Verify go.mod Exists | ||||||||||||||
| # ============================== | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| - name: Setup Go | ||||||||||||||
| uses: actions/setup-go@v5 | ||||||||||||||
| with: | ||||||||||||||
| go-version-file: backend/go.mod | ||||||||||||||
| cache: true | ||||||||||||||
|
|
||||||||||||||
| # ============================== | ||||||||||||||
| # Install Dependencies | ||||||||||||||
| # ============================== | ||||||||||||||
|
|
||||||||||||||
| - name: Install Dependencies | ||||||||||||||
| run: | | ||||||||||||||
| go mod tidy | ||||||||||||||
| go mod download | ||||||||||||||
|
|
||||||||||||||
| # ============================== | ||||||||||||||
| # Format Check | ||||||||||||||
| # ============================== | ||||||||||||||
|
|
||||||||||||||
| - name: Run gofmt | ||||||||||||||
| run: | | ||||||||||||||
| test -z "$(gofmt -l .)" | ||||||||||||||
|
|
||||||||||||||
| # ============================== | ||||||||||||||
| # Static Analysis | ||||||||||||||
| # ============================== | ||||||||||||||
|
|
||||||||||||||
| - name: Run go vet | ||||||||||||||
| run: | | ||||||||||||||
| go vet ./... | ||||||||||||||
|
|
||||||||||||||
| # ============================== | ||||||||||||||
| # GolangCI Lint | ||||||||||||||
| # ============================== | ||||||||||||||
|
|
||||||||||||||
| - name: Run golangci-lint | ||||||||||||||
| uses: golangci/golangci-lint-action@v6 | ||||||||||||||
| with: | ||||||||||||||
| version: latest | ||||||||||||||
|
|
||||||||||||||
| # ============================== | ||||||||||||||
| # Run Unit Tests | ||||||||||||||
| # ============================== | ||||||||||||||
|
|
||||||||||||||
| - name: Run Tests | ||||||||||||||
| run: | | ||||||||||||||
| go test ./... -v | ||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,97 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Dependency Vulnerability Scan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_call: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dependency-scan: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail-fast: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| go-version: ["1.21", "1.22", "1.23"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Checkout Repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+22
to
+23
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. 🧩 Analysis chain🏁 Script executed: cat -n .github/workflows/dependency-scan.ymlRepository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 3075 Pin actions to commit SHAs and disable checkout token persistence. All Also applies to: 29-32, 77-79, 91-93 🧰 Tools🪛 zizmor (1.25.2)[warning] 22-27: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 23-23: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Setup Go Environment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Go ${{ matrix.go-version }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-go@v5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| go-version: ${{ matrix.go-version }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Verify Go Installation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Verify Go Version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: go version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Verify go.mod Exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Check go.mod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ ! -f go.mod ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "go.mod file not found!" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Install Dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install Dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| go mod tidy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| go mod download | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run govulncheck | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install govulncheck | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| go install golang.org/x/vuln/cmd/govulncheck@latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run Dependency Vulnerability Scan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| govulncheck ./... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run Trivy Filesystem Scan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run Trivy Filesystem Scan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: aquasecurity/trivy-action@0.24.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scan-type: fs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scan-ref: . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| format: table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit-code: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ignore-unfixed: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| severity: CRITICAL,HIGH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Upload Trivy Report (Optional) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Upload Trivy Report | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: trivy-dependency-report | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: trivy-results.sarif | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if-no-files-found: ignore | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+77
to
+97
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. 🧩 Analysis chain🌐 Web query:
💡 Result: To generate a table-formatted output file using Citations:
🌐 Web query:
💡 Result: In trivy-action, including version 0.24.0, the SARIF format output filename is not determined by a hardcoded default; rather, it is specified by the user using the Citations:
Trivy scan with The scan is configured to output in table format without specifying an To fix, set Proposed fix - name: Run Trivy Filesystem Scan
uses: aquasecurity/trivy-action@0.24.0
with:
scan-type: fs
scan-ref: .
- format: table
+ format: sarif
+ output: trivy-results.sarif
exit-code: 1
ignore-unfixed: true
severity: CRITICAL,HIGH📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.25.2)[error] 78-78: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 93-93: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # this will deploy the safe / secure / tested app to Prod server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Deploy To Server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_call: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| deploy: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DOCKERHUB_USER: ${{ vars.DOCKERHUB_USER }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DOCKER_TAG: ${{ github.sha }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: SSH to Prod server & create app folder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: appleboy/ssh-action@v1.0.3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| host: ${{ secrets.EC2_SSH_HOST }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| username: ${{ secrets.EC2_SSH_USER }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| key: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Installing required packages & folders" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sudo apt-get update && sudo apt-get install docker.io docker-compose-v2 -y | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sudo usermod -aG docker $USER | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p devops | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Copy the docker-compose file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: appleboy/scp-action@v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| host: ${{ secrets.EC2_SSH_HOST }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| username: ${{ secrets.EC2_SSH_USER }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| key: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source: docker-compose.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| target: ~/devops | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: SSH to Prod server & run the app | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: appleboy/ssh-action@v1.0.3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| host: ${{ secrets.EC2_SSH_HOST }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| username: ${{ secrets.EC2_SSH_USER }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| key: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Running App" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export DOCKERHUB_USER=${{ vars.DOCKERHUB_USER }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export DOCKER_TAG=${{ github.sha }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ vars.DOCKERHUB_USER }} --password-stdin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cd ~/devops && docker compose down && docker compose up -d --build --force-recreate --pull always | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+52
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. 🧩 Analysis chain🏁 Script executed: # First, let's examine the full deploy-to-server.yml workflow
cat -n .github/workflows/deploy-to-server.ymlRepository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 2456 🏁 Script executed: # Check if docker-compose.yml exists and examine its content
if [ -f docker-compose.yml ]; then
echo "=== docker-compose.yml ==="
cat -n docker-compose.yml
else
echo "docker-compose.yml not found in root"
# Search for docker-compose files
find . -name "docker-compose*.yml" -o -name "docker-compose*.yaml" | head -20
fiRepository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 1733 🏁 Script executed: # Check for Docker build workflows in the repo
find .github/workflows -type f \( -name "*.yml" -o -name "*.yaml" \) | head -20Repository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 505 Remove The Proposed fix- cd ~/devops && docker compose down && docker compose up -d --build --force-recreate --pull always
+ cd ~/devops && docker compose down && docker compose up -d --force-recreate --pull always📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.25.2)[info] 49-49: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) [info] 51-51: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) [error] 32-32: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 41-41: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: DevSecOps End To End Pipeline | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - feat/dev | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+9
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. Add explicit workflow Without a Suggested patch on:
push:
branches:
- main
- feat/dev
+
+permissions:
+ contents: read📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # CI (Continous Integration with Security Scanning) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| code-quality: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/code-quality-check.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| secrets-scan: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/secret-scan.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| secrets: inherit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dependency-scan: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/dependency-scan.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker-scan: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/docker-lint.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Build once the security scans and tests are complete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: [code-quality, secrets-scan, dependency-scan, docker-scan] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/docker-build-push.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| secrets: inherit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tests: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/tests.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Image scan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| trivy: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: [build] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/image-scan.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| secrets: inherit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # CD : Deploy to Production | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| deploy: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: [trivy] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/deploy-to-server.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+24
to
+43
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. Gate build/deploy on
Suggested patch # Build once the security scans and tests are complete
build:
- needs: [code-quality, secrets-scan, dependency-scan, docker-scan]
+ needs: [code-quality, secrets-scan, dependency-scan, docker-scan, tests]
uses: ./.github/workflows/docker-build-push.yml
secrets: inherit📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.25.2)[warning] 25-28: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) [warning] 30-33: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) [warning] 34-40: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) [warning] 27-27: secrets unconditionally inherited by called workflow (secrets-inherit): this reusable workflow (secrets-inherit) [warning] 36-36: secrets unconditionally inherited by called workflow (secrets-inherit): this reusable workflow (secrets-inherit) [warning] 43-43: secrets unconditionally inherited by called workflow (secrets-inherit): this reusable workflow (secrets-inherit) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| secrets: inherit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Docker Build & Push | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
|
|
||
| - name: Code Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ vars.DOCKERHUB_USER }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Build & Push to Docker Hub | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| push: true | ||
| tags: | | ||
| ${{ vars.DOCKERHUB_USER }}/github-actions-app:${{ github.ref_name }} | ||
| ${{ vars.DOCKERHUB_USER }}/github-actions-app:latest | ||
| ${{ vars.DOCKERHUB_USER }}/github-actions-app:${{ github.sha}} | ||
|
Comment on lines
+21
to
+29
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 build job doesn't satisfy the downstream image contract. The stack added in this PR scans and deploys backend/frontend images, but this workflow builds one root-context image named 🧰 Tools🪛 zizmor (1.25.2)[error] 22-22: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| name: Docker Lint | ||
|
|
||
| on: | ||
| workflow_call: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| docker-lint: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Lint Backend Dockerfile | ||
| run: | | ||
| docker run --rm \ | ||
| -v ${{ github.workspace }}/backend/Dockerfile:/Dockerfile \ | ||
| hadolint/hadolint hadolint --ignore DL3018 /Dockerfile | ||
|
|
||
| - name: Lint Frontend Dockerfile | ||
| run: | | ||
| docker run --rm \ | ||
| -v ${{ github.workspace }}/frontend/Dockerfile:/Dockerfile \ | ||
| hadolint/hadolint hadolint --ignore DL3018 /Dockerfile | ||
|
Comment on lines
+12
to
+25
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. 🧩 Analysis chain🏁 Script executed: # First, check if the workflow file exists and read its contents
cat -n .github/workflows/docker-lint.ymlRepository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 902 🏁 Script executed: # Verify GitHub Actions best practices for checkout action
# Search for documentation on persist-credentials and commit SHA pinning
web_search_results=$(curl -s "https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions" 2>/dev/null || echo "offline")
echo "Checking GitHub Actions security practices..."Repository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 144 🏁 Script executed: # Check if hadolint provides versioned images
# Look for information on hadolint Docker image tagging
echo "Checking hadolint image availability..."Repository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 138 🏁 Script executed: cat -n .github/workflows/docker-lint.ymlRepository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 902 🌐 Web query:
💡 Result: Pinning GitHub Actions, including actions/checkout@v4, to a full-length commit SHA is considered a critical security best practice for protecting CI/CD pipelines against supply chain attacks [1][2][3]. Security Rationale Using a version tag (like Citations:
🌐 Web query:
💡 Result: Hadolint is distributed as a Docker image on Docker Hub and the GitHub Container Registry (ghcr.io), providing various tags to support different use cases and versions [1][2][3]. The available tags generally fall into the following categories: 1. Version-specific tags: These tags correspond to specific releases of Hadolint (e.g., v2.14.0) [1][2]. You can also find variants of these specific versions, such as v2.14.0-alpine or v2.14.0-debian, to suit different base image requirements [1][2]. 2. Latest/Rolling tags: The tag latest provides the most recent stable release [1]. Similar to versioned tags, there are variants such as latest-alpine and latest-debian [1][2][3]. 3. Architecture and commit-specific tags: The registry also includes tags linked to specific Git commit SHAs and CPU architectures (e.g., amd64, arm64), often formatted as -- [1]. Best practices for using these images include: - In CI/CD pipelines, it is recommended to use a specific version tag or pin the image by its digest to ensure consistent build environments and avoid the risks associated with mutable tags like latest [4][5]. - If you require shell access within the container, use the -alpine or -debian variants [2][3][6]. - You can pull images from the primary repository at hadolint/hadolint or from the GitHub Container Registry at ghcr.io/hadolint/hadolint [2][3]. You can view the full, up-to-date list of available tags directly on the official Docker Hub page [1]. Citations:
Pin actions and container images to specific, immutable versions for deterministic and secure workflows.
🧰 Tools🪛 zizmor (1.25.2)[warning] 12-13: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 13-13: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||||||||||||||||||||||
| name: Image scanner | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||
| workflow_call: | ||||||||||||||||||||||||||
| secrets: | ||||||||||||||||||||||||||
| DOCKER_USERNAME: | ||||||||||||||||||||||||||
| required: true | ||||||||||||||||||||||||||
| DOCKER_PASSWORD: | ||||||||||||||||||||||||||
| required: true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||
| image-scanner: | ||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Login to Docker Hub | ||||||||||||||||||||||||||
| uses: docker/login-action@v3 | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| # FIXED: Swapped out mismatched names to match the inputs declared above exactly | ||||||||||||||||||||||||||
| username: ${{ secrets.DOCKER_USERNAME }} | ||||||||||||||||||||||||||
| password: ${{ secrets.DOCKER_TOKEN }} | ||||||||||||||||||||||||||
|
Comment on lines
+19
to
+24
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. 🧩 Analysis chain🏁 Script executed: find .github/workflows -name "image-scan.yml" -type fRepository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 131 🏁 Script executed: cat -n .github/workflows/image-scan.ymlRepository: LondheShubham153/github-actions-kubernetes-masterclass Length of output: 1837 Use the declared secret name for Docker Hub login. The workflow declares Proposed fix - name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_TOKEN }}
+ password: ${{ secrets.DOCKER_PASSWORD }}📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.12)[error] 24-24: property "docker_token" is not defined in object type {actions_runner_debug: string; actions_step_debug: string; docker_password: string; docker_username: string; github_token: string} (expression) 🪛 zizmor (1.25.2)[error] 20-20: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Note: Removed the manual Trivy installation apt steps since the action below handles it natively | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Scan Backend Image | ||||||||||||||||||||||||||
| uses: aquasecurity/trivy-action@v0.36.0 # Fixed the version prefix to prevent resolution errors | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| image-ref: ${{ secrets.DOCKER_USERNAME }}/skillpulse-backend:latest | ||||||||||||||||||||||||||
| format: 'table' | ||||||||||||||||||||||||||
| exit-code: 1 | ||||||||||||||||||||||||||
| severity: 'CRITICAL,HIGH' | ||||||||||||||||||||||||||
| trivyignores: .trivyignore | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Scan Frontend Image | ||||||||||||||||||||||||||
| uses: aquasecurity/trivy-action@v0.36.0 # Fixed all version prefix to prevent resolution errors | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| image-ref: ${{ secrets.DOCKER_USERNAME }}/skillpulse-frontend:latest | ||||||||||||||||||||||||||
| format: 'table' | ||||||||||||||||||||||||||
| exit-code: 1 | ||||||||||||||||||||||||||
| severity: 'CRITICAL,HIGH' | ||||||||||||||||||||||||||
|
Comment on lines
+28
to
+43
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. Align the scanned image names with the build workflow output. This job scans 🧰 Tools🪛 zizmor (1.25.2)[error] 29-29: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 38-38: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Logout from Docker Hub | ||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||
| run: docker logout | ||||||||||||||||||||||||||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: LondheShubham153/github-actions-kubernetes-masterclass
Length of output: 495
Pin all GitHub Actions to commit SHAs.
Lines 22, 29, and 81 use tag refs (
@v4,@v5,@v6) instead of immutable commit SHAs. This is a supply-chain hardening gap and will fail strict pinning policies.Suggested patch
🧰 Tools
🪛 zizmor (1.25.2)
[error] 22-22: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents