feat: fix information disclosure in API responses - #1115
Conversation
Refactored `ValueError` and `KeyError` exception handlers across tool endpoints (`add`, `update`, `capture`, `config_sync_now`, `config_import_passport`) to return static, secure error strings (e.g. "Configuration error") instead of raw `str(e)` output, preventing the leakage of internal architecture details or missing backend configuration parameters to the client. Maintained necessary UI/client-side usability by conditionally surfacing known benign validations (e.g. context_type mismatches and content limits) while scrubbing all other exception output. Replaced overly noisy `logger.exception` calls with `logger.warning` for missing configuration keys to prevent server log spam for expected user errors. Updated `tests/test_server.py` and `tests/test_passport_actions.py` to match the new sanitized message formats. Co-authored-by: n24q02m <135627235+n24q02m@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Request changesĐã đọc full diff, comments, linked issues và toàn bộ CI/security checks. CI xanh không loại bỏ các khoảng trống security sau:
Sau khi cập nhật, vui lòng rerun full test/security checks và cập nhật mô tả PR với boundary đã được kiểm chứng. |
Understood. Acknowledging that this work is now obsolete based on the feedback indicating remaining P1/P2 issues across the full call stack and the incorrect formatting of the ledger entry in |
Context
The Sentinel agent identified an Information Disclosure vulnerability where raw exception string details (
str(e)) forValueErrorandKeyErrorwere being exposed directly to the client JSON payload in the MCP tool handlers (_handle_add,_handle_update,_handle_capture,_handle_config_sync_now,_handle_config_import_passport). Returning unmasked backend exception output allows a malicious client to probe constraints or identify backend implementation details.Fix
str(e)payload values with statically defined error strings (e.g."Validation error","Configuration error") to secure the API contract."exceeds limit"or"Invalid context_type") to preserve developer experience without leaking backend data.logger.warninginstead oflogger.exceptionfor expectedKeyError(missing configurations) to avoid server log spam.as ebindings to maintain Ruff linting compliance.tests/test_server.pyandtests/test_passport_actions.pyto target the newly secured, static error messages. All tests pass successfully.PR created automatically by Jules for task 3462274969934362298 started by @n24q02m