-
Notifications
You must be signed in to change notification settings - Fork 19
[StepSecurity] Apply security best practices #92
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,78 @@ | ||
| # For most projects, this workflow file will not need changing; you simply need | ||
| # to commit it to your repository. | ||
| # | ||
| # You may wish to alter this file to override the set of languages analyzed, | ||
| # or to provide custom queries or build logic. | ||
| # | ||
| # ******** NOTE ******** | ||
| # We have attempted to detect the languages in your repository. Please check | ||
| # the `language` matrix defined below to confirm you have the correct set of | ||
| # supported CodeQL languages. | ||
| # | ||
| name: "CodeQL" | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| # The branches below must be a subset of the branches above | ||
| branches: ["main"] | ||
| schedule: | ||
| - cron: "0 0 * * 1" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| analyze: | ||
| name: Analyze | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| security-events: write | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| language: ["go"] | ||
| # CodeQL supports [ $supported-codeql-languages ] | ||
| # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | ||
|
|
||
| steps: | ||
| - name: Harden the runner (Audit all outbound calls) | ||
| uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 | ||
| with: | ||
| egress-policy: audit | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||
|
|
||
| # Initializes the CodeQL tools for scanning. | ||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@45580472a5bb82c4681c4ac726cfdb60060c2ee1 # v3.32.4 | ||
| with: | ||
| languages: ${{ matrix.language }} | ||
| # If you wish to specify custom queries, you can do so here or in a config file. | ||
| # By default, queries listed here will override any specified in a config file. | ||
| # Prefix the list here with "+" to use these queries and those in the config file. | ||
|
|
||
| # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
| # If this step fails, then you should remove it and run the build manually (see below) | ||
| - name: Autobuild | ||
| uses: github/codeql-action/autobuild@45580472a5bb82c4681c4ac726cfdb60060c2ee1 # v3.32.4 | ||
|
|
||
| # ℹ️ Command-line programs to run using the OS shell. | ||
| # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
|
|
||
| # If the Autobuild fails above, remove it and uncomment the following three lines. | ||
| # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. | ||
|
|
||
| # - run: | | ||
| # echo "Run, Build Application using script" | ||
| # ./location_of_script_within_repo/buildscript.sh | ||
|
|
||
| - name: Perform CodeQL Analysis | ||
| uses: github/codeql-action/analyze@45580472a5bb82c4681c4ac726cfdb60060c2ee1 # v3.32.4 | ||
| with: | ||
| category: "/language:${{matrix.language}}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Dependency Review Action | ||
| # | ||
| # This Action will scan dependency manifest files that change as part of a Pull Request, | ||
| # surfacing known-vulnerable versions of the packages declared or updated in the PR. | ||
| # Once installed, if the workflow run is marked as required, | ||
| # PRs introducing known-vulnerable packages will be blocked from merging. | ||
| # | ||
| # Source repository: https://github.com/actions/dependency-review-action | ||
| name: 'Dependency Review' | ||
| on: [pull_request] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| dependency-review: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Harden the runner (Audit all outbound calls) | ||
| uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 | ||
| with: | ||
| egress-policy: audit | ||
|
|
||
| - name: 'Checkout Repository' | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||
| - name: 'Dependency Review' | ||
| uses: actions/dependency-review-action@05fe4576374b728f0c523d6a13d64c25081e0803 # v4.8.3 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,15 +17,15 @@ jobs: | |
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Run Gosec Security Scanner | ||
| uses: securego/gosec@master | ||
| uses: securego/gosec@f3e2fac4d58b7eca54307cd40ce2a836a12e4d95 # master | ||
| with: | ||
| args: ./... | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | ||
| with: | ||
| go-version: '1.25' | ||
|
Comment on lines
+28
to
30
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. Go toolchain version mismatch: Same issue as in 🔧 Proposed fix- go-version: '1.25'
+ go-version: '1.26'🤖 Prompt for AI Agents |
||
|
|
||
|
|
@@ -37,28 +37,28 @@ jobs: | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Install Cosign | ||
| uses: sigstore/cosign-installer@v4.0.0 | ||
| uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0 | ||
| with: | ||
| cosign-release: 'v2.6.1' | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Login to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build and push Docker Hub image | ||
| uses: docker/build-push-action@v6 | ||
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | ||
| id: push-dockerhub | ||
| with: | ||
| context: . | ||
|
|
@@ -76,7 +76,7 @@ jobs: | |
| COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} | ||
|
|
||
| - name: Build and push GHCR image | ||
| uses: docker/build-push-action@v6 | ||
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | ||
| id: push-ghcr | ||
| with: | ||
| context: . | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,15 +19,15 @@ jobs: | |||||||||||||
|
|
||||||||||||||
| steps: | ||||||||||||||
| - name: Checkout | ||||||||||||||
| uses: actions/checkout@v6 | ||||||||||||||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||||||||||||||
|
|
||||||||||||||
| - name: Run Gosec Security Scanner | ||||||||||||||
| uses: securego/gosec@master | ||||||||||||||
| uses: securego/gosec@f3e2fac4d58b7eca54307cd40ce2a836a12e4d95 # master | ||||||||||||||
| with: | ||||||||||||||
| args: ./... | ||||||||||||||
|
|
||||||||||||||
| - name: Set up Go | ||||||||||||||
| uses: actions/setup-go@v6 | ||||||||||||||
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | ||||||||||||||
| with: | ||||||||||||||
| go-version: '1.25' | ||||||||||||||
|
Comment on lines
+30
to
32
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. Go toolchain version mismatch: workflows test with Both docker workflows set Both should reference the same Go version. 🔧 Proposed fix — align the workflow Go version with the Dockerfile- go-version: '1.25'
+ go-version: '1.26'📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
|
|
@@ -40,23 +40,23 @@ jobs: | |||||||||||||
| # cosign-release: 'v2.6.0' | ||||||||||||||
|
|
||||||||||||||
| - name: Set up Docker Buildx | ||||||||||||||
| uses: docker/setup-buildx-action@v3 | ||||||||||||||
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 | ||||||||||||||
|
|
||||||||||||||
| - name: Login to Docker Hub | ||||||||||||||
| uses: docker/login-action@v3 | ||||||||||||||
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 | ||||||||||||||
| with: | ||||||||||||||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||||||||||||||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||||||||||||
|
|
||||||||||||||
| - name: Login to GitHub Container Registry | ||||||||||||||
| uses: docker/login-action@v3 | ||||||||||||||
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 | ||||||||||||||
| with: | ||||||||||||||
| registry: ghcr.io | ||||||||||||||
| username: ${{ github.actor }} | ||||||||||||||
| password: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||
|
|
||||||||||||||
| - name: Build and push image to Docker Hub and GHCR | ||||||||||||||
| uses: docker/build-push-action@v6 | ||||||||||||||
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | ||||||||||||||
| id: push-all | ||||||||||||||
| with: | ||||||||||||||
| context: . | ||||||||||||||
|
|
@@ -70,7 +70,7 @@ jobs: | |||||||||||||
| ghcr.io/wollomatic/socket-proxy:testing-${{ github.sha }} | ||||||||||||||
|
|
||||||||||||||
| # - name: Build and push Docker Hub image | ||||||||||||||
| # uses: docker/build-push-action@v6 | ||||||||||||||
| # uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | ||||||||||||||
| # id: push-dockerhub | ||||||||||||||
| # with: | ||||||||||||||
| # context: . | ||||||||||||||
|
|
@@ -88,7 +88,7 @@ jobs: | |||||||||||||
| # COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} | ||||||||||||||
| # | ||||||||||||||
| # - name: Build and push GHCR image | ||||||||||||||
| # uses: docker/build-push-action@v6 | ||||||||||||||
| # uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | ||||||||||||||
| # id: push-ghcr | ||||||||||||||
| # with: | ||||||||||||||
| # context: . | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| repos: | ||
| - repo: https://github.com/gitleaks/gitleaks | ||
| rev: v8.16.3 | ||
| hooks: | ||
| - id: gitleaks | ||
| - repo: https://github.com/golangci/golangci-lint | ||
| rev: v1.52.2 | ||
| hooks: | ||
| - id: golangci-lint | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v4.4.0 | ||
| hooks: | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
|
Comment on lines
+2
to
+14
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: What pre-commit expects in
|
||
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: wollomatic/socket-proxy
Length of output: 721
🏁 Script executed:
Repository: wollomatic/socket-proxy
Length of output: 386
actions/checkoutversion inconsistency — align across workflows.The CodeQL workflow pins
actions/checkoutto v4.3.1 (34e114876b...), whilst both docker workflows (docker-image-release.yamlanddocker-image-testing.yaml) use v6.0.2 (de0fac2e45...). Both SHAs have been verified against their respective version tags. Consider aligning these to the same major version across the repository unless there is a deliberate reason to maintain separate versions.🤖 Prompt for AI Agents