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(semgrep): group rules into security/ and devex/ subfolders (#68086)

Rafael Audibert682035b293fa
diff --git a/.agents/security.md b/.agents/security.md
index d091f422f132..4f6708c33384 100644
--- a/.agents/security.md
+++ b/.agents/security.md
@@ -97,7 +97,7 @@ queryset.filter(name__icontains=value) # SAFE
## Semgrep Rules
-Run `semgrep --config .semgrep/rules/ .` to check for injection issues.
+Run `semgrep --config .semgrep/rules/security/ .` to check for injection issues.
Three rules:
@@ -115,8 +115,8 @@ Three rules:
```bash
# Local install
-semgrep --test .semgrep/rules/
+semgrep --test .semgrep/rules/security/
# Or via Docker
-docker run --rm -v "${PWD}:/src" semgrep/semgrep semgrep --test /src/.semgrep/rules/
+docker run --rm -v "${PWD}:/src" semgrep/semgrep semgrep --test /src/.semgrep/rules/security/
```
diff --git a/.agents/skills/implementing-warehouse-sources/SKILL.md b/.agents/skills/implementing-warehouse-sources/SKILL.md
index eefb35f7dd2e..5a7a980a4c89 100644
--- a/.agents/skills/implementing-warehouse-sources/SKILL.md
+++ b/.agents/skills/implementing-warehouse-sources/SKILL.md
@@ -340,7 +340,7 @@ log line and OTel metric, and participates in opt-in sample capture.
`⚠️ Vendor SDK` in `SOURCES.md`.
- gRPC SDKs are **not** exempt — they have their own tracked transport (see below).
-CI enforces this via `.semgrep/rules/data-imports-http-transport.yaml`. The rule bans direct `requests.Session()`,
+CI enforces this via `.semgrep/rules/security/data-imports-http-transport.yaml`. The rule bans direct `requests.Session()`,
`requests.<verb>(...)`, and `httpx.Client/AsyncClient/<verb>` inside `sources/**`. Type-only imports
(`from requests import Response`, `from requests.exceptions import HTTPError`) remain allowed.
@@ -357,7 +357,7 @@ OTel metrics (`data_import_grpc_*`) and feed opt-in sample capture (protobuf →
channel, wrap it with `make_tracked_channel(channel, host=...)`, then hand it to the transport. Reference:
`bigquery/bigquery.py:bigquery_storage_read_client`.
-CI enforces this via `.semgrep/rules/data-imports-grpc-transport.yaml`, which bans raw `grpc.*_channel(...)`
+CI enforces this via `.semgrep/rules/security/data-imports-grpc-transport.yaml`, which bans raw `grpc.*_channel(...)`
and direct `BigQueryReadClient(...)` / `GoogleAdsClient(...)` construction inside `sources/**` (outside the
`common/grpc/` package and the two reference source files). Operators arm sample capture with
`python manage.py warehouse_sources_capture_grpc_samples enable ...`.
diff --git a/.github/scripts/check-idor-model-coverage.py b/.github/scripts/check-idor-model-coverage.py
index ab0473a48507..15311dc99e2b 100644
--- a/.github/scripts/check-idor-model-coverage.py
+++ b/.github/scripts/check-idor-model-coverage.py
@@ -628,7 +628,7 @@ def main() -> int:
code_models, excluded_models, legitimately_unscoped, needs_team_id = get_scoped_models()
# Get models from semgrep rules
- semgrep_path = REPO_ROOT / ".semgrep/rules/idor-team-scoped-models.yaml"
+ semgrep_path = REPO_ROOT / ".semgrep/rules/security/idor-team-scoped-models.yaml"
semgrep_models = parse_semgrep_models(semgrep_path)
# Compare and report
@@ -731,7 +731,7 @@ def main() -> int:
if has_errors:
print("\n❌ FAILED: Some models need attention.")
print("\nTo fix IDOR semgrep gaps:")
- print(" 1. Add the missing models to .semgrep/rules/idor-team-scoped-models.yaml")
+ print(" 1. Add the missing models to .semgrep/rules/security/idor-team-scoped-models.yaml")
print(" 2. Or add them to EXCLUDED_MODELS in this script if they don't need IDOR protection")
print(" 3. For unscoped models: add team_id, or add to LEGITIMATELY_UNSCOPED / NEEDS_TEAM_ID")
print("To fix fail-closed manager gaps:")
diff --git a/.github/workflows/ci-security.yaml b/.github/workflows/ci-security.yaml
index bef566840062..7c8994268e08 100644
--- a/.github/workflows/ci-security.yaml
+++ b/.github/workflows/ci-security.yaml
@@ -44,7 +44,7 @@ jobs:
--config "p/owasp-top-ten" \
--config "p/security-audit" \
--config "p/trailofbits" \
- --config ".semgrep/rules" \
+ --config ".semgrep/rules/security" \
--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" \
@@ -156,7 +156,7 @@ jobs:
-e SEMGREP_ENABLE_VERSION_CHECK=false \
${{ env.SEMGREP_IMAGE }} \
semgrep \
- --config ".semgrep/rules/" \
+ --config ".semgrep/rules/security" \
--config "p/javascript" \
--config "p/owasp-top-ten" \
--config "p/security-audit" \
@@ -196,7 +196,7 @@ jobs:
-e SEMGREP_ENABLE_VERSION_CHECK=false \
${{ env.SEMGREP_IMAGE }} \
semgrep \
- --config ".semgrep/rules/prefer-codegen-api.yaml" \
+ --config ".semgrep/rules/security/prefer-codegen-api.yaml" \
--error \
--metrics=off \
--verbose \
@@ -259,7 +259,7 @@ jobs:
# - WARNING-severity rules print findings without failing the job
# (used while migrating away from a pattern with a known backlog).
# - ERROR-severity rules fail the job on any finding (regression guards).
- # See `.semgrep/devex-rules/README.md`.
+ # See `.semgrep/rules/devex/README.md`.
semgrep-devex:
runs-on: ubuntu-latest
timeout-minutes: 20
@@ -288,7 +288,7 @@ jobs:
-e SEMGREP_ENABLE_VERSION_CHECK=false \
${{ env.SEMGREP_IMAGE }} \
semgrep \
- --config ".semgrep/devex-rules/" \
+ --config ".semgrep/rules/devex/" \
--severity=WARNING \
--metrics=off \
--verbose \
@@ -303,7 +303,7 @@ jobs:
-e SEMGREP_ENABLE_VERSION_CHECK=false \
${{ env.SEMGREP_IMAGE }} \
semgrep \
- --config ".semgrep/devex-rules/" \
+ --config ".semgrep/rules/devex/" \
--severity=ERROR \
--error \
--metrics=off \
diff --git a/.semgrep/devex-rules/README.md b/.semgrep/rules/devex/README.md
similarity index 93%
rename from .semgrep/devex-rules/README.md
rename to .semgrep/rules/devex/README.md
index 41d1297dd4a6..eaaea89704da 100644
--- a/.semgrep/devex-rules/README.md
+++ b/.semgrep/rules/devex/README.md
@@ -12,9 +12,9 @@ Pick the severity that matches the rule's intent:
- **ERROR** when zero violations are expected — either because the pattern is genuinely new (regression guard) or because a previously-WARNING rule has been cleaned up.
- **WARNING** when there's a known non-zero backlog that will be migrated over time.
-A WARNING rule typically gets flipped to ERROR once its backlog hits zero. The rule stays in `.semgrep/devex-rules/`; only the severity changes. To flip a rule:
+A WARNING rule typically gets flipped to ERROR once its backlog hits zero. The rule stays in `.semgrep/rules/devex/`; only the severity changes. To flip a rule:
-1. Verify locally that `semgrep --config .semgrep/devex-rules/<rule>.yaml common/ ee/ frontend/ posthog/ products/` returns zero findings.
+1. Verify locally that `semgrep --config .semgrep/rules/devex/<rule>.yaml common/ ee/ frontend/ posthog/ products/` returns zero findings.
2. Edit the rule file: change `severity: WARNING` to `severity: ERROR`.
3. Update the rule's `message:` to drop any "informational, not blocking" phrasing — it's now blocking.
diff --git a/.semgrep/devex-rules/agent-ingress-no-process-env.yaml b/.semgrep/rules/devex/agent-ingress-no-process-env.yaml
similarity index 100%
rename from .semgrep/devex-rules/agent-ingress-no-process-env.yaml
rename to .semgrep/rules/devex/agent-ingress-no-process-env.yaml
diff --git a/.semgrep/devex-rules/agent-ingress-scoped-session-fetch.yaml b/.semgrep/rules/devex/agent-ingress-scoped-session-fetch.yaml
similarity index 100%
rename from .semgrep/devex-rules/agent-ingress-scoped-session-fetch.yaml
rename to .semgrep/rules/devex/agent-ingress-scoped-session-fetch.yaml
diff --git a/.semgrep/devex-rules/agent-janitor-no-process-env.yaml b/.semgrep/rules/devex/agent-janitor-no-process-env.yaml
similarity index 100%
rename from .semgrep/devex-rules/agent-janitor-no-process-env.yaml
rename to .semgrep/rules/devex/agent-janitor-no-process-env.yaml
diff --git a/.semgrep/devex-rules/agent-runner-no-process-env.yaml b/.semgrep/rules/devex/agent-runner-no-process-env.yaml
similarity index 100%
rename from .semgrep/devex-rules/agent-runner-no-process-env.yaml
rename to .semgrep/rules/devex/agent-runner-no-process-env.yaml
diff --git a/.semgrep/devex-rules/api-response-must-match-schema.py b/.semgrep/rules/devex/api-response-must-match-schema.py
similarity index 100%
rename from .semgrep/devex-rules/api-response-must-match-schema.py
rename to .semgrep/rules/devex/api-response-must-match-schema.py
diff --git a/.semgrep/devex-rules/api-response-must-match-schema.yaml b/.semgrep/rules/devex/api-response-must-match-schema.yaml
similarity index 98%
rename from .semgrep/devex-rules/api-response-must-match-schema.yaml
rename to .semgrep/rules/devex/api-response-must-match-schema.yaml
index 089991afd44b..6cc246d7f719 100644
--- a/.semgrep/devex-rules/api-response-must-match-schema.yaml
+++ b/.semgrep/rules/devex/api-response-must-match-schema.yaml
@@ -35,7 +35,7 @@ rules:
include:
- 'products/*/backend/'
# Test fixture lives here — must be in include so `semgrep --test` exercises the rule.
- - '.semgrep/devex-rules/'
+ - '.semgrep/rules/devex/'
exclude:
- '**/tests/**'
- '**/test_*.py'
diff --git a/.semgrep/devex-rules/customer-analytics-no-raw-account-properties-write.yaml b/.semgrep/rules/devex/customer-analytics-no-raw-account-properties-write.yaml
similarity index 100%
rename from .semgrep/devex-rules/customer-analytics-no-raw-account-properties-write.yaml
rename to .semgrep/rules/devex/customer-analytics-no-raw-account-properties-write.yaml
diff --git a/.semgrep/devex-rules/env-default-belongs-in-env-development.yaml b/.semgrep/rules/devex/env-default-belongs-in-env-development.yaml
similarity index 100%
rename from .semgrep/devex-rules/env-default-belongs-in-env-development.yaml
rename to .semgrep/rules/devex/env-default-belongs-in-env-development.yaml
diff --git a/.semgrep/devex-rules/no-at-current-in-api-urls.yaml b/.semgrep/rules/devex/no-at-current-in-api-urls.yaml
similarity index 100%
rename from .semgrep/devex-rules/no-at-current-in-api-urls.yaml
rename to .semgrep/rules/devex/no-at-current-in-api-urls.yaml
diff --git a/.semgrep/devex-rules/no-environments-api-urls-frontend.yaml b/.semgrep/rules/devex/no-environments-api-urls-frontend.yaml
similarity index 100%
rename from .semgrep/devex-rules/no-environments-api-urls-frontend.yaml
rename to .semgrep/rules/devex/no-environments-api-urls-frontend.yaml
diff --git a/.semgrep/devex-rules/no-environments-router-register.yaml b/.semgrep/rules/devex/no-environments-router-register.yaml
similarity index 100%
rename from .semgrep/devex-rules/no-environments-router-register.yaml
rename to .semgrep/rules/devex/no-environments-router-register.yaml
diff --git a/.semgrep/rules/admin-modeladmin-needs-register-decorator.yaml b/.semgrep/rules/security/admin-modeladmin-needs-register-decorator.yaml
similarity index 100%
rename from .semgrep/rules/admin-modeladmin-needs-register-decorator.yaml
rename to .semgrep/rules/security/admin-modeladmin-needs-register-decorator.yaml
diff --git a/.semgrep/rules/aiohttp-missing-trust-env.py b/.semgrep/rules/security/aiohttp-missing-trust-env.py
similarity index 100%
rename from .semgrep/rules/aiohttp-missing-trust-env.py
rename to .semgrep/rules/security/aiohttp-missing-trust-env.py
diff --git a/.semgrep/rules/aiohttp-missing-trust-env.yaml b/.semgrep/rules/security/aiohttp-missing-trust-env.yaml
similarity index 100%
rename from .semgrep/rules/aiohttp-missing-trust-env.yaml
rename to .semgrep/rules/security/aiohttp-missing-trust-env.yaml
diff --git a/.semgrep/rules/celery-team-scope.yaml b/.semgrep/rules/security/celery-team-scope.yaml
similarity index 100%
rename from .semgrep/rules/celery-team-scope.yaml
rename to .semgrep/rules/security/celery-team-scope.yaml
diff --git a/.semgrep/rules/clickhouse-sql-injection.py b/.semgrep/rules/security/clickhouse-sql-injection.py
similarity index 100%
rename from .semgrep/rules/clickhouse-sql-injection.py
rename to .semgrep/rules/security/clickhouse-sql-injection.py
diff --git a/.semgrep/rules/clickhouse-sql-injection.yaml b/.semgrep/rules/security/clickhouse-sql-injection.yaml
similarity index 100%
rename from .semgrep/rules/clickhouse-sql-injection.yaml
rename to .semgrep/rules/security/clickhouse-sql-injection.yaml
diff --git a/.semgrep/rules/cross-org-bypass-user-organization.py b/.semgrep/rules/security/cross-org-bypass-user-organization.py
similarity index 100%
rename from .semgrep/rules/cross-org-bypass-user-organization.py
rename to .semgrep/rules/security/cross-org-bypass-user-organization.py
diff --git a/.semgrep/rules/cross-org-bypass-user-organization.yaml b/.semgrep/rules/security/cross-org-bypass-user-organization.yaml
similarity index 100%
rename from .semgrep/rules/cross-org-bypass-user-organization.yaml
rename to .semgrep/rules/security/cross-org-bypass-user-organization.yaml
diff --git a/.semgrep/rules/data-imports-grpc-transport.py b/.semgrep/rules/security/data-imports-grpc-transport.py
similarity index 100%
rename from .semgrep/rules/data-imports-grpc-transport.py
rename to .semgrep/rules/security/data-imports-grpc-transport.py
diff --git a/.semgrep/rules/data-imports-grpc-transport.yaml b/.semgrep/rules/security/data-imports-grpc-transport.yaml
similarity index 100%
rename from .semgrep/rules/data-imports-grpc-transport.yaml
rename to .semgrep/rules/security/data-imports-grpc-transport.yaml
diff --git a/.semgrep/rules/data-imports-http-transport.py b/.semgrep/rules/security/data-imports-http-transport.py
similarity index 100%
rename from .semgrep/rules/data-imports-http-transport.py
rename to .semgrep/rules/security/data-imports-http-transport.py
diff --git a/.semgrep/rules/data-imports-http-transport.yaml b/.semgrep/rules/security/data-imports-http-transport.yaml
similarity index 100%
rename from .semgrep/rules/data-imports-http-transport.yaml
rename to .semgrep/rules/security/data-imports-http-transport.yaml
diff --git a/.semgrep/rules/github-actions-shell-injection.test.yaml b/.semgrep/rules/security/github-actions-shell-injection.test.yaml
similarity index 100%
rename from .semgrep/rules/github-actions-shell-injection.test.yaml
rename to .semgrep/rules/security/github-actions-shell-injection.test.yaml
diff --git a/.semgrep/rules/github-actions-shell-injection.yaml b/.semgrep/rules/security/github-actions-shell-injection.yaml
similarity index 100%
rename from .semgrep/rules/github-actions-shell-injection.yaml
rename to .semgrep/rules/security/github-actions-shell-injection.yaml
diff --git a/.semgrep/rules/hogql-no-fstring.py b/.semgrep/rules/security/hogql-no-fstring.py
similarity index 100%
rename from .semgrep/rules/hogql-no-fstring.py
rename to .semgrep/rules/security/hogql-no-fstring.py
diff --git a/.semgrep/rules/hogql-no-fstring.yaml b/.semgrep/rules/security/hogql-no-fstring.yaml
similarity index 100%
rename from .semgrep/rules/hogql-no-fstring.yaml
rename to .semgrep/rules/security/hogql-no-fstring.yaml
diff --git a/.semgrep/rules/hogql-no-string-table-chain.py b/.semgrep/rules/security/hogql-no-string-table-chain.py
similarity index 100%
rename from .semgrep/rules/hogql-no-string-table-chain.py
rename to .semgrep/rules/security/hogql-no-string-table-chain.py
diff --git a/.semgrep/rules/hogql-no-string-table-chain.yaml b/.semgrep/rules/security/hogql-no-string-table-chain.yaml
similarity index 100%
rename from .semgrep/rules/hogql-no-string-table-chain.yaml
rename to .semgrep/rules/security/hogql-no-string-table-chain.yaml
diff --git a/.semgrep/rules/idor-team-scoped-models.py b/.semgrep/rules/security/idor-team-scoped-models.py
similarity index 100%
rename from .semgrep/rules/idor-team-scoped-models.py
rename to .semgrep/rules/security/idor-team-scoped-models.py
diff --git a/.semgrep/rules/idor-team-scoped-models.yaml b/.semgrep/rules/security/idor-team-scoped-models.yaml
similarity index 100%
rename from .semgrep/rules/idor-team-scoped-models.yaml
rename to .semgrep/rules/security/idor-team-scoped-models.yaml
diff --git a/.semgrep/rules/logs-alert-state-must-go-through-state-machine.yaml b/.semgrep/rules/security/logs-alert-state-must-go-through-state-machine.yaml
similarity index 100%
rename from .semgrep/rules/logs-alert-state-must-go-through-state-machine.yaml
rename to .semgrep/rules/security/logs-alert-state-must-go-through-state-machine.yaml
diff --git a/.semgrep/rules/max-tools-require-serializer.py b/.semgrep/rules/security/max-tools-require-serializer.py
similarity index 100%
rename from .semgrep/rules/max-tools-require-serializer.py
rename to .semgrep/rules/security/max-tools-require-serializer.py
diff --git a/.semgrep/rules/max-tools-require-serializer.yaml b/.semgrep/rules/security/max-tools-require-serializer.yaml
similarity index 100%
rename from .semgrep/rules/max-tools-require-serializer.yaml
rename to .semgrep/rules/security/max-tools-require-serializer.yaml
diff --git a/.semgrep/rules/no-direct-fuse-instantiation.yaml b/.semgrep/rules/security/no-direct-fuse-instantiation.yaml
similarity index 100%
rename from .semgrep/rules/no-direct-fuse-instantiation.yaml
rename to .semgrep/rules/security/no-direct-fuse-instantiation.yaml
diff --git a/.semgrep/rules/no-direct-kafka-producer.yaml b/.semgrep/rules/security/no-direct-kafka-producer.yaml
similarity index 100%
rename from .semgrep/rules/no-direct-kafka-producer.yaml
rename to .semgrep/rules/security/no-direct-kafka-producer.yaml
diff --git a/.semgrep/rules/no-direct-persons-db-orm.yaml b/.semgrep/rules/security/no-direct-persons-db-orm.yaml
similarity index 100%
rename from .semgrep/rules/no-direct-persons-db-orm.yaml
rename to .semgrep/rules/security/no-direct-persons-db-orm.yaml
diff --git a/.semgrep/rules/no-direct-streaming-http-response.py b/.semgrep/rules/security/no-direct-streaming-http-response.py
similarity index 100%
rename from .semgrep/rules/no-direct-streaming-http-response.py
rename to .semgrep/rules/security/no-direct-streaming-http-response.py
diff --git a/.semgrep/rules/no-direct-streaming-http-response.yaml b/.semgrep/rules/security/no-direct-streaming-http-response.yaml
similarity index 100%
rename from .semgrep/rules/no-direct-streaming-http-response.yaml
rename to .semgrep/rules/security/no-direct-streaming-http-response.yaml
diff --git a/.semgrep/rules/no-request-param-filter.py b/.semgrep/rules/security/no-request-param-filter.py
similarity index 100%
rename from .semgrep/rules/no-request-param-filter.py
rename to .semgrep/rules/security/no-request-param-filter.py
diff --git a/.semgrep/rules/no-request-param-filter.yaml b/.semgrep/rules/security/no-request-param-filter.yaml
similarity index 100%
rename from .semgrep/rules/no-request-param-filter.yaml
rename to .semgrep/rules/security/no-request-param-filter.yaml
diff --git a/.semgrep/rules/no-unscoped-relatedfield.py b/.semgrep/rules/security/no-unscoped-relatedfield.py
similarity index 100%
rename from .semgrep/rules/no-unscoped-relatedfield.py
rename to .semgrep/rules/security/no-unscoped-relatedfield.py
diff --git a/.semgrep/rules/no-unscoped-relatedfield.yaml b/.semgrep/rules/security/no-unscoped-relatedfield.yaml
similarity index 100%
rename from .semgrep/rules/no-unscoped-relatedfield.yaml
rename to .semgrep/rules/security/no-unscoped-relatedfield.yaml
diff --git a/.semgrep/rules/openai-hipaa-eligible-endpoints.py b/.semgrep/rules/security/openai-hipaa-eligible-endpoints.py
similarity index 100%
rename from .semgrep/rules/openai-hipaa-eligible-endpoints.py
rename to .semgrep/rules/security/openai-hipaa-eligible-endpoints.py
diff --git a/.semgrep/rules/openai-hipaa-eligible-endpoints.yaml b/.semgrep/rules/security/openai-hipaa-eligible-endpoints.yaml
similarity index 100%
rename from .semgrep/rules/openai-hipaa-eligible-endpoints.yaml
rename to .semgrep/rules/security/openai-hipaa-eligible-endpoints.yaml
diff --git a/.semgrep/rules/orm-field-injection.py b/.semgrep/rules/security/orm-field-injection.py
similarity index 100%
rename from .semgrep/rules/orm-field-injection.py
rename to .semgrep/rules/security/orm-field-injection.py
diff --git a/.semgrep/rules/orm-field-injection.yaml b/.semgrep/rules/security/orm-field-injection.yaml
similarity index 100%
rename from .semgrep/rules/orm-field-injection.yaml
rename to .semgrep/rules/security/orm-field-injection.yaml
diff --git a/.semgrep/rules/prefer-codegen-api.test.ts b/.semgrep/rules/security/prefer-codegen-api.test.ts
similarity index 100%
rename from .semgrep/rules/prefer-codegen-api.test.ts
rename to .semgrep/rules/security/prefer-codegen-api.test.ts
diff --git a/.semgrep/rules/prefer-codegen-api.yaml b/.semgrep/rules/security/prefer-codegen-api.yaml
similarity index 100%
rename from .semgrep/rules/prefer-codegen-api.yaml
rename to .semgrep/rules/security/prefer-codegen-api.yaml
diff --git a/.semgrep/rules/prefer-uuid7-django-pk.yaml b/.semgrep/rules/security/prefer-uuid7-django-pk.yaml
similarity index 100%
rename from .semgrep/rules/prefer-uuid7-django-pk.yaml
rename to .semgrep/rules/security/prefer-uuid7-django-pk.yaml
diff --git a/.semgrep/rules/require-iframe-sandbox.yaml b/.semgrep/rules/security/require-iframe-sandbox.yaml
similarity index 100%
rename from .semgrep/rules/require-iframe-sandbox.yaml
rename to .semgrep/rules/security/require-iframe-sandbox.yaml
diff --git a/.semgrep/rules/sql-injection-taint.py b/.semgrep/rules/security/sql-injection-taint.py
similarity index 100%
rename from .semgrep/rules/sql-injection-taint.py
rename to .semgrep/rules/security/sql-injection-taint.py
diff --git a/.semgrep/rules/sql-injection-taint.yaml b/.semgrep/rules/security/sql-injection-taint.yaml
similarity index 100%
rename from .semgrep/rules/sql-injection-taint.yaml
rename to .semgrep/rules/security/sql-injection-taint.yaml
diff --git a/.semgrep/rules/test-no-datetime-now.py b/.semgrep/rules/security/test-no-datetime-now.py
similarity index 100%
rename from .semgrep/rules/test-no-datetime-now.py
rename to .semgrep/rules/security/test-no-datetime-now.py
diff --git a/.semgrep/rules/test-no-datetime-now.yaml b/.semgrep/rules/security/test-no-datetime-now.yaml
similarity index 100%
rename from .semgrep/rules/test-no-datetime-now.yaml
rename to .semgrep/rules/security/test-no-datetime-now.yaml
diff --git a/.semgrep/rules/tests/celery-team-scope.py b/.semgrep/rules/security/tests/celery-team-scope.py
similarity index 100%
rename from .semgrep/rules/tests/celery-team-scope.py
rename to .semgrep/rules/security/tests/celery-team-scope.py
diff --git a/.semgrep/rules/tooltip-link-needs-doclink-or-interactive.test.tsx b/.semgrep/rules/security/tooltip-link-needs-doclink-or-interactive.test.tsx
similarity index 100%
rename from .semgrep/rules/tooltip-link-needs-doclink-or-interactive.test.tsx
rename to .semgrep/rules/security/tooltip-link-needs-doclink-or-interactive.test.tsx
diff --git a/.semgrep/rules/tooltip-link-needs-doclink-or-interactive.yaml b/.semgrep/rules/security/tooltip-link-needs-doclink-or-interactive.yaml
similarity index 100%
rename from .semgrep/rules/tooltip-link-needs-doclink-or-interactive.yaml
rename to .semgrep/rules/security/tooltip-link-needs-doclink-or-interactive.yaml
diff --git a/products/agent_platform/services/agent-ingress/src/triggers/session-access.ts b/products/agent_platform/services/agent-ingress/src/triggers/session-access.ts
index 669e4a04e8a4..1ad1886012a8 100644
--- a/products/agent_platform/services/agent-ingress/src/triggers/session-access.ts
+++ b/products/agent_platform/services/agent-ingress/src/triggers/session-access.ts
@@ -13,7 +13,7 @@
* `queue.getForApplication`, which scopes in SQL, and returns `null` on both
* "no such session" and "belongs to another agent" so callers can't
* distinguish the two (no cross-tenant existence leak). A semgrep rule
- * (`.semgrep/devex-rules/agent-ingress-scoped-session-fetch.yaml`) forbids raw
+ * (`.semgrep/rules/devex/agent-ingress-scoped-session-fetch.yaml`) forbids raw
* `queue.get(...)` elsewhere in `triggers/` so a new handler can't reintroduce
* the gap.
*/
diff --git a/products/customer_analytics/backend/test/test_views.py b/products/customer_analytics/backend/test/test_views.py
index 7415d9cb2361..fadb4140fd35 100644
--- a/products/customer_analytics/backend/test/test_views.py
+++ b/products/customer_analytics/backend/test/test_views.py
@@ -249,7 +249,7 @@ class TestCustomerJourneyViewSet(APIBaseTest):
self.assertIn("created_at", data)
self.assertIn("updated_at", data)
- journey = CustomerJourney.objects.get(id=data["id"]) # nosemgrep: semgrep.rules.idor-lookup-without-team
+ journey = CustomerJourney.objects.get(id=data["id"]) # nosemgrep: idor-lookup-without-team
self.assertEqual(journey.created_by, self.user)
self.assertEqual(journey.team, self.team)
@@ -304,7 +304,7 @@ class TestCustomerJourneyViewSet(APIBaseTest):
self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code)
self.assertFalse(
- CustomerJourney.objects.filter(id=journey_id).exists() # nosemgrep: semgrep.rules.idor-lookup-without-team
+ CustomerJourney.objects.filter(id=journey_id).exists() # nosemgrep: idor-lookup-without-team
)
@parameterized.expand(
@@ -435,7 +435,7 @@ class TestAccountViewSet(APIBaseTest):
self.assertIn("created_at", data)
self.assertIn("updated_at", data)
- account = Account.objects.unscoped().get(id=data["id"]) # nosemgrep: semgrep.rules.idor-lookup-without-team
+ account = Account.objects.unscoped().get(id=data["id"]) # nosemgrep: idor-lookup-without-team
self.assertEqual(account.created_by, self.user)
self.assertEqual(account.team, self.team)
self.assertEqual(account.properties.csm, AccountAssignment(id=self.user.id, email=self.user.email))
diff --git a/products/experiments/backend/hogql_queries/experiment_funnel_actors_query_builder.py b/products/experiments/backend/hogql_queries/experiment_funnel_actors_query_builder.py
index 04b46161a0c8..80c940f0e8c4 100644
--- a/products/experiments/backend/hogql_queries/experiment_funnel_actors_query_builder.py
+++ b/products/experiments/backend/hogql_queries/experiment_funnel_actors_query_builder.py
@@ -259,7 +259,7 @@ class ExperimentFunnelActorsQueryBuilder:
# Build the complete SELECT query
# Note: recordings_fields and temporal_filter are internally computed safe strings
- # covered by semgrep exception (see .semgrep/rules/hogql-no-fstring.yaml line 114)
+ # covered by semgrep exception (see .semgrep/rules/security/hogql-no-fstring.yaml line 114)
query = cast(
ast.SelectQuery,
parse_select(
diff --git a/products/logs/backend/alert_state_machine.py b/products/logs/backend/alert_state_machine.py
index bdfc692bbd1f..d3ad742390e1 100644
--- a/products/logs/backend/alert_state_machine.py
+++ b/products/logs/backend/alert_state_machine.py
@@ -6,7 +6,7 @@ control-plane path goes through one of the `apply_*` helpers, and every caller a
the resulting outcome via `apply_outcome`, which is the only function in the codebase
that mutates those two fields.
-The semgrep rule at `.semgrep/rules/logs-alert-state-must-go-through-state-machine.yaml`
+The semgrep rule at `.semgrep/rules/security/logs-alert-state-must-go-through-state-machine.yaml`
enforces this invariant in CI.
"""
diff --git a/products/messaging/backend/api/message_templates.py b/products/messaging/backend/api/message_templates.py
index 370a64d59c7a..4deb59ca1a0f 100644
--- a/products/messaging/backend/api/message_templates.py
+++ b/products/messaging/backend/api/message_templates.py
@@ -311,7 +311,7 @@ class MessageTemplatesViewSet(
instance = self.get_object()
with transaction.atomic():
- # nosemgrep: semgrep.rules.idor-lookup-without-team (re-fetch of already-authorized instance, locked for update)
+ # nosemgrep: idor-lookup-without-team (re-fetch of already-authorized instance, locked for update)
locked = MessageTemplate.objects.select_for_update().get(pk=instance.pk)
content = deepcopy(locked.content or {})
diff --git a/products/visual_review/backend/logic.py b/products/visual_review/backend/logic.py
index d39bfa3c3da4..e87eabf117a0 100644
--- a/products/visual_review/backend/logic.py
+++ b/products/visual_review/backend/logic.py
@@ -171,7 +171,7 @@ def get_or_create_artifact(
) -> tuple[Artifact, bool]:
# Resolve team_id from the repo when not provided by the caller.
if team_id is None:
- # nosemgrep: rules.idor-lookup-without-team — resolving team_id from repo
+ # nosemgrep: idor-lookup-without-team — resolving team_id from repo
team_id = Repo.objects.values_list("team_id", flat=True).get(id=repo_id)
return Artifact.objects.get_or_create(
@@ -228,7 +228,7 @@ def write_artifact_bytes(
# Resolve team_id from the repo when not provided by the caller.
if team_id is None:
- # nosemgrep: rules.idor-lookup-without-team — resolving team_id from repo
+ # nosemgrep: idor-lookup-without-team — resolving team_id from repo
team_id = Repo.objects.values_list("team_id", flat=True).get(id=repo_id)
artifact, _ = Artifact.objects.get_or_create(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md b/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md
index 04eb259accfe..e1a5f8687b67 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md
@@ -762,9 +762,9 @@ Update SOURCES.md whenever you:
Two semgrep rules enforce the tracked transports inside `sources/`:
-- [`data-imports-http-transport`](/.semgrep/rules/data-imports-http-transport.yaml) bans direct
+- [`data-imports-http-transport`](/.semgrep/rules/security/data-imports-http-transport.yaml) bans direct
`requests.<verb>` / `requests.Session()` / `httpx.*` — route through `make_tracked_session()`.
-- [`data-imports-grpc-transport`](/.semgrep/rules/data-imports-grpc-transport.yaml) bans raw
+- [`data-imports-grpc-transport`](/.semgrep/rules/security/data-imports-grpc-transport.yaml) bans raw
`grpc.*_channel(...)` and direct `BigQueryReadClient(...)` / `GoogleAdsClient(...)` construction —
route through `make_tracked_channel(...)` (for `channel=`/`transport=` SDKs) or
`tracked_interceptors(host)` (for `interceptors=` SDKs).
diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.py
index 25ffeebedd3b..2d9e81ac16f0 100644
--- a/products/workflows/backend/api/hog_flow.py
+++ b/products/workflows/backend/api/hog_flow.py
@@ -1412,7 +1412,7 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, vie
with transaction.atomic():
try:
- # nosemgrep: semgrep.rules.idor-lookup-without-team (re-fetch of already-authorized instance; locked for the staleness check + save)
+ # nosemgrep: idor-lookup-without-team (re-fetch of already-authorized instance; locked for the staleness check + save)
before_update = HogFlow.objects.select_for_update().get(pk=instance_id)
except HogFlow.DoesNotExist:
before_update = None
@@ -1465,7 +1465,7 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, vie
instance = self.get_object()
with transaction.atomic():
- # nosemgrep: semgrep.rules.idor-lookup-without-team (re-fetch of already-authorized instance, locked for update)
+ # nosemgrep: idor-lookup-without-team (re-fetch of already-authorized instance, locked for update)
locked = HogFlow.objects.select_for_update().get(pk=instance.pk)
if self._is_mcp_request(request) and locked.status == HogFlow.State.ACTIVE:
@@ -1481,7 +1481,7 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, vie
serializer.context["enforce_graph_structure"] = True
serializer.is_valid(raise_exception=True)
- # nosemgrep: semgrep.rules.idor-lookup-without-team (re-fetch of already-authorized instance for activity logging)
+ # nosemgrep: idor-lookup-without-team (re-fetch of already-authorized instance for activity logging)
before_update = HogFlow.objects.get(pk=instance.pk)
# save() mutates and returns `locked` in place, so it's the saved HogFlow from here on.
serializer.save()
@@ -1944,7 +1944,7 @@ class InternalHogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMi
try:
# 1. Process due schedules (next_run_at <= now)
- # nosemgrep: semgrep.rules.idor-lookup-without-team (internal endpoint processes all teams)
+ # nosemgrep: idor-lookup-without-team (internal endpoint processes all teams)
due_schedule_ids = list(
HogFlowSchedule.objects.filter(
status=HogFlowSchedule.Status.ACTIVE, next_run_at__lte=timezone.now()
@@ -1961,7 +1961,7 @@ class InternalHogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMi
# Re-checks conditions since the schedule may have been processed
# between the ID scan and this lock.
schedule = (
- # nosemgrep: semgrep.rules.idor-lookup-without-team
+ # nosemgrep: idor-lookup-without-team
HogFlowSchedule.objects.select_for_update(skip_locked=True)
.select_related("hog_flow")
.filter(
@@ -2012,7 +2012,7 @@ class InternalHogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMi
failed.append(str(schedule_id))
# 2. Initialize next_run_at for schedules that need it
- # nosemgrep: semgrep.rules.idor-lookup-without-team (internal endpoint processes all teams)
+ # nosemgrep: idor-lookup-without-team (internal endpoint processes all teams)
uninitialized_ids = list(
HogFlowSchedule.objects.filter(
status=HogFlowSchedule.Status.ACTIVE,
@@ -2030,7 +2030,7 @@ class InternalHogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMi
# Re-checks conditions since the schedule may have been initialized
# between the ID scan and this lock.
schedule = (
- # nosemgrep: semgrep.rules.idor-lookup-without-team
+ # nosemgrep: idor-lookup-without-team
HogFlowSchedule.objects.select_for_update(skip_locked=True)
.filter(id=schedule_id, status=HogFlowSchedule.Status.ACTIVE, next_run_at__isnull=True)
.first()