Skip to content

Commit

Permalink
fix(server/(config): add config validation for session_secret
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 committed Nov 13, 2024
1 parent f11d782 commit d9fd5fd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/ott-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,14 @@ export function validateConfig(): Result<void, Error> {
return err(new Error("Invalid configuration."));
}

if (conf.get("session_secret").length < 80) {
log.error(
"session_secret must be at least 80 characters long. Use a password generator to generate a secure alphanumeric secret."
);
log.error("This can also be set with the SESSION_SECRET environment variable.");
return err(new Error("Invalid configuration."));
}

Check warning on line 530 in server/ott-config.ts

View check run for this annotation

Codecov / codecov/patch

server/ott-config.ts#L523-L530

Added lines #L523 - L530 were not covered by tests
return ok(undefined);
}

Expand Down

0 comments on commit d9fd5fd

Please sign in to comment.