@contrast/protect 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/lib/error-handlers/index.js +2 -0
  2. package/lib/error-handlers/install/koa2.js +52 -0
  3. package/lib/input-analysis/index.js +2 -0
  4. package/lib/input-analysis/install/co-body.js +51 -0
  5. package/lib/input-analysis/install/cookie-parser.js +48 -0
  6. package/lib/input-analysis/install/formidable.js +53 -0
  7. package/lib/input-analysis/install/koa2.js +137 -0
  8. package/lib/input-analysis/install/multer.js +52 -0
  9. package/lib/input-analysis/install/qs.js +40 -0
  10. package/lib/input-analysis/install/universal-cookie.js +34 -0
  11. package/package.json +2 -1
  12. package/lib/error-handlers/install/fastify3.test.js +0 -142
  13. package/lib/esm-loader.test.mjs +0 -11
  14. package/lib/index.test.js +0 -32
  15. package/lib/input-analysis/handlers.test.js +0 -898
  16. package/lib/input-analysis/index.test.js +0 -28
  17. package/lib/input-analysis/install/fastify3.test.js +0 -71
  18. package/lib/input-analysis/install/http.test.js +0 -315
  19. package/lib/input-tracing/handlers/index.test.js +0 -395
  20. package/lib/input-tracing/install/child-process.test.js +0 -112
  21. package/lib/input-tracing/install/fs.test.js +0 -118
  22. package/lib/input-tracing/install/mysql.test.js +0 -108
  23. package/lib/input-tracing/install/postgres.test.js +0 -125
  24. package/lib/input-tracing/install/sequelize.test.js +0 -79
  25. package/lib/input-tracing/install/sqlite3.test.js +0 -88
  26. package/lib/make-response-blocker.test.js +0 -88
  27. package/lib/make-source-context.test.js +0 -298
  28. package/lib/throw-security-exception.test.js +0 -50
  29. package/lib/utils.test.js +0 -40
package/lib/index.test.js DELETED
@@ -1,32 +0,0 @@
1
- 'use strict';
2
-
3
- const { expect } = require('chai');
4
- const proxyquire = require('proxyquire');
5
-
6
- const moduleMock = (moduleName, mock) => (deps) => {
7
- deps.protect[moduleName] = mock[moduleName];
8
- };
9
-
10
- describe('protect', function () {
11
- let mocks, coreMock, protectMock, protectModule, modulesWithInstall;
12
- beforeEach(function () {
13
- mocks = require('../../test/mocks');
14
- protectMock = mocks.protect();
15
- coreMock = { protect: {}, config: mocks.config() };
16
- protectModule = proxyquire('.', {
17
- './make-response-blocker': moduleMock('makeResponseBlocker', protectMock),
18
- './make-source-context': moduleMock('makeSourceContext', protectMock),
19
- './input-analysis': moduleMock('inputAnalysis', protectMock),
20
- './input-tracing': moduleMock('inputTracing', protectMock),
21
- './error-handlers': moduleMock('errorHandlers', protectMock),
22
- });
23
- modulesWithInstall = ['inputAnalysis', 'inputTracing', 'errorHandlers'];
24
- });
25
-
26
- it('calls the install() the specified modules', function () {
27
- protectModule(coreMock).install();
28
- modulesWithInstall.forEach((module) => {
29
- expect(protectMock[module].install).to.have.been.calledOnce;
30
- });
31
- });
32
- });