Repository navigation
fix: resolve remaining security and runtime issues - #72
Merged
Merged
Conversation
…nd runtime - .nvmrc, .node-version: 20 -> 22 - Dockerfile: node:25-alpine -> node:22-alpine - package.json engines.node: >=18.0.0 -> >=20.0.0 - docs/getting-started.md: Node.js 18+/20 -> 20+/22 LTS - docs/desktop-app.md: Node.js 20 -> 22 LTS (3 references) - docs/self-hosting.md: Install Node.js 20 -> 22 LTS - src-tauri/src/lib.rs: startup error message 20+ -> 22+ - .github/workflows/ci.yml: node-version 20 -> 22 (5 occurrences) - .github/workflows/tauri-check.yml: node-version 20 -> 22 - .github/workflows/security.yml: node-version 20 -> 22 - .github/workflows/release.yml: node-version 20 -> 22 + release notes 20+ -> 22+ - .github/workflows/android-apk.yml: node-version 20 -> 22 Closes #50 Co-authored-by: hacksynth <hacksynth@users.noreply.github.com>
Remove hardcoded NEXTAUTH_SECRET/AUTH_SECRET from .env.tauri and generate a unique per-install secret at first sidecar startup. - resolve_or_create_auth_secret(): reads auth.secret from Tauri app data dir; treats empty file as missing and regenerates (no empty-secret bug) - create_secret_file(): uses create_new(true) + mode(0o600) at creation on Unix so permissions are set before any data is written; no write-then-chmod race - write_secret_atomic(): removes any leftover .tmp file before calling create_new(true), then atomically renames temp -> final path - Secret is 32 random bytes, Base64-encoded (44 chars via getrandom + base64 crates) - AUTH_SECRET and NEXTAUTH_SECRET injected into sidecar process env - docs/desktop-app.md: add Auth Secret section documenting per-platform storage paths, format, reuse across restarts, deletion impact, dev mode Fixes #55 Co-authored-by: hacksynth <hacksynth@users.noreply.github.com>
- Add src/lib/crypto/secrets.ts: AES-256-GCM helpers (encryptSecret, decryptSecret, resolveSecret, isEncryptionEnabled, isEncryptedSecret) - Add apiKeyEncrypted / imageApiKeyEncrypted columns to UserAISettings via migration 20260502140000_add_encrypted_api_key_fields - PUT /api/profile/ai-settings: reject new key submissions with HTTP 503 when OSE_ENCRYPTION_KEY is absent or invalid; never write plaintext - GET /api/profile/ai-settings: resolve hasApiKey/masked from encrypted columns first, falling back to legacy plaintext for display only - Read paths (resolveAIConfig, resolveAIImageConfig, resolveAIImageConfigFromRequest, resolveAIConfigFromRequest): decrypt via resolveSecret; lazy-migrate any legacy plaintext key to encrypted storage on first use when OSE_ENCRYPTION_KEY is available - Without OSE_ENCRYPTION_KEY, legacy plaintext keys are treated as unconfigured (not used); users must set the env var and re-enter keys - Add tests: src/test/crypto-secrets.test.ts (round-trip, unicode, tamper resistance, resolveSecret fallback behaviour) - Update .env.example and docs/self-hosting.md with key setup, rotation, and backup guidance Closes #53 Co-authored-by: hacksynth <hacksynth@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #50
Closes #53
Closes #55
Summary
Local verification
Note: cargo is not installed in this local environment, so Rust formatting/checks are left to the Tauri CI job.