fix: require PNVS SMS provider in production

This commit is contained in:
Codex
2026-07-04 00:24:57 +08:00
parent 6cf92358e0
commit a6ffb6b962
4 changed files with 55 additions and 25 deletions

View File

@@ -27,7 +27,7 @@ const safeBaseEnv = {
const safeApiEnv = {
...safeBaseEnv,
CORS_ORIGIN: 'https://student.gongxue100.com,https://tenant-admin.gongxue100.com,https://platform-admin.gongxue100.com',
AUTH_SMS_PROVIDER: 'aliyun',
AUTH_SMS_PROVIDER: 'aliyun-pnvs',
AUTH_CODE_PEPPER: 's3cure-prod-code-pepper-2026-06-30-abcdef',
AUTH_SESSION_SECRET: 's3cure-prod-session-secret-2026-06-30-ghijkl',
AUTH_JWT_JWKS_URL: 'https://auth.gongxue100.com/auth/v1/.well-known/jwks.json',
@@ -69,8 +69,19 @@ const unsafeApiSmsProvider = runImport(apiConfigUrl, {
assert.notEqual(unsafeApiSmsProvider.status, 0, 'production API config should reject unsupported SMS provider');
assert.match(
unsafeApiSmsProvider.output,
/AUTH_SMS_PROVIDER must be aliyun\/aliyun-sms, aliyun-pnvs, or tencent\/tencent-sms/,
'API config should name supported production SMS providers',
/AUTH_SMS_PROVIDER must be aliyun-pnvs in production/,
'API config should require PNVS for production SMS',
);
const unsafeApiTraditionalSmsProvider = runImport(apiConfigUrl, {
...safeApiEnv,
AUTH_SMS_PROVIDER: 'aliyun',
});
assert.notEqual(unsafeApiTraditionalSmsProvider.status, 0, 'production API config should reject traditional Aliyun SMS provider');
assert.match(
unsafeApiTraditionalSmsProvider.output,
/AUTH_SMS_PROVIDER must be aliyun-pnvs in production/,
'API config should reject non-PNVS SMS providers in production',
);
const unsafeApiStoragePublicBaseUrl = runImport(apiConfigUrl, {