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
fix: use @eggjs/security and @eggjs/session (#5384)
export Singleton
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Dependencies**
- Replaced `egg-security` with `@eggjs/security` package
- Replaced `egg-session` with `@eggjs/session` package
- Updated security and session plugin references across documentation
- **Documentation**
- Updated plugin, security, and core documentation to reflect new
package naming
- Corrected GitHub repository links for security and session plugins
- **Configuration**
- Modified plugin configuration to use new `@eggjs/security` and
`@eggjs/session` packages
- Removed legacy security configuration from type definitions
- **Core Functionality**
- Added singleton instance management method
- Enhanced type definitions for core framework components
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy file name to clipboardExpand all lines: site/docs/advanced/view-plugin.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -121,7 +121,7 @@ module.exports = {
121
121
122
122
The framework provides `ctx.helper` for developer use, but in some cases we want to override the helper method and only take effect when the template is rendered.
123
123
124
-
In template rendering, we often need to output a user-supplied html fragment, in which case, we often use the `helper.shtml` provided by the `egg-security` plugin.
124
+
In template rendering, we often need to output a user-supplied html fragment, in which case, we often use the `helper.shtml` provided by the `@eggjs/security` plugin.
@@ -163,9 +163,9 @@ You can [view](https://github.com/eggjs/egg-view-nunjucks/blob/2ee5ee992cfd95bc0
163
163
164
164
### Security Related
165
165
166
-
Templates and security are related and [egg-security] also provides some methods for the template. The template engine can be used according to requirements.
166
+
Templates and security are related and [@eggjs/security] also provides some methods for the template. The template engine can be used according to requirements.
167
167
168
-
First declare a dependency on [egg-security]:
168
+
First declare a dependency on [@eggjs/security]:
169
169
170
170
```json
171
171
{
@@ -183,6 +183,6 @@ Besides, the framework provides [app.injectCsrf](../core/security.md#appinjectcs
183
183
184
184
As a high-quality plugin, perfect unit testing is indispensable, and we also provide lots of auxiliary tools to make it painless for plugin developers to write tests with, see [unit testing](../core/unittest.md) and [plugin](./plugin.md) docs.
Copy file name to clipboardExpand all lines: site/docs/basics/controller.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -684,7 +684,7 @@ module.exports = {
684
684
685
685
By using Cookie, we can create an individual Session specific to every user to store user identity information, which will be encrypted then stored in Cookie to perform session persistence across requests.
686
686
687
-
The framework builds in [Session](https://github.com/eggjs/egg-session) plugin, which provides `ctx.session` for us to get or set current user's Session.
687
+
The framework builds in [Session](https://github.com/eggjs/session) plugin, which provides `ctx.session` for us to get or set current user's Session.
> **Reason**: the framework verifies the CSRF value specially for form POST requests, so please submit the CSRF key as well when you submit a form. Refer to [Keep Away from CSRF Threat](https://eggjs.org/zh-cn/core/security.html#安全威胁csrf的防范) for more detail.
216
216
217
-
> **Note**: the verification is performed because the framework builds in a security plugin [egg-security](https://github.com/eggjs/egg-security) that provides some default security practices and this plugin is enabled by default. In case you want to disable some security protections, just set the enable attribute to false.
217
+
> **Note**: the verification is performed because the framework builds in a security plugin [@eggjs/security](https://github.com/eggjs/security) that provides some default security practices and this plugin is enabled by default. In case you want to disable some security protections, just set the enable attribute to false.
218
218
219
219
> "Unless you clearly confirm the consequence, it's not recommended to disable functions provided by the security plugin"
Copy file name to clipboardExpand all lines: site/docs/community/faq.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ There are two kinds of common csrf errors:
77
77
-`missing csrf token`
78
78
-`invalid csrf token`
79
79
80
-
By default [egg-security](https://github.com/eggjs/egg-security/) plugin built in Egg requires CSRF validation against all 'unsafe' request such as `POST`, `PUT`, `DELETE` requests.
80
+
By default [@eggjs/security](https://github.com/eggjs/security/) plugin built in Egg requires CSRF validation against all 'unsafe' request such as `POST`, `PUT`, `DELETE` requests.
81
81
82
82
The error will disappear in the presence of the correct csrf token in the request. For more implementation details, see [../core/security.md#csrf].
Copy file name to clipboardExpand all lines: site/docs/core/security.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ The framework itself has a rich solution for common security risks on the Web si
22
22
- customizable white list for safe redirect and url filtering.
23
23
- all kinds of template related tools for preprocessing.
24
24
25
-
Security plugins [egg-security](https://github.com/eggjs/egg-security) are built into the framework, provides default security practices.
25
+
Security plugins [@eggjs/security](https://github.com/eggjs/security) are built into the framework, provides default security practices.
The built-in plugin [egg-security] provides common security helper functions, including `helper.shtml / surl / sjs` and so on. It's strongly recommended to read [Security](./security.md).
221
+
The built-in plugin [@eggjs/security] provides common security helper functions, including `helper.shtml / surl / sjs` and so on. It's strongly recommended to read [Security](./security.md).
Copy file name to clipboardExpand all lines: site/docs/intro/egg-and-koa.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,7 @@ One plugin can include:
124
124
125
125
A stand-alone module plugin can provide rich features with high maintainability. You can almost forget the configuration as the plugin supports configuring the default value in different environments.
126
126
127
-
[egg-security](https://github.com/eggjs/egg-security) is a typical example.
127
+
[@eggjs/security](https://github.com/eggjs/security) is a typical example.
128
128
129
129
More about plugin, please check [Plugin](../basics/plugin.md) section.
0 commit comments