Skip to content

feat: add Elixir framework support - #946

Merged
sarahxsanders merged 7 commits into
mainfrom
posthog-code/elixir-framework-support
Aug 21, 2026
Merged

feat: add Elixir framework support#946
sarahxsanders merged 7 commits into
mainfrom
posthog-code/elixir-framework-support

Conversation

@sarahxsanders

@sarahxsanders sarahxsanders commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Related PRs:

Adds Elixir as a supported framework, following the backend-framework pattern:

  • Integration.elixir enum entry in the frameworks block, before the language fallbacks
  • ELIXIR_AGENT_CONFIG in src/frameworks/elixir/ — claims a mix.exs with a def project definition (a stray placeholder file falls through); gathers whether the app is Phoenix (:phoenix dep) as agent context, which drives the PostHog.Integrations.Plug prompt nudge; installs by editing the mix.exs deps list then mix deps.get (Mix has no single add verb — same manual-edit framing as pip)
  • mixPackageManager helper + FRAMEWORK_REGISTRY entry
  • bash-fence allowlist for mix: deps.get|deps.update|deps.tree|compile|format|hex.info only — mix executes arbitrary project-defined tasks, so mix run/test/phx.server/ecto.* stay denied
  • Pins framework: elixir on integration-elixir in the variant-resolution contract test, matching the context-mill PR above

Why: the wizard docs page lists Elixir as "Coming soon"; instead of removing the label (posthog.com#18797), we're making the wizard actually support it.

Verification: pnpm build ✅, pnpm test ✅ (1542 tests, incl. new elixir detect + mix fence tests), pnpm fix


Created with PostHog Code

@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

@sarahxsanders
sarahxsanders force-pushed the posthog-code/go-framework-support branch from 6e5076c to 57700c0 Compare July 22, 2026 20:41
@sarahxsanders
sarahxsanders force-pushed the posthog-code/elixir-framework-support branch from 5bc160d to f14d962 Compare July 22, 2026 20:41
@sarahxsanders
sarahxsanders changed the base branch from posthog-code/go-framework-support to main July 22, 2026 20:42
Adds Elixir as a supported framework, stacked on the Go framework PR:

- Integration.elixir enum entry in the frameworks block, before the language fallbacks
- ELIXIR_AGENT_CONFIG in src/frameworks/elixir/ — claims a mix.exs with a def project definition, gathers whether the app is Phoenix (:phoenix dep) as agent context for the Plug integration nudge, installs by editing mix.exs deps then mix deps.get (Mix has no single add command)
- mixPackageManager helper + FRAMEWORK_REGISTRY entry
- bash-fence allowlist for mix: deps.get/deps.update/deps.tree/compile/format/hex.info only — mix runs arbitrary project-defined tasks, so run/test/phx.server/ecto.* stay denied
- Pins framework: elixir on integration-elixir in the variant-resolution contract test, matching context-mill PR #268 which must release before this merges
- Marks mix.exs as a real framework target in the agentic manifest comment

Generated-By: PostHog Code
Task-Id: 9c949855-7611-48f2-b8b5-7aa4112543e5
The comment implied only run/test/phx.server execute code. mix compile also
runs code (compile-time macros); it is permitted under the "builds are
equivalent risk" model, not because it is code-free. Clarify.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sarahxsanders
sarahxsanders marked this pull request as ready for review July 24, 2026 15:16
@sarahxsanders
sarahxsanders requested a review from a team as a code owner July 24, 2026 15:16
Additive conflicts against the Flutter work: both language helpers kept.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
// under the "builds are equivalent risk" model in the file header; run/test/
// phx.server are denied so app code, tests, and servers aren't run.
mix: [
'deps.get',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High: Repository-defined Mix aliases bypass the command fence

A repository can override deps.get or any other allowed task with a Mix alias that invokes an Elixir function, script, or shell command. When the agent follows the Elixir installation prompt and runs mix deps.get, attacker-controlled code from mix.exs executes outside an OS sandbox; avoid enabling Mix in the pi harness until it can run inside a filesystem and network sandbox, rather than relying on task-name allowlisting. (hexdocs.pm)

@veria-ai

veria-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

PR overview

This pull request adds Elixir project support by permitting selected Mix dependency and formatting commands through the agent’s command fence.

Two security issues remain open, and none have yet been addressed. An attacker-controlled repository can redefine an allowed Mix task to execute arbitrary code outside an OS sandbox, while unrestricted formatting paths can modify Elixir files outside the intended workspace. The Mix integration should remain disabled or be sandboxed and constrained before release.

Open issues (2)

Fixed/addressed: 0 · PR risk: 8/10

@gewenyu99

Copy link
Copy Markdown
Collaborator

Full e2e run of this PR pair (wizard #946 + context-mill #268, both with main merged in) against teslamate-org/teslamate.

Set up, best self-verification of the four languagesmix compile and format checks ran inside the fence and passed; only credo --strict was allowlist-blocked. {:posthog, "~> 2.0"} added, config via runtime.exs env vars, captures on real domain events (charging_cost_saved, geofence_created, logging_resumed/suspended).

Dashboard and notebook created through prod MCP. Independently re-verified: mix compile exits clean on the produced tree.

Note: the context-mill branch as filed fails at the dashboard step — its agent prompts predate the posthog_exec tool grant on main; works once main is merged (currently blocked on unsigned commits).

All 25 TUI frames 01-intro.png 02-auth.png 03-run.png 04-run.png 05-run.png 06-run.png 07-run.png 08-run.png 09-run.png 10-run.png 11-run.png 12-run.png 13-run.png 14-run.png 15-run.png 16-run.png 17-run.png 18-run.png 19-run.png 20-run.png 21-outro.png 22-outro.png 23-mcp.png 24-slack-connect.png 25-keep-skills.png

gewenyu99 and others added 4 commits August 20, 2026 18:49
The result JSON parsed package.json and pubspec.yaml only, so Go, Rust, Java,
and Elixir runs reported hasPosthogDep false; a *.env file like gotify's also
failed the .env prefix check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…sitive

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Elixir and Go framework support landed in parallel, so every conflict was
two frameworks claiming the same list. Kept both sides throughout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
'deps.update',
'deps.tree',
'compile',
'format',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: Mix formatting escapes the workspace

Once the first argument is format, the fence accepts every trailing path. A prompt-injected repository can make the pi agent run mix format ../sibling/lib/victim.ex, causing Mix to rewrite an Elixir file outside installDir. Remove format from this allowlist, or enforce that every format target resolves inside the working directory before execution.

@sarahxsanders
sarahxsanders merged commit b8b8aa6 into main Aug 21, 2026
17 checks passed
@sarahxsanders
sarahxsanders deleted the posthog-code/elixir-framework-support branch August 21, 2026 14:26
sarahxsanders added a commit that referenced this pull request Aug 21, 2026
Elixir support (#946) landed on main, so the conflicts were rust and elixir
claiming the same lists. Kept both sides throughout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sarahxsanders added a commit that referenced this pull request Aug 21, 2026
Elixir support (#946) landed on main, so the conflicts were java and elixir
claiming the same lists. Kept both sides throughout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants