mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-12 20:15:26 +00:00
fix: tighten an existing .env to 0600 before rewriting it; CI checks secrets have values
envfile.update only applied 0600 when it created the file, so an existing .env with a wider mode kept it while secrets were written into it. The mode is now set on the open descriptor before the file is truncated and written. The CI step now requires POSTGRES_PASSWORD and JWT_SECRET_KEY to have values: an empty one falls back to a default without any check noticing.
This commit is contained in:
1 parent
f6bf4fefd1
commit
303f239fcd
3 files changed
+19
-4
No files matched your search
@@ -119,9 +119,10 @@ jobs:
|
||||
"$docsgpt" up --yes --dir "$stack" --image-tag verify
|
||||
"$docsgpt" status --dir "$stack"
|
||||
curl -fsS http://127.0.0.1:7091/ | grep -q 'src="/config.js"'
|
||||
grep -q '^POSTGRES_PASSWORD=' "$stack/.env"
|
||||
# The secrets must have values: an empty one would fall back to a default silently.
|
||||
grep -Eq '^POSTGRES_PASSWORD=.+$' "$stack/.env"
|
||||
# Running up again keeps the generated secrets.
|
||||
before=$(grep '^JWT_SECRET_KEY=' "$stack/.env")
|
||||
before=$(grep -E '^JWT_SECRET_KEY=.+$' "$stack/.env")
|
||||
"$docsgpt" up --yes --dir "$stack" --image-tag verify
|
||||
[ "$(grep '^JWT_SECRET_KEY=' "$stack/.env")" = "$before" ]
|
||||
"$docsgpt" uninstall --yes --purge --dir "$stack"
|
||||
|
||||
Reference in new issue
Block a user