Skip to content

Commit 1dfa98d

Browse files
committed
Security hardening: allowlist config keys, pin CI SHAs, clarify README, v2.5.4
1 parent 8cad4f2 commit 1dfa98d

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414

1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
1818

1919
- name: Setup Node.js
20-
uses: actions/setup-node@v4
20+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
2121
with:
2222
node-version: 20
2323

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Output goes to `dist/`.
6666
- Rate limiting with exponential backoff on failed password attempts (persisted across restarts)
6767
- Password strength enforcement: 10+ chars, 3/4 character classes, dictionary check against 160+ common passwords
6868

69-
### Content Security Policy
69+
### Content Security Policy (Renderer)
7070

7171
```
7272
default-src 'none';
@@ -77,7 +77,9 @@ img-src 'self' data:;
7777
connect-src 'none';
7878
```
7979

80-
All scripts and fonts loaded from local `lib/` directory. Zero CDN dependencies at runtime. `connect-src 'none'` blocks any outbound fetch/XHR even if code is injected.
80+
All scripts and fonts loaded from local `lib/` directory. Zero CDN dependencies at runtime. `connect-src 'none'` blocks any outbound fetch/XHR from the renderer process, even if code is injected.
81+
82+
**Note:** The auto-updater runs in the main process (not governed by the renderer's CSP) and makes a single HTTPS request to GitHub Releases on launch to check for new versions. This can be disabled in File → Settings.
8183

8284
### Additional Hardening
8385

@@ -88,6 +90,8 @@ All scripts and fonts loaded from local `lib/` directory. Zero CDN dependencies
8890
- DOMPurify sanitizes all note content on load and paste
8991
- Export dialogs warn about unencrypted output
9092
- Print dialogs warn for password-protected notebooks
93+
- Config keys allowlisted — renderer can only write known settings
94+
- CI actions pinned to commit SHAs to prevent supply-chain attacks
9195

9296
## Development
9397

main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ function createWindow() {
571571
]},
572572
{ label: "Help", submenu: [
573573
{ label: "About NoteForge", click: () => dialog.showMessageBox(mainWindow, {
574-
type: "info", title: "About NoteForge", message: "NoteForge v2.5.3",
574+
type: "info", title: "About NoteForge", message: "NoteForge v2.5.4",
575575
detail: "Encrypted offline note-taking.\nAES-256-GCM · scrypt (N=65536)\nDerived key session · Auto-lock\n\nData: " + userDataPath,
576576
})},
577577
]},
@@ -605,6 +605,8 @@ function saveConfig(cfg) {
605605

606606
ipcMain.handle("get-config", async () => loadConfig());
607607
ipcMain.handle("set-config", async (_e, key, value) => {
608+
const ALLOWED = new Set(["autoUpdate"]);
609+
if (!ALLOWED.has(key)) return { error: "Unknown config key" };
608610
const cfg = loadConfig();
609611
cfg[key] = value;
610612
saveConfig(cfg);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "noteforge",
3-
"version": "2.5.3",
3+
"version": "2.5.4",
44
"description": "Encrypted offline note-taking — a OneNote alternative that keeps your data local and protected.",
55
"main": "main.js",
66
"author": {

0 commit comments

Comments
 (0)