You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(server): renamed to StrictGetMethodPlugin and enabled it by default in RPCHandler (#348)
GetMethodGuardPlugin -> StrictGetMethodPlugin
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Documentation**
- Updated sidebar navigation and guides to reflect the shift to a
stricter GET method enforcement in RPC documentation.
- Added clarifications regarding the default behavior of the RPCHandler
and the necessity for explicit permissions for GET requests.
- **Enhancements**
- Improved RPC security defaults by enforcing strict GET request
handling, with a new option to disable this behavior if needed.
- **Tests**
- Added test cases to ensure that the new default configuration is
correctly initialized and applied.
- Modified existing tests to incorporate the new configuration option
for the RPCHandler.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy file name to clipboardExpand all lines: apps/content/docs/advanced/rpc-protocol.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ const router = {
30
30
Any HTTP method can be used. Input can be provided via URL query parameters or the request body.
31
31
32
32
:::info
33
-
To help prevent [Cross-Site Request Forgery (CSRF)](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/CSRF_prevention) attacks, you can use the [GET Method Guard Plugin](/docs/plugins/get-method-guard) to restrict the use of the `GET` method.
33
+
You can use any method, but by default, [RPCHandler](/docs/rpc-handler) enabled [StrictGetMethodPlugin](/docs/rpc-handler#default-plugins) which blocks GET requests except for procedures explicitly allowed.
Copy file name to clipboardExpand all lines: apps/content/docs/client/rpc-link.md
+4
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,10 @@ If a property in `ClientContext` is required, oRPC enforces its inclusion when c
62
62
63
63
By default, RPCLink sends requests via `POST`. You can override this to use methods like `GET` (for browser or CDN caching) based on your requirements.
64
64
65
+
::: warning
66
+
By default, [RPCHandler](/docs/rpc-handler) enabled [StrictGetMethodPlugin](/docs/rpc-handler#default-plugins) which blocks GET requests except for procedures explicitly allowed. please refer to [StrictGetMethodPlugin](/docs/plugins/strict-get-method) for more details.
Copy file name to clipboardExpand all lines: apps/content/docs/plugins/strict-get-method.md
+9-5
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,16 @@
1
1
---
2
-
title: GET Method Guard Plugin
3
-
description: Enhance security by restricting GET requests to explicitly allowed procedures, mitigating Cross-Site Request Forgery (CSRF) risks.
2
+
title: Strict GET Method Plugin
3
+
description: Enhance security by ensuring only procedures explicitly marked to accept `GET` requests can be called using the HTTP `GET` method for RPC Protocol. This helps prevent certain types of Cross-Site Request Forgery (CSRF) attacks.
4
4
---
5
5
6
-
# GET Method Guard Plugin
6
+
# Strict GET Method Plugin
7
7
8
8
This plugin enhances security by ensuring only procedures explicitly marked to accept `GET` requests can be called using the HTTP `GET` method for [RPC Protocol](/docs/advanced/rpc-protocol). This helps prevent certain types of [Cross-Site Request Forgery (CSRF)](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/CSRF_prevention) attacks.
9
9
10
+
::: info
11
+
[RPCHandler](/docs/rpc-handler) enabled this plugin by default.
12
+
:::
13
+
10
14
## When to Use
11
15
12
16
This plugin is beneficial if your application stores sensitive data (like session or auth tokens) in Cookie storage using `SameSite=Lax` (the default) or `SameSite=None`.
Copy file name to clipboardExpand all lines: apps/content/docs/rpc-handler.md
+6
Original file line number
Diff line number
Diff line change
@@ -83,3 +83,9 @@ const handler = new RPCHandler(router, {
83
83
eventIteratorKeepAliveComment: '',
84
84
})
85
85
```
86
+
87
+
## Default Plugins
88
+
89
+
RPCHandler is pre-configured with plugins that help enforce best practices and enhance security out of the box. By default, the following plugin is enabled:
90
+
91
+
-[StrictGetMethodPlugin](/docs/plugins/strict-get-method) - Disable by setting `strictGetMethodPluginEnabled` to `false`.
0 commit comments