Skip to content

Commit

Permalink
Update deps, swap pre-commit for husky
Browse files Browse the repository at this point in the history
Add files array to package.json for np.
Removed version badge as it's just additional work to np.
  • Loading branch information
binarymist committed May 30, 2021
1 parent 9909d21 commit d608e46
Show file tree
Hide file tree
Showing 9 changed files with 1,039 additions and 1,104 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ config.*.json
*.zip

buildAndDeployCloudImages.sh
*.code-workspace

1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm test
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
<a href='https://coveralls.io/github/purpleteam-labs/purpleteam-orchestrator?branch=main'>
<img src='https://coveralls.io/repos/github/purpleteam-labs/purpleteam-orchestrator/badge.svg?branch=main' alt='test coverage'>
</a>

<a href="https://github.com/purpleteam-labs/purpleteam-orchestrator/releases" title="latest release">
<img src="https://img.shields.io/github/v/release/purpleteam-labs/purpleteam-orchestrator?color=%23794fb8&include_prereleases" alt="GitHub release (latest SemVer including pre-releases)">
</a>
<br/><br/><br/>
</div>

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion healthcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

const http = require('http');
require('convict');
const config = require('./config/config.js');
const config = require('./config/config');

const options = {
host: config.get('host.host'),
Expand Down
2,065 changes: 995 additions & 1,070 deletions package-lock.json

Large diffs are not rendered by default.

47 changes: 27 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@
"dc-down": "npm run dc-orchestrator-testers down",
"//": "Containers must be up before running exec commands.",
"dc-up-shell-orchestrator": "npm run dc-orchestrator-testers -- exec orchestrator /bin/ash",
"dc-up-shell-app": "npm run dc-orchestrator-testers -- exec app-scanner /bin/ash"
"dc-up-shell-app": "npm run dc-orchestrator-testers -- exec app-scanner /bin/ash",
"prepare": "husky install"
},
"pre-commit": [
"test"
],
"repository": {
"type": "git",
"url": "git+https://github.com/purpleteam-labs/purpleteam-orchestrator.git"
Expand Down Expand Up @@ -84,34 +82,43 @@
"homepage": "https://purpleteam-labs.com",
"dependencies": {
"@gar/hapi-json-api": "^3.1.0",
"@hapi/boom": "^9.1.0",
"@hapi/boom": "^9.1.2",
"@hapi/bourne": "^2.0.0",
"@hapi/good": "^9.0.1",
"@hapi/hapi": "^20.0.3",
"@hapi/hapi": "^20.1.3",
"@hapi/inert": "^6.0.3",
"@hapi/wreck": "^17.1.0",
"ajv": "^6.12.6",
"ajv-errors": "^1.0.1",
"ajv": "^8.5.0",
"ajv-errors": "^3.0.0",
"ajv-formats": "^2.1.0",
"app-module-path": "^2.2.0",
"convict": "^6.0.0",
"convict-format-with-validator": "^6.0.0",
"convict": "^6.1.0",
"convict-format-with-validator": "^6.0.1",
"diff": "^5.0.0",
"hapi-good-winston": "^3.0.1",
"joi": "^17.3.0",
"purpleteam-logger": "^1.0.2",
"redis": "^3.0.2",
"joi": "^17.4.0",
"purpleteam-logger": "^1.1.2",
"redis": "^3.1.2",
"susie": "^3.0.0"
},
"//Install ajv --save-dev": "gets rid of npm warning.",
"devDependencies": {
"eslint": "^7.14.0",
"eslint": "^7.27.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"@hapi/code": "^8.0.2",
"@hapi/lab": "^24.1.0",
"eslint-plugin-import": "^2.23.3",
"@hapi/code": "^8.0.3",
"@hapi/lab": "^24.2.1",
"npm-check": "^5.9.2",
"pre-commit": "^1.2.2",
"rewire": "^5.0.0",
"sinon": "^9.2.1"
}
"sinon": "^11.1.1",
"husky": "^6.0.0"
},
"files": [
"index.js",
"Dockerfile",
"healthcheck.js",
"compose",
"config",
"src"
]
}
19 changes: 10 additions & 9 deletions src/api/orchestration/schemas/buildUserConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

const jsdiff = require('diff');
const Ajv = require('ajv');
const addFormats = require('ajv-formats');
const Bourne = require('@hapi/bourne');

