[PR #31] [MERGED] Feature/auto generate nextauth secret #46

Closed
opened 2026-10-15 13:01:54 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/wolfmanager/pull/31
Author: @salty2011
Created: 6/14/2025
Status: ✅ Merged
Merged: 6/14/2025
Merged by: @salty2011

Base: release/202506.003 ← Head: feature/auto-generate-nextauth-secret


📝 Commits (3)

  • 62fb3a9 feat: implement automatic NEXTAUTH_SECRET and ENCRYPTION_KEY generation (#24)
  • aef200d feat: improve documentation structure and add security guides
  • 443f3a2 refactor: standardize naming from wolf-ui/wolf-admin to WolfManager

📊 Changes

30 files changed (+2657 additions, -155 deletions)

View changed files

📝 .dockerignore (+7 -1)
📝 .env.example (+22 -0)
📝 .gitignore (+7 -1)
📝 README.md (+57 -3)
📝 build/Dockerfile (+1 -0)
📝 build/README.md (+47 -0)
📝 build/docker-compose.production.yml (+4 -3)
📝 build/docker-compose.yml (+4 -1)
📝 build/docker-entrypoint.sh (+21 -0)
📝 docs/README.md (+46 -31)
📝 docs/development.md (+194 -1)
➕ docs/guides/development.md (+552 -0)
➕ docs/quick-start-auto-generation.md (+136 -0)
➕ docs/security/auto-secret-generation.md (+217 -0)
📝 docs/technical/database-architecture.md (+205 -68)
📝 package.json (+1 -1)
📝 src/app/api/debug/logs-test/route.ts (+2 -2)
📝 src/app/api/logs/route.ts (+2 -2)
📝 src/app/settings/logs/components/log-viewer.tsx (+1 -1)
📝 src/instrumentation.ts (+4 -0)

...and 10 more files

📄 Description

Summary

This PR introduces a feature that automatically generates a secure NEXTAUTH_SECRET during the application's initialization phase. This enhancement aims to streamline the setup process and bolster security by ensuring that a robust secret is always in place without manual intervention.

Changes Introduced

  • Implemented logic to check for the existence of NEXTAUTH_SECRET and generate one if absent.
  • Utilized cryptographic functions to create a secure, random secret.
  • Updated relevant configuration files to integrate the auto-generation process seamlessly.
  • Secrets and encryption keys are stored in .env.local, persisted to the config folder, and symlinked into the correct runtime location.
  • Added unit tests to validate the functionality and reliability of the secret generation mechanism.
  • standardized naming to WolfManager throughout the project. Previously had wolf-ui and wolf-admin which are all the same thing
  • cleaned up documentation structure

Rationale

Manually setting the NEXTAUTH_SECRET can be error-prone and may lead to security vulnerabilities if weak secrets are used. By automating this process, we ensure that every deployment has a strong, unique secret, enhancing the overall security posture of the application.

Testing & Validation

  • Verified that the application initializes correctly with and without a pre-defined NEXTAUTH_SECRET.
  • Ensured that the generated secrets meet the required entropy standards.
  • All existing and new unit tests pass successfully.

Additional Notes

This feature is backward-compatible. If a NEXTAUTH_SECRET is already defined in the environment, the auto-generation logic is bypassed, preserving existing configurations.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/games-on-whales/wolfmanager/pull/31 **Author:** [@salty2011](https://github.com/salty2011) **Created:** 6/14/2025 **Status:** ✅ Merged **Merged:** 6/14/2025 **Merged by:** [@salty2011](https://github.com/salty2011) **Base:** `release/202506.003` ← **Head:** `feature/auto-generate-nextauth-secret` --- ### 📝 Commits (3) - [`62fb3a9`](https://github.com/games-on-whales/wolfmanager/commit/62fb3a9d1e0d379fb0e80eaa8212af2f7d562309) feat: implement automatic NEXTAUTH_SECRET and ENCRYPTION_KEY generation (#24) - [`aef200d`](https://github.com/games-on-whales/wolfmanager/commit/aef200d7b8878bd37b7876365af46a6f807ef136) feat: improve documentation structure and add security guides - [`443f3a2`](https://github.com/games-on-whales/wolfmanager/commit/443f3a210afb73539a0072817cbd18c111ea7fae) refactor: standardize naming from wolf-ui/wolf-admin to WolfManager ### 📊 Changes **30 files changed** (+2657 additions, -155 deletions) <details> <summary>View changed files</summary> 📝 `.dockerignore` (+7 -1) 📝 `.env.example` (+22 -0) 📝 `.gitignore` (+7 -1) 📝 `README.md` (+57 -3) 📝 `build/Dockerfile` (+1 -0) 📝 `build/README.md` (+47 -0) 📝 `build/docker-compose.production.yml` (+4 -3) 📝 `build/docker-compose.yml` (+4 -1) 📝 `build/docker-entrypoint.sh` (+21 -0) 📝 `docs/README.md` (+46 -31) 📝 `docs/development.md` (+194 -1) ➕ `docs/guides/development.md` (+552 -0) ➕ `docs/quick-start-auto-generation.md` (+136 -0) ➕ `docs/security/auto-secret-generation.md` (+217 -0) 📝 `docs/technical/database-architecture.md` (+205 -68) 📝 `package.json` (+1 -1) 📝 `src/app/api/debug/logs-test/route.ts` (+2 -2) 📝 `src/app/api/logs/route.ts` (+2 -2) 📝 `src/app/settings/logs/components/log-viewer.tsx` (+1 -1) 📝 `src/instrumentation.ts` (+4 -0) _...and 10 more files_ </details> ### 📄 Description ### Summary This PR introduces a feature that automatically generates a secure `NEXTAUTH_SECRET` during the application's initialization phase. This enhancement aims to streamline the setup process and bolster security by ensuring that a robust secret is always in place without manual intervention. ### Changes Introduced * Implemented logic to check for the existence of `NEXTAUTH_SECRET` and generate one if absent. * Utilized cryptographic functions to create a secure, random secret. * Updated relevant configuration files to integrate the auto-generation process seamlessly. * Secrets and encryption keys are stored in `.env.local`, persisted to the `config` folder, and symlinked into the correct runtime location. * Added unit tests to validate the functionality and reliability of the secret generation mechanism. * standardized naming to WolfManager throughout the project. Previously had wolf-ui and wolf-admin which are all the same thing * cleaned up documentation structure ### Rationale Manually setting the `NEXTAUTH_SECRET` can be error-prone and may lead to security vulnerabilities if weak secrets are used. By automating this process, we ensure that every deployment has a strong, unique secret, enhancing the overall security posture of the application. ### Testing & Validation * Verified that the application initializes correctly with and without a pre-defined `NEXTAUTH_SECRET`. * Ensured that the generated secrets meet the required entropy standards. * All existing and new unit tests pass successfully. ### Additional Notes This feature is backward-compatible. If a `NEXTAUTH_SECRET` is already defined in the environment, the auto-generation logic is bypassed, preserving existing configurations. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 13:01:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/wolfmanager#46
No description provided.