* feat(plugins): sensitive userConfig secrets, readSecret helper, plugin secrets audit (ADR-506)
- ruflo-cost-tracker, ruflo-metaharness: `openrouterApiKey`; ruflo-x-gateway:
`adminToken`. Each is type string, sensitive, optional, no default.
- readSecret(name, envFallbacks): CLAUDE_PLUGIN_OPTION_<NAME> first, then the
variables the plugin always read. Copied per plugin (x-gateway in src/, the
only folder its Docker image ships); a test keeps the copies identical.
- Consumers: openrouter.mjs key/generation, x-gateway checkAdmin (call time,
fail closed), redblue child env (OPENROUTER_API_KEY, never argv).
- scripts/audit-plugin-secrets.mjs: credential-named option without
sensitive: true, or a literal secret (the mods' COMMON_SECRETS, parsed from
screen.ts) in plugin.json/hooks.json, fails. Wired into plugin-package-audit.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-506 status points at PR #4587
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(plugins): deliver the ADR-506 secret option, harden the plugin secrets audit
Review fixes for #4587:
- Delivery: Claude Code gives a plugin option only to the plugin's own hooks
and MCP servers, never to the Bash tool that runs openrouter.mjs and the
redblue skill path. ruflo-cost-tracker and ruflo-metaharness now carry a
SessionStart hook (scripts/_secret-env.cjs) that writes the sensitive
openrouterApiKey option to CLAUDE_ENV_FILE as OPENROUTER_API_KEY, only when
that variable is unset. Live-verified with Claude Code 2.1.289 (probe plugin
and the real cost-tracker): a Bash tool command resolved the key.
- ruflo-x-gateway adminToken removed: the gateway is a deployed server that no
Claude Code process of the plugin runs, so the option could never arrive.
- Audit: a secret used as a JSON key is shown as <redacted-key> and never
printed; .mcp.json and .lsp.json are scanned; OpenRouter key shape added;
credential-named env/headers entries holding a 16+ char literal fail;
${user_config.*} in command/headersHelper/args fails.
- ADR-506 updated with the delivery trade-off and what the bridge does not
reach (the metaharness_redblue MCP tool in ruflo-core's server).
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(plugins): skip the bash-only ADR-506 bridge tests on Windows; hedge env-file mode wording
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(plugins): cost-tracker 0.29.0, metaharness 0.3.0 for ADR-506
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>