const ajv = new Ajv({ allErrors: true, useDefaults: true, removeAdditional: true });
addFormats(ajv);

// Todo: KC: Make error messages more meaningful.
require('ajv-errors')(ajv);
Expand Down Expand Up @@ -82,7 +84,6 @@ const schema = {
type: 'string',
enum: configSchemaProps.sut._cvtProperties.reportFormat.format // eslint-disable-line no-underscore-dangle
},
additionalItems: false,
uniqueItems: true,
minItems: 1
}
Expand All @@ -107,7 +108,7 @@ const schema = {
route: { type: 'string', pattern: '^/\\w{1,200}$' },
usernameFieldLocater: { type: 'string', pattern: '^[a-zA-Z0-9_-]{1,100}$' }, // Possibly allow spaces for css selectors.
passwordFieldLocater: { type: 'string', pattern: '^[a-zA-Z0-9_-]{1,100}$' }, // Possibly allow spaces for css selectors.
submit: { type: 'string', pattern: '^[a-zA-Z0-9_-\\s]{1,100}$' },
submit: { type: 'string', pattern: '^[a-zA-Z0-9_\\-\\s]{1,100}$' },
expectedPageSourceSuccess: { type: 'string', minLength: 2, maxLength: 200 }
},
required: [
Expand Down Expand Up @@ -142,10 +143,10 @@ const schema = {
},
required: ['id', 'type'],
if: { properties: { type: { enum: ['testSession'] } } },
then: { properties: { id: { pattern: '^\\w{1,200}$' } } },
then: { properties: { id: { type: 'string', pattern: '^\\w{1,200}$' } } },
else: {
if: { properties: { type: { enum: ['route'] } } },
then: { properties: { id: { pattern: '^/\\w{1,200}$' } } }
then: { properties: { id: { type: 'string', pattern: '^/\\w{1,200}$' } } }
},
title: 'ResourceLinkage'
},
Expand All @@ -167,7 +168,7 @@ const schema = {
if: { properties: { type: { enum: ['testSession'] } } },
then: {
properties: {
id: { pattern: '^\\w{1,200}$' },
id: { type: 'string', pattern: '^\\w{1,200}$' },
attributes: { $ref: '#/definitions/AttributesObjOfTopLevelResourceObjectOfTypeTestSession' },
relationships: { $ref: '#/definitions/Relationships' }
},
Expand All @@ -177,7 +178,7 @@ const schema = {
if: { properties: { type: { enum: ['route'] } } },
then: {
properties: {
id: { pattern: '^/\\w{1,200}$' },
id: { type: 'string', pattern: '^/\\w{1,200}$' },
attributes: { $ref: '#/definitions/AttributesObjOfTopLevelResourceObjectOfTypeRoute' }
}
}
Expand All @@ -195,7 +196,7 @@ const schema = {
type: 'object',
additionalProperties: false,
properties: {
username: { type: 'string', pattern: '^[a-zA-Z0-9_-]{1,100}$' },
username: { type: 'string', pattern: '^[a-zA-Z0-9_\\-]{1,100}$' },
password: { type: 'string' },
aScannerAttackStrength: { type: 'string', enum: ['LOW', 'MEDIUM', 'HIGH', 'INSANE'] },
aScannerAlertThreshold: { type: 'string', enum: ['LOW', 'MEDIUM', 'HIGH'] },
Expand All @@ -216,7 +217,7 @@ const schema = {
minItems: 0
},
method: { type: 'string', enum: ['GET', 'PUT', 'POST'] },
submit: { type: 'string', pattern: '^[a-zA-Z0-9_-\\s]{1,100}$' }
submit: { type: 'string', pattern: '^[a-zA-Z0-9_\\-\\s]{1,100}$' }
},
required: ['attackFields', 'method', 'submit'],
title: 'AttributesObjOfTopLevelResourceObjectOfTypeRoute'
Expand All @@ -226,7 +227,7 @@ const schema = {
type: 'object',
additionalProperties: false,
properties: {
name: { type: 'string', pattern: '^[a-zA-Z0-9_-]{1,100}$' },
name: { type: 'string', pattern: '^[a-zA-Z0-9_\\-]{1,100}$' },
value: { type: 'string' },
visible: { type: 'boolean' } // Todo: KC: Need to check whether visible should be required.
},
Expand Down

0 comments on commit d608e46

Please sign in to comment.