fix: add FullyRedacted() for proxy passwords and MarshalForStorage() for ProxyConfig to prevent partial value leakage in API responses - #3445
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds EnvVarAsString and EnvVar.FullyRedacted; implements ProxyConfig.MarshalForStorage; simplifies NetworkConfig.MarshalJSON and ProxyConfig.Redacted to use the new helpers; wires MarshalForStorage into TableProvider.BeforeSave; and adds tests for EnvVar fully-redaction and password redaction. ChangesEnvVar Serialization for Proxy Config Persistence
Sequence DiagramsequenceDiagram
participant TableProvider as TableProvider.BeforeSave
participant ProxyConfig as ProxyConfig.MarshalForStorage
participant EnvVarAsString as EnvVarAsString
participant Storage as ProxyConfigJSON
TableProvider->>ProxyConfig: call MarshalForStorage()
ProxyConfig->>EnvVarAsString: convert URL/Username/Password/CACertPEM
EnvVarAsString-->>ProxyConfig: string values
ProxyConfig-->>Storage: JSON bytes for persistence
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
MarshalForStorage for ProxyConfig and extract EnvVarAsString helper to simplify EnvVar serialization
Confidence Score: 5/5Safe to merge — the changes are targeted security hardening with no logic regressions. The storage serialization fix (flat strings vs. structured objects in BeforeSave) and the full-opacity password redaction are both correct. EnvVarAsString is semantically equivalent to the existing driver.Valuer Value() method and matches what EnvVar.Scan() parses on load. The ShouldPreserveStored / IsRedacted round-trip for "" works because IsRedacted uses EqualFold, so the new placeholder is recognized. All edge cases (nil receiver, empty value, unresolved env var) are handled and tested. No files require special attention. Important Files Changed
Reviews (6): Last reviewed commit: "fix: consistency for the way we store en..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@core/schemas/provider.go`:
- Around line 289-303: Add a nil-receiver guard at the start of
ProxyConfig.Redacted to avoid panics when called on a nil receiver: in function
ProxyConfig.Redacted() (the method that currently dereferences pc and checks
pc.CACertPEM, pc.URL, pc.Username, pc.Password) add an early check if pc == nil
{ return nil } so the method safely returns when invoked on a nil *ProxyConfig
instead of dereferencing and panicking.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8cd3d72e-6c6d-44af-a938-1d07a00c2ddb
📒 Files selected for processing (3)
core/schemas/provider.gocore/schemas/utils.goframework/configstore/tables/provider.go
72a1761 to
4a6db3a
Compare
MarshalForStorage for ProxyConfig and extract EnvVarAsString helper to simplify EnvVar serializationFullyRedacted() for proxy passwords and MarshalForStorage() for ProxyConfig to prevent partial value leakage in API responses
The merge-base changed after approval.
4a6db3a to
8ce31f3
Compare
The merge-base changed after approval.
8ce31f3 to
630608f
Compare
The merge-base changed after approval.
630608f to
faefe20
Compare
The merge-base changed after approval.
faefe20 to
04eabd5
Compare
Merge activity
|
…()` for `ProxyConfig` to prevent partial value leakage in API responses (#3445) ## Summary Introduces a `FullyRedacted` method on `EnvVar` and a dedicated `MarshalForStorage` method on `ProxyConfig`, along with a shared `EnvVarAsString` helper, to ensure proxy secrets are never partially exposed in API responses and that `EnvVar` fields are consistently serialized as plain strings when persisting proxy configuration to the database. Previously, `json.Marshal` was used directly in the GORM `BeforeSave` hook, which would serialize `EnvVar` fields as structured objects rather than the flat string format expected in storage. Additionally, the old `Redacted()` logic on `ProxyConfig` could leak substrings of literal passwords through partial masking. ## Changes - Added `EnvVar.FullyRedacted()` which replaces any non-empty value with the fixed placeholder `<REDACTED>`, ensuring no substring of the original secret is exposed. `FromEnv` and `EnvVar` metadata are preserved so env references remain visible and round-trip update merges still match via `Equals`. - Added `EnvVarAsString` utility function that returns the wire-form string for an `*EnvVar`: the env var token if sourced from the environment, or the literal value otherwise. - Added `ProxyConfig.MarshalForStorage()` which uses `EnvVarAsString` to flatten all `EnvVar` fields into plain strings for database persistence. `json.Marshal` on `*ProxyConfig` is preserved for HTTP API responses where clients expect the full `value/env_var/from_env` object structure. - Replaced `json.Marshal(p.ProxyConfig)` with `p.ProxyConfig.MarshalForStorage()` in the GORM `BeforeSave` hook. - Simplified `ProxyConfig.Redacted()` by removing redundant `IsFromEnv()` branching. Passwords and CA certificates now use `FullyRedacted()` to guarantee full opacity, while URL and username delegate to `.Redacted()`. A nil receiver guard was also added. - Applied the same `EnvVarAsString` simplification to `NetworkConfig.MarshalJSON` for `CACertPEM`. ## Type of change - [x] Bug fix - [x] Refactor - [ ] Feature - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [x] Transports (HTTP) - [x] Providers/Integrations - [ ] Plugins - [ ] UI (React) - [ ] Docs ## How to test ```sh go test ./core/schemas/... ./framework/configstore/... ``` Verify that after saving a provider with a proxy configuration containing both literal and `env.*`-sourced fields, the stored `proxy_config_json` column contains flat strings (e.g. `"url": "http://proxy.example.com"` or `"url": "env.PROXY_URL"`) rather than structured `EnvVar` objects. Verify that the HTTP API response for the same provider still returns the full `EnvVar` object structure for proxy fields, and that the `password` field is serialized as `{"val":"<REDACTED>"}` with no substring of the original value present. ## Breaking changes - [ ] Yes - [x] No ## Related issues ## Security considerations Proxy passwords are now fully opaque in API responses regardless of whether they are literal values or environment-sourced. The old `Redacted()` path could expose a prefix of a literal password through partial masking; `FullyRedacted()` eliminates this by always substituting the fixed `<REDACTED>` placeholder. Storage serialization writes the `env.*` token rather than the resolved secret value when the field is environment-sourced, avoiding accidental secret persistence in the database. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [ ] I added/updated tests where appropriate - [ ] I updated documentation where needed - [ ] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable
## Summary This PR cuts the `v1.5.11` / `v1.3.11` release across core, framework, and all plugins, and introduces a new Claude skill (`release-checklist`) for pre-release migration safety auditing. ## Changes - **`release-checklist` skill** — Adds `.claude/skills/release-checklist/SKILL.md`, a read-only pre-release audit tool that scans Go-defined database migrations changed in a release for high-scale deadlock/lock-contention risks and boot-time-blocking operations. It produces a structured `PASS`/`WARN`/`FAIL` report with a concrete remediation plan per finding. The skill is designed to grow via an extensible Checks Registry. - **Version bumps** — `core` → `1.5.11`, `framework` → `1.3.11`, `transports` → `1.5.3`, `plugins/governance` → `1.5.11`, `plugins/logging` → `1.5.11`, `plugins/semanticcache` → `1.5.11`, `plugins/otel` → `1.2.11`, `plugins/maxim` → `1.6.11`, `plugins/prompts` → `1.0.11`, and remaining plugins bumped accordingly. - **Changelogs populated** — All per-package changelogs updated with the full set of features and fixes shipping in this release. Key highlights in this release: - Temporary access tokens for scoped, time-limited API access - MCP per-user OAuth flow refactor - Bedrock Mantle inference engine support - Azure Realtime provider with enriched session tracking - Direct access control (DAC) and virtual key rotation - Cluster-aware log metadata and per-node usage aggregation - Feature flag framework - Config-hash-based file value override of DB on restart - Semantic cache plugin rewrite - Numerous streaming stability, Bedrock, Anthropic, and Gemini fixes - AWS SDK and dependency security updates ## Type of change - [ ] Bug fix - [ ] Feature - [ ] Refactor - [ ] Documentation - [x] Chore/CI ## Affected areas - [x] Core (Go) - [x] Transports (HTTP) - [x] Providers/Integrations - [x] Plugins - [x] UI (React) - [ ] Docs ## How to test ```sh # Verify version files reflect the new release cat core/version # expect 1.5.11 cat framework/version # expect 1.3.11 cat transports/version # expect 1.5.3 # Core/Transports go test ./... ``` To exercise the new `release-checklist` skill, invoke it via Claude with: ``` /release-checklist origin/dev...HEAD ``` Expected output: a structured report with `PASS`/`WARN`/`FAIL` per check and a Remediation Plan table for any findings. ## Screenshots/Recordings N/A ## Breaking changes - [ ] Yes - [x] No ## Related issues #3603, #3565, #3489, #3334, #3335, #3435, #3554, #3590, #3444, #3198, #3581, #3610, #3599, #3567, #3382, #3461 and others listed in the changelogs. ## Security considerations - AWS SDK and dependency security updates are included (#3461). - `FullyRedacted()` for proxy passwords and `MarshalForStorage()` for `ProxyConfig` prevent partial secret leakage in API responses (#3445). - The `release-checklist` skill is strictly read-only and never modifies files. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable

