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.

chore(ci): skip the full semgrep scan on idor model list edits (#125532)

Raúl Negrón-Otero067b23dac2b1
diff --git a/.github/workflows/ci-security.yaml b/.github/workflows/ci-security.yaml
index 11182df34b52..530e3fe93622 100644
--- a/.github/workflows/ci-security.yaml
+++ b/.github/workflows/ci-security.yaml
@@ -38,6 +38,7 @@ jobs:
desktop: ${{ steps.oversized.outputs.force_all || steps.filter.outputs.desktop || 'true' }}
# Pushes default to 'false' because the semgrep-ci action already scans the whole tree on a push.
scan-setup: ${{ steps.oversized.outputs.force_all || steps.filter.outputs.scan-setup || 'false' }}
+ idor-rule: ${{ steps.filter.outputs.idor-rule || 'false' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
@@ -143,9 +144,14 @@ jobs:
- '.github/workflows/ci-security.yaml'
# A change to the rules or the scan setup can change findings in
# unchanged code, so the jobs that pass local rules scan the whole tree.
+ # Every new team-scoped model edits the IDOR rule, so semgrep-python
+ # scans the whole tree with that rule file only.
scan-setup:
- '.semgrep/rules/security/**'
+ - '!.semgrep/rules/security/idor-team-scoped-models.yaml'
- '.github/workflows/ci-security.yaml'
+ idor-rule:
+ - '.semgrep/rules/security/idor-team-scoped-models.yaml'
semgrep-python:
needs: changes
@@ -200,6 +206,28 @@ jobs:
--exclude products/desktop
--jobs 4
+ # The scan above checks only the changed files. A newly listed model can
+ # already have unscoped lookups in unchanged files. Keep the paths aligned
+ # with the scan above.
+ - name: Run the IDOR rule over the whole tree
+ if: needs.changes.outputs.idor-rule == 'true' && needs.changes.outputs.scan-setup != 'true'
+ uses: ./.github/actions/semgrep-ci
+ with:
+ image: ${{ env.SEMGREP_IMAGE }}
+ full-scan: 'true'
+ args: >-
+ --config .semgrep/rules/security/idor-team-scoped-models.yaml
+ --include /bin
+ --include /common
+ --include /ee
+ --include /posthog
+ --include /products
+ --include /services/llm-gateway
+ --include /services/stripe-mock
+ --include /tools
+ --exclude products/desktop
+ --jobs 4
+
semgrep-go:
needs: changes
if: needs.changes.outputs.go == 'true'