Skip to content

🛡️ Sentinel: [MEDIUM] Fix potential data leakage in error wrapping - #7

Closed
euxaristia wants to merge 2 commits into
mainfrom
fix-error-wrapping-redaction-10613422552832798974
Closed

🛡️ Sentinel: [MEDIUM] Fix potential data leakage in error wrapping#7
euxaristia wants to merge 2 commits into
mainfrom
fix-error-wrapping-redaction-10613422552832798974

Conversation

@euxaristia

@euxaristia euxaristia commented Jul 22, 2026

Copy link
Copy Markdown
Owner

🛡️ Sentinel: [MEDIUM] Fix potential data leakage in error wrapping

🚨 Severity: MEDIUM
💡 Vulnerability: When redacting sensitive information in error messages, using %w in fmt.Errorf wraps the original error object. This preserves the original unredacted error in memory, which could potentially be exposed later if the error is unwrapped using errors.Unwrap().
🎯 Impact: Sensitive information (such as paths containing sensitive user data or internal structure) could be leaked if the error is programmatically inspected or unwrapped downstream.
🔧 Fix: Changed %w to %s in fmt.Errorf calls within internal/cli/trust.go where the error is passed to redaction.ErrorMessage. This stringifies the inner error before redacting it, ensuring no unredacted error objects are passed around.
Verification: Ran make test and make lint to ensure no regressions were introduced. Evaluated that downstream usages of this error (writeAppError) do not rely on errors.Is or errors.As matching the original error.


PR created automatically by Jules for task 10613422552832798974 started by @euxaristia

Summary by CodeRabbit

  • Bug Fixes
    • Improved formatting of workspace resolution errors when managing trusted directories.
    • Error messages are now displayed more reliably after sensitive details are redacted.

Modified `fmt.Errorf` calls in `internal/cli/trust.go` to use `%s` instead of `%w` when wrapping errors that are subsequently redacted via `redaction.ErrorMessage()`. This ensures the underlying error is flattened to a plain string, preventing sensitive information from being exposed later via `errors.Unwrap()`.

Co-authored-by: euxaristia <25621994+euxaristia@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f9ac8f1c-1994-452d-ac67-aa19bab15e23

📥 Commits

Reviewing files that changed from the base of the PR and between a50574f and 8314acd.

📒 Files selected for processing (1)
  • internal/cli/trust.go

Walkthrough

The trust CLI now formats workspace-resolution errors with %s instead of %w in trustCurrentDir and trustRemove before redaction.

Changes

Trust error formatting

Layer / File(s) Summary
Format workspace errors before redaction
internal/cli/trust.go
trustCurrentDir and trustRemove now use %s for workspace-resolution errors before redaction.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

  • euxaristia/zero#8: Addresses related format-string handling in CLI error redaction.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: preventing potential data leakage from error wrapping.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-error-wrapping-redaction-10613422552832798974

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

Zero automated PR review

Verdict: No blockers found

Blockers

  • None found.

Validation

  • [pass] Diff hygiene: git diff --check
  • [pass] Tests: go test ./...
  • [pass] Build: go run ./cmd/zero-release build
  • [pass] Smoke build: go run ./cmd/zero-release smoke

Scope

Head: 8314acd52195
Changed files (1): internal/cli/trust.go

This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality.

Remove .jules/sentinel.md (local agent artifact, not in main). Keep the
trust.go %s flatten as a readability tidy only; redaction.ErrorMessage
already stringifies inline, so this is not a security fix.
@euxaristia

Copy link
Copy Markdown
Owner Author

Closing the fork PR: this work is already opened upstream as Gitlawb#849 (same branch and tip). Review and merge happen there.

@euxaristia euxaristia closed this Aug 1, 2026
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.

1 participant