Lab 09: Security Hardening
Step 1: Node.js 20 Permission Model (--experimental-permission)
--experimental-permission)# Only allow reading /data and writing /tmp
node --experimental-permission \
--allow-fs-read=/data \
--allow-fs-write=/tmp \
--allow-net=api.example.com \
app.js
# Permission flags:
# --allow-fs-read=<path> Allow file system read
# --allow-fs-write=<path> Allow file system write
# --allow-net=<host> Allow network access
# --allow-worker Allow worker_threads
# --allow-child-process Allow child_process.spawn
# --allow-wasi Allow WASIStep 2: AES-GCM Encryption with WebCrypto
Step 3: Ed25519 Digital Signatures
Step 4: Key Derivation — scrypt & PBKDF2
Step 5: Prototype Pollution Prevention
Step 6: Secure HTTP Headers
Step 7: Secure Random & Constant-Time Comparison
Step 8: Capstone — Secure Request Handler
Summary
Security Control
API / Tool
Against
Last updated
