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): clarify where fixes belong (#114675)

Paul D'Ambra0a455d9b26f7
diff --git a/.agents/security.md b/.agents/security.md
index 918d6c348c7d..0ffec4910ea6 100644
--- a/.agents/security.md
+++ b/.agents/security.md
@@ -2,15 +2,14 @@
## Routing security fixes
-**Security fixes are developed in private, never in this public repo.**
-A public PR, branch, issue, or comment about a vulnerability discloses it before the fix is deployed.
-
-- **Where:** open the change against the private mirror **`PostHog/posthog-private`**, not `PostHog/posthog`.
-- **Branch name:** start it with **`security/`**, for example `security/idor-dashboards`.
-- **Never on `PostHog/posthog`:** no PR, branch, or issue that fixes or describes a security weakness, however small or obvious, and no test that demonstrates the exploit.
-- **What counts:** closing an access-control or IDOR gap, an injection (SQL, HogQL, command, path), SSRF, an auth, session, or token weakness, secret exposure, XSS, CSRF, an open redirect, or any change whose purpose is to close an exploitable hole.
-- **If unsure, treat it as a security fix** and route it privately.
-- **Reporting:** keep audit and review findings in the session or private channels; never paste exploit details or vulnerable paths into a public PR, issue, or comment.
+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.
+
+- **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.
+
+Follow the user's instructions about whether to create a branch, commit, push, or update a PR.
This section is about where the fix lands; the rest of this doc is about writing secure code.
diff --git a/.agents/skills/security-audit/SKILL.md b/.agents/skills/security-audit/SKILL.md
index 87d6a441efb3..9203cc34e324 100644
--- a/.agents/skills/security-audit/SKILL.md
+++ b/.agents/skills/security-audit/SKILL.md
@@ -222,8 +222,8 @@ Once the report is delivered, ask the user whether they want the findings fixed.
- Run any adjacent existing tests for the affected module to catch regressions.
- 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, file tickets, or fix in `PostHog/posthog-private` on a `security/<topic>` branch.
-A fix and its reproducer test never go to public `PostHog/posthog`; see [Routing security fixes](../../security.md#routing-security-fixes).
+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).
## Output format
diff --git a/AGENTS.md b/AGENTS.md
index ec857d854d7a..5b03cacb55f6 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -142,7 +142,7 @@ Examples:
## Security
-**Security fixes never land in this public repo.** Open them against `PostHog/posthog-private` on a `security/` branch; see [Routing security fixes](.agents/security.md#routing-security-fixes).
+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.**
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`.