Skip to content

Commit

Permalink
feat(config): support ssrf field in security config. (#4778)
Browse files Browse the repository at this point in the history
* feat(config): support ssrf field in security

* test(core): add config.security.ssrf test case.
  • Loading branch information
JasinYip committed Oct 18, 2021
1 parent 6258f65 commit debfda7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,10 @@ declare module 'egg' {
protocolWhiteList: string[];
defaultMiddleware: string;
csrf: any;
ssrf: {
ipBlackList: string[];
checkAddress?(ip: string): boolean;
};
xframe: {
enable: boolean;
value: 'SAMEORIGIN' | 'DENY' | 'ALLOW-FROM';
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/apps/app-ts-type-check/normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ config2.customLoader = {
}
config2.security = {
csrf: false,
ssrf: {
ipBlackList: [
'10.0.0.0/8',
],
checkAddress (ip) {
return ip === '127.0.0.1';
}
},
}
config2.logger = {
dir: 'logs',
Expand Down

0 comments on commit debfda7

Please sign in to comment.