eggjs / egg-security

Security plugin for egg, force performance too.
MIT License
238 stars 43 forks source link

Fix: Make `domain` and `whiteList`, `protocalWhiteList` in the same lower case #44

Closed ghost closed 6 years ago

ghost commented 6 years ago

Change Logs:

1) securities.js:Add convert whiteList and protocalWhiteList to the lowerCase() in union. 2) context.js: Remove undefined condition, because this has been done in securities.js. 3) surl.js: Make the header in the same lowerCase(). 4) hsts.js: Remove the comment's 1st line's empty space at the end (auto fixed by eslint). 5) utils.test.js: Change comments by fixing typos. 6) test\fixtures\apps\isSafeDomain\app\router.js: Add more unit tests to test with. 7) test\fixtures\apps\isSafeDomain\config\config.js: Add more domainWhiteList items for testing.

ghost commented 6 years ago

/cc:@dead-horse。This will fix the rest problem when your domain doesn't match domain_white_list. So as for protocalWhiteList (make them in lowerCase() in union).

Thanks for your time of reviewing!

codecov[bot] commented 6 years ago

Codecov Report

Merging #44 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
+ Coverage   95.86%   95.87%   +<.01%     
==========================================
  Files          30       30              
  Lines         484      485       +1     
==========================================
+ Hits          464      465       +1     
  Misses         20       20
Impacted Files Coverage Δ
lib/middlewares/hsts.js 100% <ø> (ø) :arrow_up:
lib/helper/surl.js 92.3% <100%> (-2.94%) :arrow_down:
app/middleware/securities.js 95.23% <100%> (+1.29%) :arrow_up:
app/extend/context.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 81f757a...68adfdb. Read the comment docs.

ghost commented 6 years ago

@dead-horse : All is fixed.

dead-horse commented 6 years ago

LGTM

ghost commented 6 years ago

Thanks anyway!