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(security): route only embargoed fixes to posthog-private (#114658)

Georges-Antoine Assi50964529b4d6
diff --git a/.agents/security.md b/.agents/security.md
index 0ffec4910ea6..a554454e3feb 100644
--- a/.agents/security.md
+++ b/.agents/security.md
@@ -2,12 +2,25 @@
## Routing security fixes
-Choose the repository by **merge status and disclosure risk**, not by whether the code touches security. Before creating a branch or PR, check whether the affected code is already on `master` or deployed, and whether a public diff, test, or description would reveal an exploitable weakness before the fix is deployed.
+**Security fixes land in `PostHog/posthog` by default.**
+`PostHog/posthog-private` is only for severe vulnerabilities that need an embargo.
+An embargo is expensive: team-security pauses the private sync, disables the merge queue, and ships the fix through the security sync flow.
+Most security fixes do not justify that cost.
-- **Only in an open, unmerged public PR:** fix the problem in that same PR before merge, including its tests. Do not open a private PR for a weakness the public PR would introduce.
-- **Existing exploitable weakness that needs a private deployment:** develop the fix against **`PostHog/posthog-private`** on a **`security/`** branch when publishing the patch would reveal the weakness before it is fixed in production. Keep the finding, reproduction, and vulnerable paths in private channels until disclosure is approved.
-- **Safe to describe publicly:** make a routine, non-secret fix in **`PostHog/posthog`** when its code, tests, and PR text do not give someone a usable way to exploit code that is still live. A small change is not automatically safe to publish.
-- **Unsure about disclosure risk:** keep the details private and seek a security review before publishing. Do not choose the private repo solely because a change touches access control, authentication, or another security-sensitive area.
+Before you create a branch or PR, choose the route:
+
+- **The weakness exists only in an open, unmerged public PR:** fix it in that same PR before merge, including its tests. Do not open a private PR for it.
+- **Severe vulnerability that needs an embargo:** use `PostHog/posthog-private` on a `security/` branch only when team-security agrees an embargo is necessary. Severe means an attacker can exploit live code today, without special access, to do serious harm. Examples are cross-tenant data access, authentication bypass, remote code execution, or exposure of credentials or secrets. Keep the finding, reproduction, and vulnerable paths in private channels until disclosure is approved.
+- **Every other security fix:** open a normal PR in `PostHog/posthog`. This includes hardening, defense in depth, input validation, consistency fixes between code paths, access checks with low impact, issues that need privileged or same-team access, and missing rate limits.
+
+A public security fix is a normal fix with a neutral description.
+Describe what the change does, not how to exploit the old behavior.
+Leave out step-by-step reproductions, payloads, and severity ratings from the title, description, commit messages, and test names.
+
+Never create a branch, push, or open a PR in `PostHog/posthog-private` without the user's confirmation in the current conversation.
+When you ask, say why the finding looks severe enough for an embargo.
+If you are unsure whether a finding is severe enough, stop and ask the user before you push to either repo.
+Do not choose the private repo only because a change touches access control, authentication, or another security-sensitive area, or only because a branch is named `security/`.
Follow the user's instructions about whether to create a branch, commit, push, or update a PR.
diff --git a/.agents/skills/security-audit/SKILL.md b/.agents/skills/security-audit/SKILL.md
index 9203cc34e324..a460ad3060aa 100644
--- a/.agents/skills/security-audit/SKILL.md
+++ b/.agents/skills/security-audit/SKILL.md
@@ -223,7 +223,7 @@ Once the report is delivered, ask the user whether they want the findings fixed.
- Report back which findings were fixed, which tests pass, and anything that needs follow-up.
Do not start fixing without explicit approval — the user may want to triage or file tickets first.
-Route each approved fix and its reproducer test by merge status and disclosure risk. Fix a weakness introduced only by an open public PR in that PR. Keep an existing exploitable weakness private when publishing the fix would disclose it before deployment. See [Routing security fixes](../../security.md#routing-security-fixes).
+Route each approved fix and its reproducer test to `PostHog/posthog` by default. Fix a weakness introduced only by an open public PR in that PR. Use `PostHog/posthog-private` only for a critical or high finding that team-security agrees needs an embargo; medium and low findings always go public with a neutral description. See [Routing security fixes](../../security.md#routing-security-fixes).
## Output format
diff --git a/AGENTS.md b/AGENTS.md
index 5b03cacb55f6..39d5117bd40e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -142,11 +142,14 @@ Examples:
## Security
-Route security-related changes by merge status and disclosure risk: fix problems introduced by an open public PR in that PR, keep fixes that would disclose an existing exploitable weakness private until deployment, and make safe, non-secret fixes in `PostHog/posthog`. See [Routing security fixes](.agents/security.md#routing-security-fixes).
-**Every other change lands in `PostHog/posthog`, also when the session starts in a `PostHog/posthog-private` checkout.**
+**Every change lands in `PostHog/posthog`, security fixes included, also when the session starts in a `PostHog/posthog-private` checkout.**
+The only exception is a severe vulnerability that team-security agrees needs an embargo, because an embargo pauses the private sync and the merge queue.
+Never open anything in `posthog-private` without the user's confirmation in the current conversation.
+Hardening, validation, and low-impact access fixes go public with a neutral description.
+Read [Routing security fixes](.agents/security.md#routing-security-fixes) before you open a PR for any security fix: it defines "severe" and says what to leave out of a public PR.
The private mirror carries this file, and its `origin` points at the private repo, so a default push or `gh pr create` opens the PR there.
Before the first push of a branch, run `git remote get-url origin`.
-If it names `posthog-private` and the change is not a security fix, open the PR from a `PostHog/posthog` checkout.
+If it names `posthog-private` and the change is not an embargoed fix, open the PR from a `PostHog/posthog` checkout.
Do not add new `INTERNAL_API_SECRET` callers.
Read [.agents/security.md](.agents/security.md) before touching auth, secrets, service-to-service calls, raw SQL, or HogQL string building — it covers least privilege, the injection rules, and how to respond when semgrep flags your code.
`.semgrep/rules/security/` is the enforced set; run `semgrep --config .semgrep/rules/security/ .` to check a change locally.