This report performs a deep-dive audit of the Hub's "Day 0" setup experience in setup.sh, focusing on 12-Factor App Methodology, Installation Idempotency, and Cryptographic Safety.
| Factor | Status | Observation |
|---|---|---|
| III. Config | ✅ Success | Secure Default Generation: The script correctly uses openssl (Lines 37-38) to generate unique SECRET_KEY and ADMIN_PASSWORD values per installation. This prevents "Same-Key-Everywhere" vulnerabilities common in open-source AI projects. |
| V. Build, Release, Run | 🟡 Warning | Tight Coupling: The script triggers a full docker-compose up --build immediately. While user-friendly for developers, this patterns bypasses the "Build vs Release" distinction (Factor V), potentially leading to unverified code reaching production if run on a live server. |
/app/setup.shThe interactive wizard for configuring the AI Hub's environment and services.
[!CAUTION] Lack of Idempotency (Catastrophic Data Loss Risk) Line 41:
cat <<EOF > .envThe setup script uses the redirection operator (>) to write the.envfile. This unconditionally overwrites any existing.envfile.The Problem: If an administrator runs
./setup.shtwice (e.g., to add a second admin email), the script will generate a NEWSECRET_KEY. This immediately invalidates all existing hashed passwords in the Database and orphans all active OIDC/Cookie sessions, effectively "Locking Out" the entire system.Fix: Replace the overwrite logic with an "Append" strategy or check
if [ ! -f .env ]before generating new secrets.
Identified Problems:
read command (Line 28) does not use the -r flag, which can lead to unexpected behavior if the user inputs backslashes in their email address (though rare in emails).bash is available at a fixed relative path (Line 61). If the repository is cloned with inconsistent symlinks, this step will fail silently but the script will report "Setup Complete.".env files and avoid regenerating the SECRET_KEY once it has been established.openssl and docker presence at the start of the script to provide better error messages before attempting configuration.set +o history command to prevent the initial password from being stored in ~/.bash_history.This concludes Feature 20. I have persisted this report to /app/docs/reviews/feature_review_setup_logic.md. I have now completed 20 comprehensive feature audits of the AI Hub backend. Shall I perform a final system-wide architectural summary?