Add wizard-owned L2 ruleset for PostHog config defaults (autocapture / session recording / opt-out)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 197
- Forks
- 51
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 94
Description
Why
The legacy wizard-side regex scanner (`yara-scanner.ts`, removed in the warlock-migration PR) had three medium-severity rules under the `posthog_config` and `posthog_autocapture` categories:
- `autocapture: false` (init config)
- `disable_session_recording: true` (init config)
- `opt_out_capturing: true` / `opted_out: true` (init config)
These rules fired on PostToolUse Write/Edit and reverted the write — the L2 enforcement layer for "don't silently disable the user's analytics."
These rules don't belong in warlock. Warlock is a platform-agnostic security engine; PostHog-specific config enforcement is a consumer's own ruleset, not the engine's concern. (See warlock's design discipline.)
The L0 backstop (the agent commandment "Keep PostHog data capture at its defaults...") has been restored in the warlock-migration PR. But L0 alone isn't enough — defense in depth requires both layers.
What needs to happen
The wizard should ship its own L2 ruleset for these PostHog-specific config patterns, layered on top of warlock's platform-agnostic engine. Options:
Option A — Inline wizard rules: Add a small wizard-owned rule set in the wizard repo (or in context-mill as a skill that the wizard loads) that the hook layer consults alongside warlock's matches. Same fail-closed semantics, same triage path.
Option B — Companion package: Ship `@posthog/wizard-rules` (or extend an existing package) with PostHog-specific YARA rules that the wizard imports and feeds to warlock's scan engine as additional rules. Warlock supports consumer-supplied rules.
Option C — context-mill skill: Bundle the rules as a context-mill skill the wizard loads at install time. Most consistent with the "skills own product knowledge" model.
Suggested patterns to cover
```
autocapture\s*[:=]\s*(false|False|0|'false'|"false")
disable_session_recording\s*[:=]\s*(true|True|1)
opt_out_capturing\s*[:=]\s*(true|True|1)
opted_out\s*[:=]\s*(true|True|1)
```
Severity: medium. Action: remediate (revert). Scan context: output.
Note: `posthog.opt_out_capturing()` called at runtime (for GDPR consent flows) is legitimate and must NOT match — only the init-config form should fire. The old regex carefully scoped to `[:=]` assignment to avoid the method-call case.
Related
- Companion concern: file a context-mill issue if Option C is the chosen path.
🤖 Generated with Claude Code
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the removed yara-scanner.ts behavior and the warlock-migration changes, then determine where the wizard hook layer can load consumer-supplied rules. Choose and document one of the proposed ownership options, preserving fail-closed remediation for the listed init-config patterns while excluding runtime posthog.opt_out_capturing() calls. Done means the wizard ships and consults the PostHog-specific L2 rules alongside warlock.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100