Skip to content

Harden GitHub Actions Workflow - go.yml #5

Description

@stepsecurity-app

Summary

This issue is created by StepSecurity related to security issues in go.yml . The platform has identified 2 vulnerabilities (1 critical, 0 high, 0 medium, 1 low).

Remediation Overview

The platform can generate remediations for a few vulnerabilities. For such vulnerabilities, you can find the fixed workflow file in the Suggested Fix For Auto-Remediable Issues section. You can manually deploy these changes or create a pull request by commenting @stepsecurity-app pull-request create on this issue.

If you’d like an automated pull request with the fixed workflow file, comment:

@stepsecurity-app pull-request create

Other issues require manual investigation and changes.

Once a vulnerability has been remediated, ✅ will appear in the title. Note that it may take up to 24 hours for these issues to be updated.

Please review the individual vulnerability section below and follow the recommended resolution steps.

Security Checks Details

❌ Actions should be pinned to a full-length commit SHA

❌ Network and runtime security monitoring should be enabled for GitHub-hosted runners

  • Severity: Low

  • Description: This check passes if the step-security/harden-runner GitHub Action is used in a job that runs on a GitHub-hosted runner. Harden-Runner prevents exfiltration of code and CI/CD credentials, and detects tampering of files during build.

  • Resolution: Add the step-security/harden-runner GitHub Action to the job.

  • Automated Remediation Available ?: true

  • References:

Suggested Fix For Auto-Remediable Issues

Below is the updated workflow, which fixes the following security vulnerabilities:

  • Actions should be pinned to a full-length commit SHA

  • Network and runtime security monitoring should be enabled for GitHub-hosted runners

  name: Go
  permissions:
    contents: read
  on:
    push:
      branches: [ "master" ]
    pull_request:
      branches: [ "master" ]
  jobs:
    build:
      runs-on: ubuntu-22.04
      environment: TESTS
      services:
        postgres:
          image: postgres
          env:
            POSTGRES_DB: payment_processor
            POSTGRES_USER: pp_user
            POSTGRES_PASSWORD: postgres
          options: >-
            --health-cmd pg_isready
            --health-interval 10s
            --health-timeout 5s
            --health-retries 5
          ports:
            - 5432:5432
      steps:
        - 
+ name: Harden the runner (Audit all outbound calls)
+         uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
+         with:
+           egress-policy: audit
+       - 
  uses: actions/checkout@
+ a37ce9120846195fa4ece8f58b268e6043cb2f26 # 
  v3
+ .7.0
          with:
            persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
            fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
        - name: Set up Go
          uses: actions/setup-go@
+ be3c94b385c4f180051c996d336f57a34c397495 # 
  v3
+ .6.1
          with:
            go-version: 1.22.1
        - name: Build
          run: go build -v ./...
        - uses: actions/cache@
+ 0057852bfaa89a56745cba8c7296529d2fc39830 # 
  v4
+ .3.0
          with:
            path: ~/go/pkg/mod
            key: ${{ runner.os }}-2go-${{ hashFiles('**/go.sum') }}
            restore-keys: |
              ${{ runner.os }}-2go-
        - name: Install dependencies
          run: |
            sudo apt-get update
            sudo apt-get -y install openssl ca-certificates libsecp256k1-0 libsodium23
        - name: Install libs
          run: |
            wget -O libemulator.so https://github.com/ton-blockchain/ton/releases/download/v2024.09/libemulator-linux-x86_64.so
            sudo cp libemulator.so /lib
        - name: Update Library Cache
          run: sudo ldconfig
        - name: Verify Library Presence
          run: ls /lib | grep libemulator.so
        - name: Run Test
          env:
            SEED: ${{ secrets.SEED }}
            SERVER: ${{ secrets.SERVER }}
            KEY: ${{ secrets.KEY }}
            DB_URI: postgresql://pp_user:postgres@localhost:5432/payment_processor?sslmode=disable
          run: |
            go test -v $(go list ./...)

Additional Information

For more information, refer to the documentation page here.
Please don't make any changes in the description as the platform makes automated updates in description. Please use the comment section below to provide input.

Automated remediation commands and options
  • Create a pull request with automated security fixes
@stepsecurity-app pull-request create
  • Close this issue and prevent it from being reopened
@stepsecurity-app issue close <REASON>
  • Update issue description with latest security check status
@stepsecurity-app issue force-update
  • View all available commands and their usage
@stepsecurity-app help
Which GitHub Actions security best practices were evaluated?

The workflow was evaluated for the following GitHub Actions security best practices:

  • Network & runtime security monitoring
  • Token permissions
  • Third‐party GitHub Actions usage & pinning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions