-
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.discover
method for OpenRPC service discovery. This enables clients to retrieve the OpenRPC schema via JSON-RPC.Notes:
jayson
because it doesnt supportrpc.
PR Type
Enhancement
Description
Add
rpc.discover
OpenRPC service discovery methodIntegrate OpenRPC schema via
@shardeum-foundation/api-specs
Update method whitelist to allow
rpc.discover
Register
rpc.discover
in JSON-RPC server initializationChanges walkthrough 📝
rpcDiscover.ts
Add rpcDiscover method for OpenRPC schema retrieval
src/methods/rpcDiscover.ts
rpcDiscover
method returning OpenRPC document@shardeum-foundation/api-specs
methodWhitelist.ts
Allow rpc.discover in method whitelist
src/middlewares/methodWhitelist.ts
rpc.discover
to allowed JSON-RPC methodsrpc.discover
are permittedserver.ts
Register rpc.discover in JSON-RPC server
src/server.ts
rpcDiscover
in JSON-RPC serverrpc.discover
methodpackage.json
Add OpenRPC schema dependency to project
package.json
@shardeum-foundation/api-specs
as a dependency