feat(admin): verify the backoffice password with PBKDF2, not plaintext compare

- ui/auth.js: derive PBKDF2-HMAC-SHA256(name:password) with a per-deploy salt
  (250k iterations) and compare against the verifier in constant time
- config/admin-credentials.json holds salt/iterations/verifier only — no password
- server/set-admin-password.mjs generates/rotates that file (CLI or hidden prompt)
- login is async now: button shows a pending state; config load errors surface in the form
- SW precaches the credentials file; version bumped to 2026.11.19.4
- docs: README/AGENTS explain rotation and the residual limits of a client-side gate
This commit is contained in:
Bkk1234 committed 2026-11-19 11:32:48 +07:00
1 parent cd5cb5dd08
commit a629e67ca4
8 files changed
+249 -32

No files matched your search

+2 -1
View File
@@ -2,7 +2,7 @@
กติกา: bump VERSION เฉพาะเมื่อแก้ไฟล์นี้หรือรายการ PRECACHE
เนื้อหา (HTML/CSS/JS/JSON) ใช้ network-first จึงไม่ต้อง bump */
const VERSION = "2026.11.19.3";
const VERSION = "2026.11.19.4";
const CACHE = `hobbypj-${VERSION}`;
const PRECACHE = [
@@ -23,6 +23,7 @@ const PRECACHE = [
"./ui/views/home.js",
"./ui/views/admin.js",
"./data/projects.json",
"./config/admin-credentials.json",
"./icons/icon-192.png",
"./icons/icon-512.png",
"./fonts/k2d-400-thai.woff2",