Fix Unicode env parsing in infra_secrets for stage startup.
CI / test (push) Successful in 18m50s

Use unicode:characters_to_binary for os:getenv values so Cyrillic placeholder passwords fail with weak_secret instead of badarg crash.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-10 19:29:17 +03:00
parent 76f52030d1
commit 14c0ac9220
2 changed files with 14 additions and 4 deletions
+7 -1
View File
@@ -26,7 +26,8 @@ infra_secrets_test_() ->
{"stage rejects missing JWT_SECRET", fun test_stage_missing_jwt/0},
{"stage rejects weak JWT_SECRET", fun test_stage_weak_jwt/0},
{"stage accepts strong secrets", fun test_stage_strong_ok/0},
{"require_admin_seed_password rejects 123456", fun test_weak_admin_password/0}
{"require_admin_seed_password rejects 123456", fun test_weak_admin_password/0},
{"require_admin_seed_password rejects cyrillic placeholder", fun test_cyrillic_placeholder_password/0}
]}.
test_dev_missing_ok() ->
@@ -60,3 +61,8 @@ test_weak_admin_password() ->
os:putenv("ADMIN_PASSWORD", "123456"),
?assertMatch({error, {weak_secret, 'ADMIN_PASSWORD'}},
infra_secrets:require_admin_seed_password("ADMIN_PASSWORD")).
test_cyrillic_placeholder_password() ->
os:putenv("ADMIN_PASSWORD", "замените"),
?assertMatch({error, {weak_secret, 'ADMIN_PASSWORD'}},
infra_secrets:require_admin_seed_password("ADMIN_PASSWORD")).