Skip to content

πŸ›‘οΈ Sentinel: [MEDIUM] Fix error message leakage - #241

Merged
matdev83 merged 2 commits into
mainfrom
sentinel-fix-error-leakage-17523149817371763483
Jul 31, 2026
Merged

πŸ›‘οΈ Sentinel: [MEDIUM] Fix error message leakage#241
matdev83 merged 2 commits into
mainfrom
sentinel-fix-error-leakage-17523149817371763483

Conversation

@matdev83

Copy link
Copy Markdown
Owner

🚨 Severity: MEDIUM
πŸ’‘ Vulnerability: Exposed raw internal error messages in HTTP responses
🎯 Impact: Could leak internal implementation details or unexpected states
πŸ”§ Fix: Replaced err.Error() with a generic error message
βœ… Verification: Ran the existing test suite


PR created automatically by Jules for task 17523149817371763483 started by @matdev83

@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ 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 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 085e447e-5f89-457b-8b1a-e652868a3f8b

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between ffac7a2 and cf9e5a1.

πŸ“’ Files selected for processing (2)
  • internal/refbackend/openaicodex/server.go
  • internal/refbackend/openaicodex/server_test.go

πŸ“ Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Standardized HTTP and WebSocket responses for invalid headers to return a consistent, generic error message.

Walkthrough

Changes

Header validation responses

Layer / File(s) Summary
Unify invalid header responses
internal/refbackend/openaicodex/server.go
HTTP and WebSocket header-validation failures now return "invalid headers" instead of detailed validator errors.
Validate invalid header responses
internal/refbackend/openaicodex/server_test.go
Tests verify the "invalid headers" body for HTTP requests and failed WebSocket upgrades with missing required headers.

Estimated code review effort: 2 (Simple) | ~10 minutes

πŸš₯ Pre-merge checks | βœ… 8
βœ… Passed checks (8 passed)
Check name Status Explanation
Title check βœ… Passed The title clearly describes the security fix for error message leakage and is concise.
Description check βœ… Passed The description accurately explains the vulnerability, impact, fix, and verification related to the changeset.
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.
No Secrets βœ… Passed The commit only replaces two error responses with the literal "invalid headers"; added-line secret scanning found no credentials, keys, tokens, passwords, private keys, or sensitive URLs.
Context Propagation βœ… Passed The patch only changes two HTTP error strings; it adds no context handling, cancellation paths, goroutines, or altered blocking behavior.
No Accidental Public Api Break βœ… Passed Only internal/refbackend/openaicodex/server.go changed; no pkg/** files, exported declarations, signatures, fields, flags, or config keys changed. The response-text change is explicitly explained i...

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@internal/refbackend/openaicodex/server.go`:
- Line 139: Add regression coverage for the generic validation error contract in
both the HTTP endpoint and WebSocket upgrade path: assert the response status is
400 and the exact response body is β€œinvalid headers”. Update the existing tests
covering these two request flows, ensuring internal validation details remain
hidden.
πŸͺ„ Autofix (Beta)

βœ… Autofix completed


ℹ️ Review info
βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 65e3f424-c46c-4c02-b98c-84244a6a2a18

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 79605bb and ffac7a2.

πŸ“’ Files selected for processing (1)
  • internal/refbackend/openaicodex/server.go
πŸ“œ Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: Analyze (Go)
  • GitHub Check: qa
  • GitHub Check: Test (ubuntu-latest)
  • GitHub Check: Test (macos-latest)
  • GitHub Check: Test (windows-latest)
🧰 Additional context used
πŸ““ Path-based instructions (4)
**/*.go

πŸ“„ CodeRabbit inference engine (Custom checks)

**/*.go: For server, CLI, worker, or network Go code, ensure context.Context is propagated correctly, cancellation is respected, and new goroutines cannot leak indefinitely.
Do not make accidental public API breaks in Go code: under pkg/** or anywhere exported Go identifiers are changed, warn if the PR changes exported types, function signatures, error behavior, JSON fields, CLI flags, config keys, or documented behavior without clearly explaining the compatibility impact.

**/*.go: Implement and describe Go behavior only; explicitly label Python-era or future behavior.
The core owns orchestration, routing, failover, and B2BUA continuity; provider semantics remain in adapters/plugins.
Core code must not import provider SDKs or concrete plugins.
Use canonical protocol adapters instead of pairwise protocol translators.
Streaming is primary; non-streaming APIs must collect the canonical stream.
Do not transparently retry or fail over after the first downstream content event.
Fail explicitly on capability mismatches; never silently drop required semantics.
Place request and response mutation behind hooks or extensions, not core branching.
Use explicit construction and registration; do not use DI containers, reflection registries, globals, or Go native plugin in v1.
Use specs for new features, breaking or architecture changes, protocol/plugin contract changes, routing semantic changes, or unclear requirements; use direct code for small fixes, documentation, narrow tests, and trivial maintenance.
If an active Kiro spec is in scope, do not code before approved requirements.md and design.md are recorded in spec.json.
Prefer the standard library and add dependencies only when they reduce complexity or risk.
Define small interfaces where consumed; constructors should return concrete types unless exposing stable SDK or plugin contracts.
Every I/O boundary must take context.Context; never store contexts in structs.
Own goroutines, channels, and cancellation ex...

