Conversation
## Summary Adds a "Show original values" toggle to the MCP log detail sheet, allowing users with the `Logs:Reveal` permission to view redacted placeholders replaced with their original values. Redaction utility functions are extracted into a shared module and extended to support recursive reveal over structured JSON-like values. ## Changes - Extracted `hasRedactionMappingEntries` and `applyRedactionMapping` from `logDetailView.tsx` into a new shared `ui/lib/utils/redaction.ts` module, removing the inline definitions. - Added `applyRedactionMappingToValue` for recursive reveal over nested objects and arrays without mutating the fetched log data. - Added `mergeRedactionMappings` to combine input and output phase maps for fields like error details that may contain content from both phases. - Introduced a `RedactionMapping` interface in `logs.ts` and applied it to both `LogEntry` and `MCPToolLogEntry` (the latter now includes `redaction_mapping` on detail responses). - Added a `canReveal` prop to `MCPLogDetailSheet`, gated by the `Logs:Reveal` RBAC permission checked in `MCPLogsPage`. - Rendered a `Switch` toggle labeled "Show original values" in the sheet header when reveal data is available; toggling it applies the redaction mapping to arguments, result, and error details before display. - Reset the toggle state whenever the displayed log ID changes or reveal availability changes. - Added unit tests covering `hasRedactionMappingEntries`, `applyRedactionMappingToValue` (including immutability), and `mergeRedactionMappings` conflict resolution. ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [ ] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [x] UI (React) - [ ] Docs ## How to test 1. Open the MCP Logs page as a user with the `Logs:Reveal` permission. 2. Click a log entry that has redacted fields (placeholders like `[EMAIL-1]`). 3. Verify the "Show original values" toggle appears in the sheet header. 4. Toggle it on and confirm placeholders in Arguments, Result, and Error Details are replaced with original values. 5. Toggle it off and confirm placeholders are restored. 6. Navigate to a different log and confirm the toggle resets to off. 7. As a user without `Logs:Reveal`, confirm the toggle does not appear. ```sh cd ui pnpm i || npm i pnpm test || npm test pnpm build || npm run build ``` ## Screenshots/Recordings _Add before/after screenshots showing the toggle and revealed values in the MCP log detail sheet._ ## Breaking changes - [ ] Yes - [x] No ## Related issues _Link related issues here._ ## Security considerations The reveal toggle is gated behind the `Logs:Reveal` RBAC permission. Original values are only substituted client-side when the backend includes `redaction_mapping` in the response, which itself is only returned to callers with the appropriate permission. No original values are persisted or logged by the UI. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [ ] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds shared redaction mapping types and utilities. MCP log details now support RBAC-controlled reveal of original arguments, results, and error details. Existing log details use the shared utilities. ChangesMCP log redaction
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MCPLogsPage
participant MCPLogDetailSheet
participant RedactionUtilities
participant MCPToolLogEntry
MCPLogsPage->>MCPLogsPage: Check Logs/Reveal permission
MCPLogsPage->>MCPLogDetailSheet: Pass canReveal
MCPLogDetailSheet->>MCPToolLogEntry: Read log values and redaction_mapping
MCPLogDetailSheet->>RedactionUtilities: Apply redaction mappings
RedactionUtilities-->>MCPLogDetailSheet: Return transformed values
MCPLogDetailSheet-->>MCPLogsPage: Render log details
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Revives #5366 on the restored MCP guardrails stack. This PR is stacked above #5738, whose base is
dev.