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 (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdded EnvVar.MarshalJSON to emit a redacted Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ca3b8b7 to
b02ecee
Compare
61d2f30 to
890c519
Compare
890c519 to
f9ed215
Compare
a1fc8b1 to
47c6f82
Compare
f9ed215 to
3904313
Compare
Confidence Score: 5/5Safe to merge — the change is a well-scoped, idempotent security hardening with thorough tests and no impact on persistence or inference paths. No P0 or P1 findings. The MarshalJSON implementation is correct (value receiver, envVarAlias recursion guard, scoped to JSON serialization only). Double-masking via ProviderConfig.Redacted() + MarshalJSON is idempotent and harmless. Tests cover all key paths including mutation safety. No files require special attention.
|
| Filename | Overview |
|---|---|
| core/schemas/envvar.go | Added MarshalJSON (value receiver) that auto-redacts env-backed EnvVar during JSON serialization; uses envVarAlias to avoid infinite recursion in sonic.Marshal; does not affect GORM Value() or GetValue() paths |
| framework/configstore/clientconfig_redaction_test.go | New test file covering: env-backed auto-masking, plain-value passthrough, Vertex field masking, no-mutation guarantee, and a full multi-provider smoke test for zero leaked secrets |
Reviews (11): Last reviewed commit: "fix: prevent env var secret leakage in A..." | Re-trigger Greptile
3904313 to
f89cd87
Compare
47c6f82 to
8882712
Compare
f89cd87 to
c662e1e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
core/schemas/envvar.go (1)
170-170: Simplify(&e).Redacted()toe.Redacted().In Go, when calling a method with a pointer receiver on an addressable value, the compiler automatically takes the address. Since
eis a function parameter (addressable), the explicit(&e)is unnecessary.✨ Suggested simplification
if e.FromEnv { // Redact the resolved value but keep the env var reference and from_env flag // so the UI still knows which env var backs this field. - redacted := (&e).Redacted() + redacted := e.Redacted() if redacted != nil { out = envVarAlias(*redacted) } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@core/schemas/envvar.go` at line 170, The call uses an unnecessary explicit address operator; replace (&e).Redacted() with e.Redacted() because the parameter e is addressable and the compiler will automatically take its address for a pointer-receiver method; update the invocation in the function where redacted := (&e).Redacted() appears to use redacted := e.Redacted() referencing the Redacted method on the env var type.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@core/schemas/envvar.go`:
- Line 175: Replace the direct call to sonic.Marshal in the custom MarshalJSON
implementation with the project wrapper MarshalSorted to preserve WASM/native
compatibility (i.e., change the return from sonic.Marshal(out) to
MarshalSorted(out)); also simplify the Redacted invocation by calling
e.Redacted() instead of (&e).Redacted() since Go will auto-address for
pointer-receiver methods—update the MarshalJSON (and any nearby uses)
accordingly.
---
Nitpick comments:
In `@core/schemas/envvar.go`:
- Line 170: The call uses an unnecessary explicit address operator; replace
(&e).Redacted() with e.Redacted() because the parameter e is addressable and the
compiler will automatically take its address for a pointer-receiver method;
update the invocation in the function where redacted := (&e).Redacted() appears
to use redacted := e.Redacted() referencing the Redacted method on the env var
type.
🪄 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: 48c94cae-a136-48ed-8763-f2a605b8aad9
📒 Files selected for processing (2)
core/schemas/envvar.goframework/configstore/clientconfig_redaction_test.go
✅ Files skipped from review due to trivial changes (1)
- framework/configstore/clientconfig_redaction_test.go
c662e1e to
548ec55
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
core/schemas/envvar.go (1)
175-175:⚠️ Potential issue | 🟠 MajorUse the
core/schemasmarshal wrapper inMarshalJSON(Line 175).Direct
sonic.Marshalhere bypasses the package abstraction expected for custom marshalers in this package and can diverge from platform-specific behavior in the stack.Suggested fix
- return sonic.Marshal(out) + return MarshalSorted(out)Based on learnings: In
core/schemas, customMarshalJSONmethods should use the package marshal wrapper (and prior stack feedback for this exact line requiredMarshalSortedfor compatibility).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@core/schemas/envvar.go` at line 175, The MarshalJSON method is calling sonic.Marshal(out) directly; replace that call with the core/schemas package marshal wrapper (use the package's MarshalSorted wrapper used across this package) so the EnvVar.MarshalJSON method uses schemas.MarshalSorted(out) (or the package's exported marshal helper) instead of sonic.Marshal to preserve platform-specific ordering/behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@core/schemas/envvar.go`:
- Line 175: The MarshalJSON method is calling sonic.Marshal(out) directly;
replace that call with the core/schemas package marshal wrapper (use the
package's MarshalSorted wrapper used across this package) so the
EnvVar.MarshalJSON method uses schemas.MarshalSorted(out) (or the package's
exported marshal helper) instead of sonic.Marshal to preserve platform-specific
ordering/behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dfede440-09e2-4599-ab74-dd59e5ca4eeb
📒 Files selected for processing (2)
core/schemas/envvar.goframework/configstore/clientconfig_redaction_test.go
✅ Files skipped from review due to trivial changes (1)
- framework/configstore/clientconfig_redaction_test.go
8882712 to
2c660e6
Compare
1f09dc1 to
d60aba7
Compare
2c660e6 to
bf47ff7
Compare
d60aba7 to
937c66f
Compare
bf47ff7 to
20058ea
Compare
20058ea to
bf2c06c
Compare
937c66f to
38d9f8b
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
framework/configstore/clientconfig_redaction_test.go (1)
173-174: Use a non-AWS-shaped fixture value to avoid secret-scanner false positives.Line 173 uses an
AKIA...-shaped token, which can trigger automated secret scanning noise even in tests.Proposed fixture-safe diff
- t.Setenv("LEAK_TEST_BEDROCK_ACCESS", "AKIAIOSFODNN7LEAKED1") + t.Setenv("LEAK_TEST_BEDROCK_ACCESS", "aws-access-key-redaction-fixture") ... - "AKIAIOSFODNN7LEAKED1", + "aws-access-key-redaction-fixture",Also applies to: 222-223
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@framework/configstore/clientconfig_redaction_test.go` around lines 173 - 174, The test uses an AWS-shaped fixture "AKIA..." which can trigger secret scanners; update the t.Setenv calls in clientconfig_redaction_test.go (the t.Setenv("LEAK_TEST_BEDROCK_ACCESS", ...) and any other occurrences around the same test such as the ones at lines referenced) to use a clearly synthetic, non-AWS-shaped value (e.g., "TEST_BEDROCK_ACCESS_ABC123") and likewise replace any other fixtures with suspicious prefixes (e.g., change "sk-leaked-openai-key-1234567890" to "TEST_OPENAI_KEY_ABC123") so all t.Setenv calls in this file use harmless test tokens instead of real-patterned secrets.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@framework/configstore/clientconfig_redaction_test.go`:
- Around line 173-174: The test uses an AWS-shaped fixture "AKIA..." which can
trigger secret scanners; update the t.Setenv calls in
clientconfig_redaction_test.go (the t.Setenv("LEAK_TEST_BEDROCK_ACCESS", ...)
and any other occurrences around the same test such as the ones at lines
referenced) to use a clearly synthetic, non-AWS-shaped value (e.g.,
"TEST_BEDROCK_ACCESS_ABC123") and likewise replace any other fixtures with
suspicious prefixes (e.g., change "sk-leaked-openai-key-1234567890" to
"TEST_OPENAI_KEY_ABC123") so all t.Setenv calls in this file use harmless test
tokens instead of real-patterned secrets.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 04d5d309-fbca-42b0-bd2c-94353165d845
📒 Files selected for processing (2)
core/schemas/envvar.goframework/configstore/clientconfig_redaction_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- core/schemas/envvar.go
bf2c06c to
2c064ab
Compare
38d9f8b to
82740d2
Compare
Merge activity
|
The base branch was changed.

Summary
Implements automatic redaction of environment variable values in JSON serialization to prevent secrets from leaking through API responses. Adds comprehensive redaction support for all vector store configurations and fixes Azure configuration reconstruction logic.
Changes
MarshalJSONmethod toEnvVarthat automatically redacts values sourced from environment variables during JSON serializationType of change
Affected areas
How to test
Test the automatic redaction behavior:
Test with various vector store configurations to ensure secrets are properly redacted while preserving non-sensitive configuration values.
Screenshots/Recordings
N/A
Breaking changes
Related issues
N/A
Security considerations
This change significantly improves security by:
The automatic redaction only affects JSON serialization and does not impact database persistence, encryption, or internal LLM request paths.
Checklist
docs/contributing/README.mdand followed the guidelines