: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(semgrep): group rules into security/ and devex/ subfolders (#68086)
Rafael Audibert682035b293fa
diff --git a/.agents/security.md b/.agents/security.mdindex 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.mdindex 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.pyindex 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.yamlindex 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-latesttimeout-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.mdsimilarity index 93%rename from .semgrep/devex-rules/README.mdrename to .semgrep/rules/devex/README.mdindex 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.yamlsimilarity index 100%rename from .semgrep/devex-rules/agent-ingress-no-process-env.yamlrename to .semgrep/rules/devex/agent-ingress-no-process-env.yamldiff --git a/.semgrep/devex-rules/agent-ingress-scoped-session-fetch.yaml b/.semgrep/rules/devex/agent-ingress-scoped-session-fetch.yamlsimilarity index 100%rename from .semgrep/devex-rules/agent-ingress-scoped-session-fetch.yamlrename to .semgrep/rules/devex/agent-ingress-scoped-session-fetch.yamldiff --git a/.semgrep/devex-rules/agent-janitor-no-process-env.yaml b/.semgrep/rules/devex/agent-janitor-no-process-env.yamlsimilarity index 100%rename from .semgrep/devex-rules/agent-janitor-no-process-env.yamlrename to .semgrep/rules/devex/agent-janitor-no-process-env.yamldiff --git a/.semgrep/devex-rules/agent-runner-no-process-env.yaml b/.semgrep/rules/devex/agent-runner-no-process-env.yamlsimilarity index 100%rename from .semgrep/devex-rules/agent-runner-no-process-env.yamlrename to .semgrep/rules/devex/agent-runner-no-process-env.yamldiff --git a/.semgrep/devex-rules/api-response-must-match-schema.py b/.semgrep/rules/devex/api-response-must-match-schema.pysimilarity index 100%rename from .semgrep/devex-rules/api-response-must-match-schema.pyrename to .semgrep/rules/devex/api-response-must-match-schema.pydiff --git a/.semgrep/devex-rules/api-response-must-match-schema.yaml b/.semgrep/rules/devex/api-response-must-match-schema.yamlsimilarity index 98%rename from .semgrep/devex-rules/api-response-must-match-schema.yamlrename to .semgrep/rules/devex/api-response-must-match-schema.yamlindex 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.yamlsimilarity index 100%rename from .semgrep/devex-rules/customer-analytics-no-raw-account-properties-write.yamlrename to .semgrep/rules/devex/customer-analytics-no-raw-account-properties-write.yamldiff --git a/.semgrep/devex-rules/env-default-belongs-in-env-development.yaml b/.semgrep/rules/devex/env-default-belongs-in-env-development.yamlsimilarity index 100%rename from .semgrep/devex-rules/env-default-belongs-in-env-development.yamlrename to .semgrep/rules/devex/env-default-belongs-in-env-development.yamldiff --git a/.semgrep/devex-rules/no-at-current-in-api-urls.yaml b/.semgrep/rules/devex/no-at-current-in-api-urls.yamlsimilarity index 100%rename from .semgrep/devex-rules/no-at-current-in-api-urls.yamlrename to .semgrep/rules/devex/no-at-current-in-api-urls.yamldiff --git a/.semgrep/devex-rules/no-environments-api-urls-frontend.yaml b/.semgrep/rules/devex/no-environments-api-urls-frontend.yamlsimilarity index 100%rename from .semgrep/devex-rules/no-environments-api-urls-frontend.yamlrename to .semgrep/rules/devex/no-environments-api-urls-frontend.yamldiff --git a/.semgrep/devex-rules/no-environments-router-register.yaml b/.semgrep/rules/devex/no-environments-router-register.yamlsimilarity index 100%rename from .semgrep/devex-rules/no-environments-router-register.yamlrename to .semgrep/rules/devex/no-environments-router-register.yamldiff --git a/.semgrep/rules/admin-modeladmin-needs-register-decorator.yaml b/.semgrep/rules/security/admin-modeladmin-needs-register-decorator.yamlsimilarity index 100%rename from .semgrep/rules/admin-modeladmin-needs-register-decorator.yamlrename to .semgrep/rules/security/admin-modeladmin-needs-register-decorator.yamldiff --git a/.semgrep/rules/aiohttp-missing-trust-env.py b/.semgrep/rules/security/aiohttp-missing-trust-env.pysimilarity index 100%rename from .semgrep/rules/aiohttp-missing-trust-env.pyrename to .semgrep/rules/security/aiohttp-missing-trust-env.pydiff --git a/.semgrep/rules/aiohttp-missing-trust-env.yaml b/.semgrep/rules/security/aiohttp-missing-trust-env.yamlsimilarity index 100%rename from .semgrep/rules/aiohttp-missing-trust-env.yamlrename to .semgrep/rules/security/aiohttp-missing-trust-env.yamldiff --git a/.semgrep/rules/celery-team-scope.yaml b/.semgrep/rules/security/celery-team-scope.yamlsimilarity index 100%rename from .semgrep/rules/celery-team-scope.yamlrename to .semgrep/rules/security/celery-team-scope.yamldiff --git a/.semgrep/rules/clickhouse-sql-injection.py b/.semgrep/rules/security/clickhouse-sql-injection.pysimilarity index 100%rename from .semgrep/rules/clickhouse-sql-injection.pyrename to .semgrep/rules/security/clickhouse-sql-injection.pydiff --git a/.semgrep/rules/clickhouse-sql-injection.yaml b/.semgrep/rules/security/clickhouse-sql-injection.yamlsimilarity index 100%rename from .semgrep/rules/clickhouse-sql-injection.yamlrename to .semgrep/rules/security/clickhouse-sql-injection.yamldiff --git a/.semgrep/rules/cross-org-bypass-user-organization.py b/.semgrep/rules/security/cross-org-bypass-user-organization.pysimilarity index 100%rename from .semgrep/rules/cross-org-bypass-user-organization.pyrename to .semgrep/rules/security/cross-org-bypass-user-organization.pydiff --git a/.semgrep/rules/cross-org-bypass-user-organization.yaml b/.semgrep/rules/security/cross-org-bypass-user-organization.yamlsimilarity index 100%rename from .semgrep/rules/cross-org-bypass-user-organization.yamlrename to .semgrep/rules/security/cross-org-bypass-user-organization.yamldiff --git a/.semgrep/rules/data-imports-grpc-transport.py b/.semgrep/rules/security/data-imports-grpc-transport.pysimilarity index 100%rename from .semgrep/rules/data-imports-grpc-transport.pyrename to .semgrep/rules/security/data-imports-grpc-transport.pydiff --git a/.semgrep/rules/data-imports-grpc-transport.yaml b/.semgrep/rules/security/data-imports-grpc-transport.yamlsimilarity index 100%rename from .semgrep/rules/data-imports-grpc-transport.yamlrename to .semgrep/rules/security/data-imports-grpc-transport.yamldiff --git a/.semgrep/rules/data-imports-http-transport.py b/.semgrep/rules/security/data-imports-http-transport.pysimilarity index 100%rename from .semgrep/rules/data-imports-http-transport.pyrename to .semgrep/rules/security/data-imports-http-transport.pydiff --git a/.semgrep/rules/data-imports-http-transport.yaml b/.semgrep/rules/security/data-imports-http-transport.yamlsimilarity index 100%rename from .semgrep/rules/data-imports-http-transport.yamlrename to .semgrep/rules/security/data-imports-http-transport.yamldiff --git a/.semgrep/rules/github-actions-shell-injection.test.yaml b/.semgrep/rules/security/github-actions-shell-injection.test.yamlsimilarity index 100%rename from .semgrep/rules/github-actions-shell-injection.test.yamlrename to .semgrep/rules/security/github-actions-shell-injection.test.yamldiff --git a/.semgrep/rules/github-actions-shell-injection.yaml b/.semgrep/rules/security/github-actions-shell-injection.yamlsimilarity index 100%rename from .semgrep/rules/github-actions-shell-injection.yamlrename to .semgrep/rules/security/github-actions-shell-injection.yamldiff --git a/.semgrep/rules/hogql-no-fstring.py b/.semgrep/rules/security/hogql-no-fstring.pysimilarity index 100%rename from .semgrep/rules/hogql-no-fstring.pyrename to .semgrep/rules/security/hogql-no-fstring.pydiff --git a/.semgrep/rules/hogql-no-fstring.yaml b/.semgrep/rules/security/hogql-no-fstring.yamlsimilarity index 100%rename from .semgrep/rules/hogql-no-fstring.yamlrename to .semgrep/rules/security/hogql-no-fstring.yamldiff --git a/.semgrep/rules/hogql-no-string-table-chain.py b/.semgrep/rules/security/hogql-no-string-table-chain.pysimilarity index 100%rename from .semgrep/rules/hogql-no-string-table-chain.pyrename to .semgrep/rules/security/hogql-no-string-table-chain.pydiff --git a/.semgrep/rules/hogql-no-string-table-chain.yaml b/.semgrep/rules/security/hogql-no-string-table-chain.yamlsimilarity index 100%rename from .semgrep/rules/hogql-no-string-table-chain.yamlrename to .semgrep/rules/security/hogql-no-string-table-chain.yamldiff --git a/.semgrep/rules/idor-team-scoped-models.py b/.semgrep/rules/security/idor-team-scoped-models.pysimilarity index 100%rename from .semgrep/rules/idor-team-scoped-models.pyrename to .semgrep/rules/security/idor-team-scoped-models.pydiff --git a/.semgrep/rules/idor-team-scoped-models.yaml b/.semgrep/rules/security/idor-team-scoped-models.yamlsimilarity index 100%rename from .semgrep/rules/idor-team-scoped-models.yamlrename to .semgrep/rules/security/idor-team-scoped-models.yamldiff --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.yamlsimilarity index 100%rename from .semgrep/rules/logs-alert-state-must-go-through-state-machine.yamlrename to .semgrep/rules/security/logs-alert-state-must-go-through-state-machine.yamldiff --git a/.semgrep/rules/max-tools-require-serializer.py b/.semgrep/rules/security/max-tools-require-serializer.pysimilarity index 100%rename from .semgrep/rules/max-tools-require-serializer.pyrename to .semgrep/rules/security/max-tools-require-serializer.pydiff --git a/.semgrep/rules/max-tools-require-serializer.yaml b/.semgrep/rules/security/max-tools-require-serializer.yamlsimilarity index 100%rename from .semgrep/rules/max-tools-require-serializer.yamlrename to .semgrep/rules/security/max-tools-require-serializer.yamldiff --git a/.semgrep/rules/no-direct-fuse-instantiation.yaml b/.semgrep/rules/security/no-direct-fuse-instantiation.yamlsimilarity index 100%rename from .semgrep/rules/no-direct-fuse-instantiation.yamlrename to .semgrep/rules/security/no-direct-fuse-instantiation.yamldiff --git a/.semgrep/rules/no-direct-kafka-producer.yaml b/.semgrep/rules/security/no-direct-kafka-producer.yamlsimilarity index 100%rename from .semgrep/rules/no-direct-kafka-producer.yamlrename to .semgrep/rules/security/no-direct-kafka-producer.yamldiff --git a/.semgrep/rules/no-direct-persons-db-orm.yaml b/.semgrep/rules/security/no-direct-persons-db-orm.yamlsimilarity index 100%rename from .semgrep/rules/no-direct-persons-db-orm.yamlrename to .semgrep/rules/security/no-direct-persons-db-orm.yamldiff --git a/.semgrep/rules/no-direct-streaming-http-response.py b/.semgrep/rules/security/no-direct-streaming-http-response.pysimilarity index 100%rename from .semgrep/rules/no-direct-streaming-http-response.pyrename to .semgrep/rules/security/no-direct-streaming-http-response.pydiff --git a/.semgrep/rules/no-direct-streaming-http-response.yaml b/.semgrep/rules/security/no-direct-streaming-http-response.yamlsimilarity index 100%rename from .semgrep/rules/no-direct-streaming-http-response.yamlrename to .semgrep/rules/security/no-direct-streaming-http-response.yamldiff --git a/.semgrep/rules/no-request-param-filter.py b/.semgrep/rules/security/no-request-param-filter.pysimilarity index 100%rename from .semgrep/rules/no-request-param-filter.pyrename to .semgrep/rules/security/no-request-param-filter.pydiff --git a/.semgrep/rules/no-request-param-filter.yaml b/.semgrep/rules/security/no-request-param-filter.yamlsimilarity index 100%rename from .semgrep/rules/no-request-param-filter.yamlrename to .semgrep/rules/security/no-request-param-filter.yamldiff --git a/.semgrep/rules/no-unscoped-relatedfield.py b/.semgrep/rules/security/no-unscoped-relatedfield.pysimilarity index 100%rename from .semgrep/rules/no-unscoped-relatedfield.pyrename to .semgrep/rules/security/no-unscoped-relatedfield.pydiff --git a/.semgrep/rules/no-unscoped-relatedfield.yaml b/.semgrep/rules/security/no-unscoped-relatedfield.yamlsimilarity index 100%rename from .semgrep/rules/no-unscoped-relatedfield.yamlrename to .semgrep/rules/security/no-unscoped-relatedfield.yamldiff --git a/.semgrep/rules/openai-hipaa-eligible-endpoints.py b/.semgrep/rules/security/openai-hipaa-eligible-endpoints.pysimilarity index 100%rename from .semgrep/rules/openai-hipaa-eligible-endpoints.pyrename to .semgrep/rules/security/openai-hipaa-eligible-endpoints.pydiff --git a/.semgrep/rules/openai-hipaa-eligible-endpoints.yaml b/.semgrep/rules/security/openai-hipaa-eligible-endpoints.yamlsimilarity index 100%rename from .semgrep/rules/openai-hipaa-eligible-endpoints.yamlrename to .semgrep/rules/security/openai-hipaa-eligible-endpoints.yamldiff --git a/.semgrep/rules/orm-field-injection.py b/.semgrep/rules/security/orm-field-injection.pysimilarity index 100%rename from .semgrep/rules/orm-field-injection.pyrename to .semgrep/rules/security/orm-field-injection.pydiff --git a/.semgrep/rules/orm-field-injection.yaml b/.semgrep/rules/security/orm-field-injection.yamlsimilarity index 100%rename from .semgrep/rules/orm-field-injection.yamlrename to .semgrep/rules/security/orm-field-injection.yamldiff --git a/.semgrep/rules/prefer-codegen-api.test.ts b/.semgrep/rules/security/prefer-codegen-api.test.tssimilarity index 100%rename from .semgrep/rules/prefer-codegen-api.test.tsrename to .semgrep/rules/security/prefer-codegen-api.test.tsdiff --git a/.semgrep/rules/prefer-codegen-api.yaml b/.semgrep/rules/security/prefer-codegen-api.yamlsimilarity index 100%rename from .semgrep/rules/prefer-codegen-api.yamlrename to .semgrep/rules/security/prefer-codegen-api.yamldiff --git a/.semgrep/rules/prefer-uuid7-django-pk.yaml b/.semgrep/rules/security/prefer-uuid7-django-pk.yamlsimilarity index 100%rename from .semgrep/rules/prefer-uuid7-django-pk.yamlrename to .semgrep/rules/security/prefer-uuid7-django-pk.yamldiff --git a/.semgrep/rules/require-iframe-sandbox.yaml b/.semgrep/rules/security/require-iframe-sandbox.yamlsimilarity index 100%rename from .semgrep/rules/require-iframe-sandbox.yamlrename to .semgrep/rules/security/require-iframe-sandbox.yamldiff --git a/.semgrep/rules/sql-injection-taint.py b/.semgrep/rules/security/sql-injection-taint.pysimilarity index 100%rename from .semgrep/rules/sql-injection-taint.pyrename to .semgrep/rules/security/sql-injection-taint.pydiff --git a/.semgrep/rules/sql-injection-taint.yaml b/.semgrep/rules/security/sql-injection-taint.yamlsimilarity index 100%rename from .semgrep/rules/sql-injection-taint.yamlrename to .semgrep/rules/security/sql-injection-taint.yamldiff --git a/.semgrep/rules/test-no-datetime-now.py b/.semgrep/rules/security/test-no-datetime-now.pysimilarity index 100%rename from .semgrep/rules/test-no-datetime-now.pyrename to .semgrep/rules/security/test-no-datetime-now.pydiff --git a/.semgrep/rules/test-no-datetime-now.yaml b/.semgrep/rules/security/test-no-datetime-now.yamlsimilarity index 100%rename from .semgrep/rules/test-no-datetime-now.yamlrename to .semgrep/rules/security/test-no-datetime-now.yamldiff --git a/.semgrep/rules/tests/celery-team-scope.py b/.semgrep/rules/security/tests/celery-team-scope.pysimilarity index 100%rename from .semgrep/rules/tests/celery-team-scope.pyrename to .semgrep/rules/security/tests/celery-team-scope.pydiff --git a/.semgrep/rules/tooltip-link-needs-doclink-or-interactive.test.tsx b/.semgrep/rules/security/tooltip-link-needs-doclink-or-interactive.test.tsxsimilarity index 100%rename from .semgrep/rules/tooltip-link-needs-doclink-or-interactive.test.tsxrename to .semgrep/rules/security/tooltip-link-needs-doclink-or-interactive.test.tsxdiff --git a/.semgrep/rules/tooltip-link-needs-doclink-or-interactive.yaml b/.semgrep/rules/security/tooltip-link-needs-doclink-or-interactive.yamlsimilarity index 100%rename from .semgrep/rules/tooltip-link-needs-doclink-or-interactive.yamlrename to .semgrep/rules/security/tooltip-link-needs-doclink-or-interactive.yamldiff --git a/products/agent_platform/services/agent-ingress/src/triggers/session-access.ts b/products/agent_platform/services/agent-ingress/src/triggers/session-access.tsindex 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.pyindex 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-teamself.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-teamself.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.pyindex 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.pyindex 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 athe resulting outcome via `apply_outcome`, which is the only function in the codebasethat 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.pyindex 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.pyindex 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 repoteam_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 repoteam_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.mdindex 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.pyindex 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, viewith 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, vieinstance = 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, vieserializer.context["enforce_graph_structure"] = Trueserializer.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, AppMetricsMitry:# 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-teamHogFlowSchedule.objects.select_for_update(skip_locked=True).select_related("hog_flow").filter(@@ -2012,7 +2012,7 @@ class InternalHogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMifailed.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-teamHogFlowSchedule.objects.select_for_update(skip_locked=True).filter(id=schedule_id, status=HogFlowSchedule.Status.ACTIVE, next_run_at__isnull=True).first()