Skip to content

Commit

Permalink
Add support for (experimental) node policy file
Browse files Browse the repository at this point in the history
  • Loading branch information
davidje13 committed Oct 28, 2023
1 parent 15138c5 commit c042269
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ stick with using `./index.js` to launch the application instead of
`node index.js`, as the former will automatically get new security
flags as they are added.

### Additional runtime flags

To enable an (experimental) NodeJS feature for limiting the source
files which can be loaded, you can set an environment variable:

```
NODE_OPTIONS='--experimental-policy=./policy.json'
```

(`policy.json` is provided in the same folder as `index.js` - if
that is not the current directory, change the path to match)

## Data encryption

All retro item data is encrypted in the database using aes-256-cbc,
Expand Down
1 change: 1 addition & 0 deletions scripts/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ if [[ -z "$TARGET_HOST" ]]; then
MOCK_SSO_PORT="$MOCK_SSO_PORT" \
SERVER_BIND_ADDRESS="localhost" \
DB_URL="memory://refacto?simulatedLatency=50" \
NODE_OPTIONS='--experimental-policy="'"$BUILDDIR/policy.json"'"' \
node \
--disable-proto throw \
"$BUILDDIR/index.js" \
Expand Down
2 changes: 1 addition & 1 deletion src/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"lint:tsc": "tsc",
"lint:prettier": "prettier --check .",
"lint": "tsc && prettier --check .",
"build": "rm -rf build && rollup --config rollup.config.mjs && cp -r src/static build/static && chmod +x build/index.js",
"build": "rm -rf build && rollup --config rollup.config.mjs && cp -r src/static build/static && cp policy.json build && chmod +x build/index.js",
"start": "npm run build && NODE_ENV=development build/index.js",
"test": "lean-test --preprocess tsc --parallel"
},
Expand Down
9 changes: 9 additions & 0 deletions src/backend/policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"onerror": "throw",
"scopes": {
"./": {
"integrity": true,
"dependencies": true
}
}
}

0 comments on commit c042269

Please sign in to comment.