Skip to content

Commit d137107

Browse files
committed
config: deal with "secret" security hazard
If you provide a default, people WILL use it. It is a security hazard if people use the default private psk to sign auth messages. Flood usuaully has privileges to files. A potential intruder may download files inside Flood and that will lead to arbitrary remote code execution, not to mention rTorrent's rich and powerful script interface. This change makes sure there is NO default and build shall NOT pass before user provides a secret. Bug: Flood-UI/flood#589
1 parent f1bb524 commit d137107

File tree

7 files changed

+17
-4
lines changed

7 files changed

+17
-4
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ jobs:
2525
- run: cp config.template.js config.js
2626
- run: npm install
2727
- run: npm run build
28+
env:
29+
FLOOD_SECRET: ${{ secrets.FLOOD_SECRET }}

.github/workflows/check-compiled-i18n.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ jobs:
2525
- run: cp config.template.js config.js
2626
- run: npm install
2727
- run: npm run check-compiled-i18n
28+
env:
29+
FLOOD_SECRET: ${{ secrets.FLOOD_SECRET }}

.github/workflows/check-source-formatting.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ jobs:
2525
- run: cp config.template.js config.js
2626
- run: npm install
2727
- run: npm run check-source-formatting
28+
env:
29+
FLOOD_SECRET: ${{ secrets.FLOOD_SECRET }}

.github/workflows/check-types.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ jobs:
2525
- run: cp config.template.js config.js
2626
- run: npm install
2727
- run: npm run check-types
28+
env:
29+
FLOOD_SECRET: ${{ secrets.FLOOD_SECRET }}

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ jobs:
2525
- run: cp config.template.js config.js
2626
- run: npm install
2727
- run: npm run lint
28+
env:
29+
FLOOD_SECRET: ${{ secrets.FLOOD_SECRET }}

config.docker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const CONFIG = {
55
floodServerPort: 3000,
66
maxHistoryStates: 30,
77
pollInterval: 1000 * 5,
8-
secret: process.env.FLOOD_SECRET || 'flood',
8+
// eslint-disable-next-line no-undef
9+
secret: process.env.FLOOD_SECRET || CHANGE_ME,
910
scgi: {
1011
host: process.env.RTORRENT_SCGI_HOST || 'localhost',
1112
port: process.env.RTORRENT_SCGI_PORT || 5000,

config.template.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ const CONFIG = {
5151
maxHistoryStates: 30,
5252
// How often (in milliseconds) Flood will request the torrent list from.
5353
torrentClientPollInterval: 1000 * 2,
54-
// A unique secret for signing messages with JWT (see https://jwt.io). Change
55-
// this to something unique and hard to guess.
56-
secret: 'flood',
54+
// A unique secret for signing messages with JWT (see https://jwt.io).
55+
// Change this to something unique and hard to guess.
56+
// You can use 'uuidgen' or 'cat /proc/sys/kernel/random/uuid' or 'uuidgenerator.net'.
57+
// eslint-disable-next-line no-undef
58+
secret: process.env.FLOOD_SECRET || CHANGE_ME,
5759
// Configuration for SSL, if using SSL with the Flood service directly.
5860
ssl: false,
5961
sslKey: '/absolute/path/to/key/',

0 commit comments

Comments
 (0)