Summary
Introduces a
FullyRedactedmethod onEnvVarand a dedicatedMarshalForStoragemethod onProxyConfig, along with a sharedEnvVarAsStringhelper, to ensure proxy secrets are never partially exposed in API responses and thatEnvVarfields are consistently serialized as plain strings when persisting proxy configuration to the database. Previously,json.Marshalwas used directly in the GORMBeforeSavehook, which would serializeEnvVarfields as structured objects rather than the flat string format expected in storage. Additionally, the oldRedacted()logic onProxyConfigcould leak substrings of literal passwords through partial masking.Changes
EnvVar.FullyRedacted()which replaces any non-empty value with the fixed placeholder<REDACTED>, ensuring no substring of the original secret is exposed.FromEnvandEnvVarmetadata are preserved so env references remain visible and round-trip update merges still match viaEquals.EnvVarAsStringutility function that returns the wire-form string for an*EnvVar: the env var token if sourced from the environment, or the literal value otherwise.ProxyConfig.MarshalForStorage()which usesEnvVarAsStringto flatten allEnvVarfields into plain strings for database persistence.json.Marshalon*ProxyConfigis preserved for HTTP API responses where clients expect the fullvalue/env_var/from_envobject structure.json.Marshal(p.ProxyConfig)withp.ProxyConfig.MarshalForStorage()in the GORMBeforeSavehook.ProxyConfig.Redacted()by removing redundantIsFromEnv()branching. Passwords and CA certificates now useFullyRedacted()to guarantee full opacity, while URL and username delegate to.Redacted(). A nil receiver guard was also added.EnvVarAsStringsimplification toNetworkConfig.MarshalJSONforCACertPEM.Type of change
Affected areas
How to test
go test ./core/schemas/... ./framework/configstore/...Verify that after saving a provider with a proxy configuration containing both literal and
env.*-sourced fields, the storedproxy_config_jsoncolumn contains flat strings (e.g."url": "http://proxy.example.com"or"url": "env.PROXY_URL") rather than structuredEnvVarobjects.Verify that the HTTP API response for the same provider still returns the full
EnvVarobject structure for proxy fields, and that thepasswordfield is serialized as{"val":"<REDACTED>"}with no substring of the original value present.Breaking changes
Related issues
Security considerations
Proxy passwords are now fully opaque in API responses regardless of whether they are literal values or environment-sourced. The old
Redacted()path could expose a prefix of a literal password through partial masking;FullyRedacted()eliminates this by always substituting the fixed<REDACTED>placeholder. Storage serialization writes theenv.*token rather than the resolved secret value when the field is environment-sourced, avoiding accidental secret persistence in the database.Checklist
docs/contributing/README.mdand followed the guidelines