fix(scripts): require TEST_USERS_PASSWORD + purge weak literals from test-user helpers #27
No reviewers
Labels
No labels
agent-context-drift
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rstillwell/deckhearth#27
Loading…
Reference in a new issue
No description provided.
Delete branch "convoy/purge-weak-creds-from-helpers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes the remaining scope of the queued
purge-weak-creds-from-helpersfollow-up after PR #25 (fix-reset-db-script, squash3ab9bf8) closed thescripts/reset-db.jshalf. Mirrors the post-drop-public-setup(b63b509) + post-PR-#25 (3ab9bf8) fail-loud env-var pattern verbatim — third application of the same proven shape.Bugs fixed
scripts/create-test-users.jsbcrypt.hash('alice123', 12)andbcrypt.hash('bob123', 12)literals removed. Both rows now usebcrypt.hash(testUsersPassword, 12)wheretestUsersPasswordis read fromprocess.env.TEST_USERS_PASSWORDwith a fail-loud check at the top ofcreateTestUsers()that exits 1 BEFORE opening any DB connection if the var is unset.console.loglines that printed the literalalice123/bob123/admin123strings deleted. New summary line documents where the password comes from ((passwords from TEST_USERS_PASSWORD)) without ever printing the value.TESTING_GUIDE.mdadmin123/alice123/bob123for admin + alice + bob. Rewritten to show password source per user (ADMIN_INITIAL_PASSWORDenv var orTEST_USERS_PASSWORDenv var, depending on the seed script). Added a paragraph documenting that both env vars must be set in.env.localbefore running their respective seed scripts, with aopenssl rand -base64 24generation tip and a pointer to README's "First-time admin setup" section.Password: alice123/Password: bob123replaced withPassword: <value of TEST_USERS_PASSWORD from .env.local>.Fix shape
Single env var (
TEST_USERS_PASSWORD) covers both alice + bob — deliberate simplification vs. per-user vars (risk R2 in the convoy file argues this; these are fixture users for the collaboration demo, not independent identities, and per-user sprawl would double the env-var contract for zero security benefit). Fail-loud check uses the same wording template assetup-neon-db.jslines 20-26 andreset-db.jslines 29-35 (names the var, points at.env.local, suggestsopenssl rand -base64 24, references README).ON CONFLICT (email) DO NOTHINGpreserved (already in original) — defensive against double-run. No CJS→ESM conversion needed —create-test-users.jswas already top-level ESM, unlike the previous two convoys.Verification (static-only — script touches the DB, not live-tested)
node --check scripts/create-test-users.js→ exit 0 ✓npm run lint→ 128 problems (baseline preserved, no regression) ✓npm run test:run→ 21/21 pass ✓scripts/ TESTING_GUIDE.mdforadmin123|password123|test123|alice123|bob123→ 0 hits ✓scripts/create-test-users.jsforrequire(→ 0 hits ✓ (was already ESM)scripts/ TESTING_GUIDE.mdforTEST_USERS_PASSWORD→ 10 hits (5 in script + 5 in doc) ✓Test plan
forbidden-endpoints+forbidden-cors-headersregression-locks greenScreenshot diffNOT triggered (script + doc only — paths filter excludes both)TEST_USERS_PASSWORDin.env.local, runsnode scripts/create-test-users.jsagainst a non-prod Neon branch, verifies alice + bob seed; then unsets the var and re-runs, verifies fail-loud exit 1 with the helpful error message.Operator action required
node scripts/create-test-users.jsmust addTEST_USERS_PASSWORD=<value>to their.env.localfirst. Existing alice + bob rows in already-seeded environments are not rotated by re-running this script (ON CONFLICT (email) DO NOTHINGpreserves old hashes); any environment seeded before this PR still has the weakalice123/bob123hashes and must rotate manually via the app, or drop those rows and re-seed.Follow-ups
purge-weak-creds-from-helpersqueued entry in.convoys/ship-readiness.mdcan be marked RESOLVED post-merge. NOT updating ship-readiness in this PR — flagged for the role-doc-writer post-convoy pass.purge-quick-login-from-loginpage(P2 hygiene).pages/login.jslines 172 + 184 still invokehandleQuickLogin('alice@deckhearth.com', 'alice123')andhandleQuickLogin('bob@deckhearth.com', 'bob123')— client-side dev-convenience buttons that ship the legacy literals to production HTML. NOT in scope here (convoy spec is "scripts + docs only; do NOT touch pages/**"). Either delete the section or gate it behindNODE_ENV === 'development'with a non-shipping credential source; either path is architect-worth.Made with Cursor
The latest updates on your projects. Learn more about Vercel for GitHub.
Pipeline Health
Build + CI gates
Build runs on Vercel; this CI runs lint and schema-map drift only (no duplicate build).
Role reports
See individual comments above for details. This rollup updates automatically.