https://github.com/deepexi/egg-xss
egg xss 插件
https://github.com/deepexi/egg-xss
Last synced: 3 days ago
JSON representation
egg xss 插件
- Host: GitHub
- URL: https://github.com/deepexi/egg-xss
- Owner: deepexi
- License: mit
- Created: 2019-08-19T08:16:31.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-13T22:33:00.000Z (almost 6 years ago)
- Last Synced: 2026-04-24T14:19:33.811Z (2 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# egg-xss
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]

[npm-image]: https://img.shields.io/npm/v/egg-xss.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/egg-xss
[travis-image]: https://travis-ci.org/deepexi/egg-xss.svg?branch=master
[travis-url]: https://travis-ci.org/deepexi/egg-xss
[codecov-image]: https://img.shields.io/codecov/c/gh/deepexi/egg-xss.svg?style=flat-square
[codecov-url]: https://codecov.io/gh/deepexi/egg-xss
[download-image]: https://img.shields.io/npm/dw/egg-xss
[download-url]: https://www.npmjs.com/package/egg-xss
Egg's XSS
## Install
```bash
$ npm i egg-xss --save
```
## Usage
```js
// {app_root}/config/plugin.js
exports.xss = {
enable: true,
package: "egg-xss"
};
```
## Configuration
```js
// {app_root}/config/config.default.js
'use strict';
config.xss = {
enable: true,
match: [ '/test', '/login' ],
};
```
see [config/config.default.js](config/config.default.js) for more detail.
## Example
```javascript
// app/router.js
"use strict";
module.exports = app => {
app.get('/test',app.controller.test.index);
};
```
```js
// app/controller/test.js
("use strict");
module.exports = app => {
class SuccessController extends app.Controller {
index() {
console.log('query body : ', this.ctx.query);
this.ctx.body = this.ctx.query;
}
}
return SuccessController;
};
```
## Questions & Suggestions
Please open an issue [here](https://github.com/eggjs/egg/issues).
## License
[MIT](LICENSE)