Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ci): authenticate Docker Hub pulls in ci-security.yaml via login-action (#61257)

mendral-app[bot]588352e1996f
diff --git a/.github/workflows/ci-security.yaml b/.github/workflows/ci-security.yaml
index 3550976af231..5bd03a116757 100644
--- a/.github/workflows/ci-security.yaml
+++ b/.github/workflows/ci-security.yaml
@@ -12,114 +12,172 @@ permissions:
env:
SEMGREP_ENABLE_VERSION_CHECK: 'false'
+ SEMGREP_IMAGE: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03
jobs:
semgrep-python:
runs-on: ubuntu-latest
timeout-minutes: 30
- container:
- image: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03
+
+ env:
+ DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
+ - name: Log in to Docker Hub
+ if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
+ uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Semgrep
run: |
- semgrep \
- --config "p/python" \
- --config "p/owasp-top-ten" \
- --config "p/security-audit" \
- --config "p/trailofbits" \
- --config ".semgrep/rules" \
- --exclude-rule trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport \
- --exclude-rule "python.django.security.audit.csrf-exempt.no-csrf-exempt" \
- --exclude-rule "generic.html-templates.security.var-in-href.var-in-href" \
- --error \
- --metrics=off \
- --verbose \
- bin/ common/ ee/ frontend/ posthog/ products/ services/llm-gateway/ services/stripe-mock/
+ docker run --rm -v "${{ github.workspace }}:/src" -w /src \
+ -e SEMGREP_ENABLE_VERSION_CHECK=false \
+ ${{ env.SEMGREP_IMAGE }} \
+ semgrep \
+ --config "p/python" \
+ --config "p/owasp-top-ten" \
+ --config "p/security-audit" \
+ --config "p/trailofbits" \
+ --config ".semgrep/rules" \
+ --exclude-rule trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport \
+ --exclude-rule "python.django.security.audit.csrf-exempt.no-csrf-exempt" \
+ --exclude-rule "generic.html-templates.security.var-in-href.var-in-href" \
+ --error \
+ --metrics=off \
+ --verbose \
+ bin/ common/ ee/ frontend/ posthog/ products/ services/llm-gateway/ services/stripe-mock/
semgrep-go:
runs-on: ubuntu-latest
timeout-minutes: 10
- container:
- image: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03
+
+ env:
+ DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
+ - name: Log in to Docker Hub
+ if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
+ uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Semgrep
run: |
- semgrep \
- --config "p/golang" \
- --config "p/owasp-top-ten" \
- --config "p/security-audit" \
- --config "p/trailofbits" \
- --config "r/go.lang.security" \
- --exclude-rule go.lang.security.audit.xss.no-fprintf-to-responsewriter.no-fprintf-to-responsewriter \
- --error \
- --metrics=off \
- --verbose \
- livestream/
+ docker run --rm -v "${{ github.workspace }}:/src" -w /src \
+ -e SEMGREP_ENABLE_VERSION_CHECK=false \
+ ${{ env.SEMGREP_IMAGE }} \
+ semgrep \
+ --config "p/golang" \
+ --config "p/owasp-top-ten" \
+ --config "p/security-audit" \
+ --config "p/trailofbits" \
+ --config "r/go.lang.security" \
+ --exclude-rule go.lang.security.audit.xss.no-fprintf-to-responsewriter.no-fprintf-to-responsewriter \
+ --error \
+ --metrics=off \
+ --verbose \
+ livestream/
semgrep-rust:
runs-on: ubuntu-latest
timeout-minutes: 10
- container:
- image: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03
+
+ env:
+ DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
+ - name: Log in to Docker Hub
+ if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
+ uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Semgrep
run: |
- semgrep \
- --config "p/rust" \
- --config "p/owasp-top-ten" \
- --config "p/security-audit" \
- --config "p/trailofbits" \
- --config "r/rust.lang.security" \
- --exclude-rule trailofbits.generic.curl-unencrypted-url.curl-unencrypted-url \
- --exclude-rule trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport \
- --exclude-rule trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result \
- --error \
- --metrics=off \
- --verbose \
- cli/ rust/
+ docker run --rm -v "${{ github.workspace }}:/src" -w /src \
+ -e SEMGREP_ENABLE_VERSION_CHECK=false \
+ ${{ env.SEMGREP_IMAGE }} \
+ semgrep \
+ --config "p/rust" \
+ --config "p/owasp-top-ten" \
+ --config "p/security-audit" \
+ --config "p/trailofbits" \
+ --config "r/rust.lang.security" \
+ --exclude-rule trailofbits.generic.curl-unencrypted-url.curl-unencrypted-url \
+ --exclude-rule trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport \
+ --exclude-rule trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result \
+ --error \
+ --metrics=off \
+ --verbose \
+ cli/ rust/
semgrep-js:
runs-on: ubuntu-latest
timeout-minutes: 20
- container:
- image: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03
+
+ env:
+ DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
+ - name: Log in to Docker Hub
+ if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
+ uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run Semgrep
run: |
- semgrep \
- --config ".semgrep/rules/" \
- --config "p/javascript" \
- --config "p/owasp-top-ten" \
- --config "p/security-audit" \
- --config "p/trailofbits" \
- --error \
- --metrics=off \
- --verbose \
- frontend/ nodejs/ services/mcp/ services/oauth-proxy/ services/stripe-app/
+ docker run --rm -v "${{ github.workspace }}:/src" -w /src \
+ -e SEMGREP_ENABLE_VERSION_CHECK=false \
+ ${{ env.SEMGREP_IMAGE }} \
+ semgrep \
+ --config ".semgrep/rules/" \
+ --config "p/javascript" \
+ --config "p/owasp-top-ten" \
+ --config "p/security-audit" \
+ --config "p/trailofbits" \
+ --error \
+ --metrics=off \
+ --verbose \
+ frontend/ nodejs/ services/mcp/ services/oauth-proxy/ services/stripe-app/
semgrep-products-frontend:
runs-on: ubuntu-latest
timeout-minutes: 20
- container:
- image: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03
+
+ env:
+ DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
+ - name: Log in to Docker Hub
+ if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
+ uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -129,51 +187,66 @@ jobs:
# product-specific rules land, extend the --config list explicitly.
- name: Run Semgrep
run: |
- semgrep \
- --config ".semgrep/rules/prefer-codegen-api.yaml" \
- --error \
- --metrics=off \
- --verbose \
- products/
+ docker run --rm -v "${{ github.workspace }}:/src" -w /src \
+ -e SEMGREP_ENABLE_VERSION_CHECK=false \
+ ${{ env.SEMGREP_IMAGE }} \
+ semgrep \
+ --config ".semgrep/rules/prefer-codegen-api.yaml" \
+ --error \
+ --metrics=off \
+ --verbose \
+ products/
# scans GitHub Actions and other repo-wide config
semgrep-general:
runs-on: ubuntu-latest
timeout-minutes: 20
- container:
- image: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03
+
+ env:
+ DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
+ - name: Log in to Docker Hub
+ if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
+ uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# exclude all directories already scanned by other jobs
- name: Run Semgrep
run: |
- semgrep \
- --config "p/owasp-top-ten" \
- --config "p/security-audit" \
- --config "p/trailofbits" \
- --config "p/github-actions" \
- --exclude-rule dockerfile.security.no-sudo-in-dockerfile.no-sudo-in-dockerfile \
- --exclude-rule trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport \
- --exclude-rule trailofbits.yaml.docker-compose.port-all-interfaces.port-all-interfaces \
- --error \
- --metrics=off \
- --verbose \
- --exclude ./cli/ \
- --exclude ./common/ \
- --exclude ./ee/ \
- --exclude ./frontend/ \
- --exclude ./livestream/ \
- --exclude ./nodejs/ \
- --exclude ./posthog/ \
- --exclude ./products/ \
- --exclude ./rust/ \
- --exclude ./.semgrep/ \
- --exclude ./docs/ \
- --exclude ./services/ \
- .
+ docker run --rm -v "${{ github.workspace }}:/src" -w /src \
+ -e SEMGREP_ENABLE_VERSION_CHECK=false \
+ ${{ env.SEMGREP_IMAGE }} \
+ semgrep \
+ --config "p/owasp-top-ten" \
+ --config "p/security-audit" \
+ --config "p/trailofbits" \
+ --config "p/github-actions" \
+ --exclude-rule dockerfile.security.no-sudo-in-dockerfile.no-sudo-in-dockerfile \
+ --exclude-rule trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport \
+ --exclude-rule trailofbits.yaml.docker-compose.port-all-interfaces.port-all-interfaces \
+ --error \
+ --metrics=off \
+ --verbose \
+ --exclude ./cli/ \
+ --exclude ./common/ \
+ --exclude ./ee/ \
+ --exclude ./frontend/ \
+ --exclude ./livestream/ \
+ --exclude ./nodejs/ \
+ --exclude ./posthog/ \
+ --exclude ./products/ \
+ --exclude ./rust/ \
+ --exclude ./.semgrep/ \
+ --exclude ./docs/ \
+ --exclude ./services/ \
+ .
# Devex / hygiene rules. Two passes:
# - WARNING-severity rules print findings without failing the job
@@ -183,10 +256,19 @@ jobs:
semgrep-devex:
runs-on: ubuntu-latest
timeout-minutes: 20
- container:
- image: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03
+
+ env:
+ DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
+ - name: Log in to Docker Hub
+ if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
+ uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -195,38 +277,56 @@ jobs:
# up here.
- name: Warnings (informational)
run: |
- semgrep \
- --config ".semgrep/devex-rules/" \
- --severity=WARNING \
- --metrics=off \
- --verbose \
- bin/ common/ ee/ frontend/ posthog/ products/
+ docker run --rm -v "${{ github.workspace }}:/src" -w /src \
+ -e SEMGREP_ENABLE_VERSION_CHECK=false \
+ ${{ env.SEMGREP_IMAGE }} \
+ semgrep \
+ --config ".semgrep/devex-rules/" \
+ --severity=WARNING \
+ --metrics=off \
+ --verbose \
+ bin/ common/ ee/ frontend/ posthog/ products/
# Pass 2: enforce ERROR-severity rules. Any finding fails the
# job — regression guards live here.
- name: Errors (blocking)
run: |
- semgrep \
- --config ".semgrep/devex-rules/" \
- --severity=ERROR \
- --error \
- --metrics=off \
- --verbose \
- bin/ common/ ee/ frontend/ posthog/ products/
+ docker run --rm -v "${{ github.workspace }}:/src" -w /src \
+ -e SEMGREP_ENABLE_VERSION_CHECK=false \
+ ${{ env.SEMGREP_IMAGE }} \
+ semgrep \
+ --config ".semgrep/devex-rules/" \
+ --severity=ERROR \
+ --error \
+ --metrics=off \
+ --verbose \
+ bin/ common/ ee/ frontend/ posthog/ products/
semgrep-test-rules:
runs-on: ubuntu-latest
timeout-minutes: 10
- container:
- image: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03
+
+ env:
+ DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
+ - name: Log in to Docker Hub
+ if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
+ uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Test custom Semgrep rules
run: |
- semgrep --test .semgrep/
+ docker run --rm -v "${{ github.workspace }}:/src" -w /src \
+ -e SEMGREP_ENABLE_VERSION_CHECK=false \
+ ${{ env.SEMGREP_IMAGE }} \
+ semgrep --test .semgrep/
semgrep_checks:
needs: