From 40f40299ae4f220d13a76883b798df2b7281d8a5 Mon Sep 17 00:00:00 2001 From: Scot Lunsford Date: Wed, 20 May 2026 16:28:47 -0500 Subject: [PATCH 1/3] feat: add live reload REST API dev workflow --- Dockerfile | 32 +++- app/controllers/health-controller.js | 2 +- package-lock.json | 252 +++++++++++++++++++++++++++ package.json | 2 + 4 files changed, 279 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index f6fca030..528c34a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:22 +FROM node:22 AS base # Define build arguments ARG VERSION=dev @@ -26,15 +26,31 @@ WORKDIR /usr/src/app # where available (npm@5+) COPY package*.json ./ -# Install the app dependencies -RUN npm ci --only=production - -# Copy app source -COPY . . - # Set version as environment variable for runtime access ENV APP_VERSION=${VERSION} \ GIT_COMMIT=${REVISION} \ BUILD_DATE=${BUILDTIME} -CMD [ "npm", "start" ] \ No newline at end of file +FROM base AS dev + +# Install all dependencies, including file-watching development tools. +RUN npm ci + +# Copy app source +COPY . . +RUN mkdir -p /usr/src/app-seed && \ + cp -R app /usr/src/app-seed/app && \ + cp -R bin /usr/src/app-seed/bin && \ + cp -R resources /usr/src/app-seed/resources + +CMD [ "sh", "-c", "if [ ! -f app/index.js ]; then cp -R /usr/src/app-seed/app/. app/; fi; if [ ! -f bin/www ]; then cp -R /usr/src/app-seed/bin/. bin/; fi; if [ ! -d resources ] || [ -z \"$(ls -A resources 2>/dev/null)\" ]; then mkdir -p resources && cp -R /usr/src/app-seed/resources/. resources/; fi; exec npm run start:dev" ] + +FROM base AS production + +# Install the app dependencies +RUN npm ci --omit=dev + +# Copy app source +COPY . . + +CMD [ "npm", "start" ] diff --git a/app/controllers/health-controller.js b/app/controllers/health-controller.js index b5cbffc8..7092a47b 100644 --- a/app/controllers/health-controller.js +++ b/app/controllers/health-controller.js @@ -4,7 +4,7 @@ const logger = require('../lib/logger'); exports.getPing = function (req, res) { - return res.status(204).send(); + return res.status(200).send('rest api watch worx!'); }; exports.getStatus = function (req, res) { diff --git a/package-lock.json b/package-lock.json index 12003c86..cc242107 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,6 +59,7 @@ "json-diff": "^1.0.6", "mocha": "^11.5.0", "mongodb-memory-server": "^10.1.4", + "nodemon": "^3.1.14", "openapi-schema-validator": "^12.1.3", "parse5": "^7.3.0", "parse5-query-domtree": "^1.0.2", @@ -2054,6 +2055,20 @@ "dev": true, "license": "MIT" }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", @@ -2289,6 +2304,19 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bn.js": { "version": "4.12.3", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.3.tgz", @@ -5146,6 +5174,21 @@ "node": ">=14.14" } }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -5637,6 +5680,13 @@ "node": ">= 4" } }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, "node_modules/import-fresh": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", @@ -5774,6 +5824,19 @@ "dev": true, "license": "MIT" }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -7800,6 +7863,148 @@ "uuid": "bin/uuid" } }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/nodemon/node_modules/brace-expansion": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", + "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/nodemon/node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/nodemon/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/nodemon/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/nodemon/node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/nodemon/node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/nodemon/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/normalize-package-data": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", @@ -7835,6 +8040,16 @@ "dev": true, "license": "ISC" }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/normalize-url": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.1.1.tgz", @@ -11231,6 +11446,13 @@ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", "license": "MIT" }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, "node_modules/pump": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", @@ -12078,6 +12300,19 @@ "node": ">=4" } }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/sinon": { "version": "20.0.0", "resolved": "https://registry.npmjs.org/sinon/-/sinon-20.0.0.tgz", @@ -12934,6 +13169,16 @@ "node": ">=0.6" } }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, "node_modules/tr46": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", @@ -13098,6 +13343,13 @@ "node": ">= 0.8" } }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, "node_modules/undici": { "version": "5.29.0", "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", diff --git a/package.json b/package.json index d3a814d9..856f0cc9 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "prettier:fix": "npm run prettier -- --write", "format": "npm run prettier:fix && npm run lint:fix", "start": "node ./bin/www", + "start:dev": "nodemon --legacy-watch --watch app --watch bin --watch resources ./bin/www", "test": "npm run test:openapi && npm run test:config && npm run test:api && npm run test:middleware && npm run test:scheduler", "test:api": "mocha --timeout 20000 --recursive ./app/tests/api --exit", "test:config": "mocha --timeout 20000 --recursive ./app/tests/config --exit", @@ -92,6 +93,7 @@ "json-diff": "^1.0.6", "mocha": "^11.5.0", "mongodb-memory-server": "^10.1.4", + "nodemon": "^3.1.14", "openapi-schema-validator": "^12.1.3", "parse5": "^7.3.0", "parse5-query-domtree": "^1.0.2", From d7358e0b3d1cff3fedb30435525167d806ec2a30 Mon Sep 17 00:00:00 2001 From: Scot Lunsford Date: Wed, 20 May 2026 16:29:01 -0500 Subject: [PATCH 2/3] chore: remove live reload demo marker --- app/controllers/health-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/health-controller.js b/app/controllers/health-controller.js index 7092a47b..b5cbffc8 100644 --- a/app/controllers/health-controller.js +++ b/app/controllers/health-controller.js @@ -4,7 +4,7 @@ const logger = require('../lib/logger'); exports.getPing = function (req, res) { - return res.status(200).send('rest api watch worx!'); + return res.status(204).send(); }; exports.getStatus = function (req, res) { From 6b705d1365658c6321ed8f1b01d1de3dac7f34d0 Mon Sep 17 00:00:00 2001 From: Jared Ondricek Date: Mon, 12 Oct 2026 07:41:23 -0500 Subject: [PATCH 3/3] feat: simplify development container startup and document configuration --- Dockerfile | 8 +- docs/admin/authentication/configuration.md | 5 + .../authentication/testing-verification.md | 3 + docs/admin/configuration.md | 11 + docs/legacy/docker.md | 5 +- package-lock.json | 252 ------------------ package.json | 2 - template.env | 30 ++- 8 files changed, 52 insertions(+), 264 deletions(-) diff --git a/Dockerfile b/Dockerfile index 528c34a7..de322061 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,17 +33,13 @@ ENV APP_VERSION=${VERSION} \ FROM base AS dev -# Install all dependencies, including file-watching development tools. +# Install development dependencies. RUN npm ci # Copy app source COPY . . -RUN mkdir -p /usr/src/app-seed && \ - cp -R app /usr/src/app-seed/app && \ - cp -R bin /usr/src/app-seed/bin && \ - cp -R resources /usr/src/app-seed/resources -CMD [ "sh", "-c", "if [ ! -f app/index.js ]; then cp -R /usr/src/app-seed/app/. app/; fi; if [ ! -f bin/www ]; then cp -R /usr/src/app-seed/bin/. bin/; fi; if [ ! -d resources ] || [ -z \"$(ls -A resources 2>/dev/null)\" ]; then mkdir -p resources && cp -R /usr/src/app-seed/resources/. resources/; fi; exec npm run start:dev" ] +CMD [ "node", "./bin/www" ] FROM base AS production diff --git a/docs/admin/authentication/configuration.md b/docs/admin/authentication/configuration.md index 6d4fe778..100dafbd 100644 --- a/docs/admin/authentication/configuration.md +++ b/docs/admin/authentication/configuration.md @@ -89,6 +89,11 @@ docker compose restart rest-api npm start ``` +For Docker Compose environment-file changes, recreate the container with +`docker compose up -d --force-recreate rest-api` to load the updated environment. +See the [deployment configuration guide](https://github.com/mitre-attack/attack-workbench-deployment/blob/main/docs/configuration.md#rest-api-configuration-files) +for configuration file locations and details on applying changes. + ### Step 4: Verify Configuration Load Check the REST API logs during startup to confirm the configuration was loaded successfully: diff --git a/docs/admin/authentication/testing-verification.md b/docs/admin/authentication/testing-verification.md index a58da3a5..3fdfb7ca 100644 --- a/docs/admin/authentication/testing-verification.md +++ b/docs/admin/authentication/testing-verification.md @@ -13,6 +13,9 @@ Before testing, ensure you have: ## Verification Steps +For details on configuring REST API configuration files and container logging, +see the [deployment configuration guide](https://github.com/mitre-attack/attack-workbench-deployment/blob/main/docs/configuration.md#rest-api-configuration-files). + ### Step 1: Check REST API Logs When the REST API starts, it should log information about the authentication configuration. diff --git a/docs/admin/configuration.md b/docs/admin/configuration.md index 4d9de28b..cbd03176 100644 --- a/docs/admin/configuration.md +++ b/docs/admin/configuration.md @@ -30,8 +30,15 @@ JSON configuration files, or a combination of both. - [Collection Indexes](#collection-indexes) - [Configuration Files](#configuration-files) - [Allowed Values](#allowed-values) + - [Initialization and the JSON file](#initialization-and-the-json-file) + - [Managing a configuration](#managing-a-configuration) + - [Adding values](#adding-values) + - [ADM version and enforcement](#adm-version-and-enforcement) + - [Legacy invalid settings](#legacy-invalid-settings) + - [API](#api) - [Static Marking Definitions](#static-marking-definitions) - [ATT\&CK Specific](#attck-specific) + - [STIX graph-write exclusion](#stix-graph-write-exclusion) - [Additional Resources](#additional-resources) --- @@ -111,6 +118,10 @@ JSON configuration files are recommended for complex configurations, especially JSON_CONFIG_PATH=/path/to/config.json ``` +The API reads the JSON file during startup. Restart the process after changing +the file. For container configuration and restart procedures, see the +[deployment configuration guide](https://github.com/mitre-attack/attack-workbench-deployment/blob/main/docs/configuration.md#rest-api-configuration-files). + ### Configuration Precedence When both environment variables and JSON configuration are used: diff --git a/docs/legacy/docker.md b/docs/legacy/docker.md index 69442deb..c42ad316 100644 --- a/docs/legacy/docker.md +++ b/docs/legacy/docker.md @@ -1,8 +1,7 @@ # Standalone Docker Installation -The ATT&CK Workbench Frontend project includes a `docker-compose.yml` file that can be used to install all of the ATT&CK Workbench components as part of a Docker Compose installation. - -This document describes an alternate method of installing the ATT&CK Workbench REST API service in a Docker container without using Docker Compose. +This guide covers standalone Docker commands. For a complete Workbench deployment +with Docker Compose, use the [deployment repository](https://github.com/mitre-attack/attack-workbench-deployment). ## Create a Docker Image for the REST API diff --git a/package-lock.json b/package-lock.json index cc242107..12003c86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,7 +59,6 @@ "json-diff": "^1.0.6", "mocha": "^11.5.0", "mongodb-memory-server": "^10.1.4", - "nodemon": "^3.1.14", "openapi-schema-validator": "^12.1.3", "parse5": "^7.3.0", "parse5-query-domtree": "^1.0.2", @@ -2055,20 +2054,6 @@ "dev": true, "license": "MIT" }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", @@ -2304,19 +2289,6 @@ "dev": true, "license": "Apache-2.0" }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/bn.js": { "version": "4.12.3", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.3.tgz", @@ -5174,21 +5146,6 @@ "node": ">=14.14" } }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -5680,13 +5637,6 @@ "node": ">= 4" } }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", - "dev": true, - "license": "ISC" - }, "node_modules/import-fresh": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", @@ -5824,19 +5774,6 @@ "dev": true, "license": "MIT" }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -7863,148 +7800,6 @@ "uuid": "bin/uuid" } }, - "node_modules/nodemon": { - "version": "3.1.14", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", - "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", - "dev": true, - "license": "MIT", - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^4", - "ignore-by-default": "^1.0.1", - "minimatch": "^10.2.1", - "pstree.remy": "^1.1.8", - "semver": "^7.5.3", - "simple-update-notifier": "^2.0.0", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/nodemon/node_modules/balanced-match": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", - "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "18 || 20 || >=22" - } - }, - "node_modules/nodemon/node_modules/brace-expansion": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", - "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^4.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - } - }, - "node_modules/nodemon/node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/nodemon/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/nodemon/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/nodemon/node_modules/minimatch": { - "version": "10.2.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", - "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "brace-expansion": "^5.0.5" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/nodemon/node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/nodemon/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/normalize-package-data": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", @@ -8040,16 +7835,6 @@ "dev": true, "license": "ISC" }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/normalize-url": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.1.1.tgz", @@ -11446,13 +11231,6 @@ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", "license": "MIT" }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true, - "license": "MIT" - }, "node_modules/pump": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", @@ -12300,19 +12078,6 @@ "node": ">=4" } }, - "node_modules/simple-update-notifier": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", - "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/sinon": { "version": "20.0.0", "resolved": "https://registry.npmjs.org/sinon/-/sinon-20.0.0.tgz", @@ -13169,16 +12934,6 @@ "node": ">=0.6" } }, - "node_modules/touch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", - "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", - "dev": true, - "license": "ISC", - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, "node_modules/tr46": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", @@ -13343,13 +13098,6 @@ "node": ">= 0.8" } }, - "node_modules/undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true, - "license": "MIT" - }, "node_modules/undici": { "version": "5.29.0", "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", diff --git a/package.json b/package.json index 856f0cc9..d3a814d9 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "prettier:fix": "npm run prettier -- --write", "format": "npm run prettier:fix && npm run lint:fix", "start": "node ./bin/www", - "start:dev": "nodemon --legacy-watch --watch app --watch bin --watch resources ./bin/www", "test": "npm run test:openapi && npm run test:config && npm run test:api && npm run test:middleware && npm run test:scheduler", "test:api": "mocha --timeout 20000 --recursive ./app/tests/api --exit", "test:config": "mocha --timeout 20000 --recursive ./app/tests/config --exit", @@ -93,7 +92,6 @@ "json-diff": "^1.0.6", "mocha": "^11.5.0", "mongodb-memory-server": "^10.1.4", - "nodemon": "^3.1.14", "openapi-schema-validator": "^12.1.3", "parse5": "^7.3.0", "parse5-query-domtree": "^1.0.2", diff --git a/template.env b/template.env index e49e3452..4251263d 100644 --- a/template.env +++ b/template.env @@ -1,3 +1,11 @@ +# Template-Version: 1.0 +# Template-Updated: 2026-10-11 +# Template-Source: attack-workbench-rest-api/template.env +# +# Changelog +# --------- +# - 1.0 (2026-10-11): Introduce template metadata + # Attack Workbench REST API - Environment Configuration Template # Guidance: # - Booleans: use true or false @@ -11,7 +19,7 @@ # Database (REQUIRED) # DATABASE_URL (string) - MongoDB connection string # Example (Docker): -#DATABASE_URL=mongodb://attack-workbench-database/attack-workspace +#DATABASE_URL=mongodb://mongodb/attack-workspace # Example (local): #DATABASE_URL=mongodb://localhost:27017/attack-workspace DATABASE_URL= @@ -51,6 +59,14 @@ DATABASE_URL= # Configuration Files # JSON_CONFIG_PATH (string) - Path to a JSON file with additional configuration. # Use this to provide arrays for service accounts and OIDC clients +# +# Some example values which align to some sample configurations which can be found here: +# https://github.com/mitre-attack/attack-workbench-rest-api/tree/main/resources/sample-configurations +# +# ./resources/collection-manager-apikey.json +# ./resources/collection-manager-oidc-keycloak.json +# ./resources/collection-manager-oidc-okta.json +# # Default: empty (disabled) #JSON_CONFIG_PATH= @@ -62,11 +78,23 @@ DATABASE_URL= # Default: ./app/lib/default-static-marking-definitions/ #WB_REST_STATIC_MARKING_DEFS_PATH=./app/lib/default-static-marking-definitions/ +# WB_REST_STATIC_BYPASS_RULES_PATH (string) - Default validation bypass rules loaded at startup +# Default: ./app/lib/default-bypass-rules.json +#WB_REST_STATIC_BYPASS_RULES_PATH=./app/lib/default-bypass-rules.json + # Scheduler # ENABLE_SCHEDULER (bool) - Enable background scheduler # Default: true #ENABLE_SCHEDULER=true +# SYNC_COLLECTION_INDEXES_CRON (string) - Cron schedule for polling collection indexes (process timezone) +# Default: * * * * * (every minute); disabled when ENABLE_SCHEDULER=false +#SYNC_COLLECTION_INDEXES_CRON=* * * * * + +# CHECK_WIP_ATTACK_IDS_CRON (string) - Cron setting for WIP ATT&CK-ID checks (currently unused by scheduler) +# Default: 0 * * * * (hourly); no current task consumes this setting +#CHECK_WIP_ATTACK_IDS_CRON=0 * * * * + # VIRTUAL_TRACK_SCHEDULES_CRON (string) - Reconcile virtual-track schedules # Discovers new cron schedules, recovers due dates, and retries failed runs. # Standard 5-field cron syntax, interpreted in UTC.