-
Notifications
You must be signed in to change notification settings - Fork 15
Feat/add rpc discover #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
70c342b to
7c37ffe
Compare
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
| server._methods['rpc.discover'] = new jayson.Method((_args: unknown, done: jayson.JSONRPCCallbackTypePlain) => { | ||
| rpcDiscover().then((res) => { | ||
| done(null, res) | ||
| }).catch((err) => { | ||
| done(err, null) | ||
| }) | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: The current implementation exposes the rpc.discover method without any authentication or rate limiting, which could allow abuse or information leakage. Consider adding appropriate access controls or rate limiting to this method to prevent misuse. [security, importance: 8]
| server._methods['rpc.discover'] = new jayson.Method((_args: unknown, done: jayson.JSONRPCCallbackTypePlain) => { | |
| rpcDiscover().then((res) => { | |
| done(null, res) | |
| }).catch((err) => { | |
| done(err, null) | |
| }) | |
| }); | |
| // Apply rate limiting or authentication as appropriate before exposing rpc.discover | |
| server._methods['rpc.discover'] = new jayson.Method((_args: unknown, done: jayson.JSONRPCCallbackTypePlain) => { | |
| // Example: check authentication or apply rate limiting here | |
| rpcDiscover().then((res) => { | |
| done(null, res) | |
| }).catch((err) => { | |
| done(err, null) | |
| }) | |
| }); |
7c37ffe to
5f59866
Compare
5f59866 to
57b03f6
Compare
User description
This adds
This adds
rpc.discovermethod for OpenRPC service discovery. This enables clients to retrieve the OpenRPC schema via JSON-RPC.Notes:
jaysonbecause it doesnt supportrpc.PR Type
Enhancement
Description
Add
rpc.discoverOpenRPC service discovery methodIntegrate OpenRPC schema via
@shardeum-foundation/api-specsUpdate method whitelist to allow
rpc.discoverRegister
rpc.discoverin JSON-RPC server initializationChanges walkthrough 📝
rpcDiscover.ts
Add rpcDiscover method for OpenRPC schema retrievalsrc/methods/rpcDiscover.ts
rpcDiscovermethod returning OpenRPC document@shardeum-foundation/api-specsmethodWhitelist.ts
Allow rpc.discover in method whitelistsrc/middlewares/methodWhitelist.ts
rpc.discoverto allowed JSON-RPC methodsrpc.discoverare permittedserver.ts
Register rpc.discover in JSON-RPC serversrc/server.ts
rpcDiscoverin JSON-RPC serverrpc.discovermethodpackage.json
Add OpenRPC schema dependency to projectpackage.json
@shardeum-foundation/api-specsas a dependency