Files:

  • internal/refbackend/openaicodex/server.go

βš™οΈ CodeRabbit configuration file

**/*.go: Review as production Go code. Prioritize correctness, race conditions, goroutine leaks, context cancellation, timeout handling, error wrapping, nil-pointer risks, resource cleanup, defer placement, API compatibility, interface design, dependency boundaries, and testability. Avoid generic style comments when gofmt/golangci-lint already covers the issue.

Files:

  • internal/refbackend/openaicodex/server.go
**/*

πŸ“„ CodeRabbit inference engine (Custom checks)

Do not introduce hardcoded credentials, API keys, tokens, private keys, passwords, production secrets, or sensitive internal URLs.

**/*: Do not add changelog, _Updated, _Reason, timestamp, or history footers to steering or agent instructions.
Use TDD by default: write the test or interface before the implementation.
Prefer the smallest correct diff and avoid speculative abstractions.
Never claim success without direct verification evidence.
Preserve user-authored changes and never use destructive git commands unless explicitly requested.
Do not work on main; create a suitably named local worktree and fix/spec/feat branch based on main for each change.
Use forward-slash git pathspecs on Windows.
Reports must state changed files and verification run, and plainly state skipped tests or uncertainty; mention architectural trade-offs only when relevant.

Files:

  • internal/refbackend/openaicodex/server.go
internal/refbackend/**/*.go

πŸ“„ CodeRabbit inference engine (AGENTS.md)

Keep reference backends, clients, stubs, fixtures, architecture tests, and QA helpers test-only.

Files:

  • internal/refbackend/openaicodex/server.go
internal/**

βš™οΈ CodeRabbit configuration file

internal/**: Focus on package boundaries, hidden coupling, unexported API design, concurrency safety, deterministic behavior, and whether logic belongs in this internal package.

Files:

  • internal/refbackend/openaicodex/server.go
🧠 Learnings (1)
πŸ“š Learning: 2026-07-01T22:57:42.953Z
Learnt from: matdev83
Repo: matdev83/go-llm-interactive-proxy PR: 101
File: pkg/lipsdk/scope/context.go:0-0
Timestamp: 2026-07-01T22:57:42.953Z
Learning: In this repository, when defining unexported Go `context` key constants of type `ctxKey int` (e.g., `const ( kFoo ctxKey = iota + N )`), preserve the `iota + <offset>` pattern and keep the existing `<offset>` values rather than simplifying to plain `iota`. These per-package offsets are part of the repo-wide convention to avoid key collisions across packages, and each such constant set should include a short explanatory comment (for example: β€œoffset avoids collision with other packages' context keys”).

Applied to files:

  • internal/refbackend/openaicodex/server.go

Comment thread internal/refbackend/openaicodex/server.go
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • internal/refbackend/openaicodex/server_test.go

Commit: bed299d6a482aa2173faf42224c43cc708660148

The changes have been pushed to the sentinel-fix-error-leakage-17523149817371763483 branch.

Time taken: 7m 35s

google-labs-jules Bot and others added 2 commits July 31, 2026 18:36
🚨 Severity: MEDIUM
πŸ’‘ Vulnerability: Exposed raw internal error messages in HTTP responses
🎯 Impact: Could leak internal implementation details or unexpected states
πŸ”§ Fix: Replaced err.Error() with a generic error message
βœ… Verification: Ran the existing test suite

Co-authored-by: matdev83 <211248003+matdev83@users.noreply.github.com>
Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@matdev83
matdev83 force-pushed the sentinel-fix-error-leakage-17523149817371763483 branch from bed299d to cf9e5a1 Compare July 31, 2026 16:47
@matdev83
matdev83 enabled auto-merge (squash) July 31, 2026 16:47
@matdev83
matdev83 merged commit 1886845 into main Jul 31, 2026
12 of 13 checks passed
@matdev83
matdev83 deleted the sentinel-fix-error-leakage-17523149817371763483 branch July 31, 2026 16:48
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