Skip to content

Comments

Enhance security of authentication signals and credential tests.#8

Merged
ohmzi merged 1 commit intomasterfrom
develop
Feb 24, 2026
Merged

Enhance security of authentication signals and credential tests.#8
ohmzi merged 1 commit intomasterfrom
develop

Conversation

@ohmzi
Copy link
Owner

@ohmzi ohmzi commented Feb 24, 2026

This update improves the robustness of security signal hashing by replacing the static fallback secret with a process-scoped random key when AUTH_SECRET is missing. It also enhances test reliability by using randomized credentials and CSRF tokens.

  • Replace static HASH_FALLBACK_SECRET with a dynamically generated randomBytes hash to prevent deterministic signal hashing in environments without a configured secret.
  • Add a console warning to notify when the system falls back to a process-scoped hash key due to a missing AUTH_SECRET.
  • Update authCredentialEnvelope.test.ts to use random bytes for both the password and CSRF token instead of hardcoded strings.
  • Import randomBytes in clientSignals.ts for secure key generation.

This update improves the robustness of security signal hashing by replacing the static fallback secret with a process-scoped random key when `AUTH_SECRET` is missing. It also enhances test reliability by using randomized credentials and CSRF tokens.

- Replace static `HASH_FALLBACK_SECRET` with a dynamically generated `randomBytes` hash to prevent deterministic signal hashing in environments without a configured secret.
- Add a console warning to notify when the system falls back to a process-scoped hash key due to a missing `AUTH_SECRET`.
- Update `authCredentialEnvelope.test.ts` to use random bytes for both the password and CSRF token instead of hardcoded strings.
- Import `randomBytes` in `clientSignals.ts` for secure key generation.
@ohmzi ohmzi merged commit 93b9d9a into master Feb 24, 2026
1 check was pending
@deepsource-io
Copy link

deepsource-io bot commented Feb 24, 2026

DeepSource Code Review

We reviewed changes in 79e61d8...81ed70d on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Secrets Feb 24, 2026 4:37p.m. Review ↗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant