fix(internal/ethapi,console,node,rpc): restrict debug_setHead to local transports#2296
fix(internal/ethapi,console,node,rpc): restrict debug_setHead to local transports#2296gzliudan wants to merge 1 commit intoXinFinOrg:dev-upgradefrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR restricts the debug_setHead JSON-RPC method to local transports by introducing a Local RPC API classification, keeping the method available via in-process and IPC while removing it from HTTP/WebSocket exposure.
Changes:
- Added
rpc.API.Localand updated node RPC startup to split APIs into open/auth/local sets. - Moved
debug_setHeadoff the publicDebugAPIinto a new local-onlyPrivateDebugAPI. - Updated console behavior and added tests to enforce/validate the new exposure rules.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rpc/types.go | Adds API.Local flag to mark APIs as local-transport only. |
| node/node.go | Splits registered APIs by transport visibility and wires open/auth/local sets into RPC startup. |
| node/node_auth_test.go | Adds test ensuring local-only APIs don’t cause auth endpoints to start and remain hidden from HTTP. |
| node/api.go | Updates WS admin start path to use filtered open APIs (but HTTP admin path still needs alignment). |
| internal/ethapi/backend.go | Registers a second debug service marked Local to host private debug methods. |
| internal/ethapi/api.go | Introduces PrivateDebugAPI and moves SetHead implementation to it. |
| internal/ethapi/api_test.go | Adds test verifying debug_setHead is hidden from open RPC but available on local registration. |
| console/console.go | Hides debug.setHead in JS console when the RPC method is not available. |
| console/console_test.go | Adds tests for console hiding behavior based on method availability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1dc8a06 to
3b51d37
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3b51d37 to
e0405d9
Compare
|
I think this is too big change just to disble 1 method which will be hard to maintain how about we disable through RPC flag default value and properly design the start script here |
sometime users need debug api |
e0405d9 to
ae4f9a4
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ae4f9a4 to
a5353e7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…l transports Move debug_setHead out of the public debug API and expose it only through local transports by introducing a local-only RPC API classification. This keeps debug_setHead available to in-process clients, IPC, and the local console while removing it from HTTP and WebSocket JSON-RPC exposure. It also updates the console and node tests to cover the new visibility rules.
a5353e7 to
9f1d5de
Compare
Proposed changes
Move debug_setHead out of the public debug API and expose it only through local transports by introducing a local-only RPC API classification.
This keeps debug_setHead available to in-process clients, IPC, and the local console while removing it from HTTP and WebSocket JSON-RPC exposure. It also updates the console and node tests to cover the new visibility rules.
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that