fix: block legacy SMS auth providers in readiness

This commit is contained in:
Codex
2026-07-04 00:36:28 +08:00
parent ae491f592b
commit c71768fdb0
2 changed files with 70 additions and 25 deletions

View File

@@ -255,19 +255,11 @@ function validateAuthProviderPublicConfig(row) {
}
if (providerIn(provider, AUTH_PROVIDER_ALIASES.aliyun)) {
blockMissingPublicConfig(row, missingPublicKeyGroups(configPublic, [
{ label: 'signName', keys: ['signName'] },
{ label: 'templateCode', keys: ['templateCode'] },
]));
validateProviderUrl({
id: `db.auth.${safeProviderName(row.provider)}.endpoint`,
value: publicString(configPublic, ['endpoint']),
allowedHosts: ['aliyuncs.com'],
block(
`db.auth.${safeProviderName(row.provider)}.legacy_sms_provider`,
'Traditional Aliyun SMS auth provider must not be active/testing in production; use aliyun-pnvs',
details,
});
if (!publicString(configPublic, ['regionId'])) {
warn(`db.auth.${safeProviderName(row.provider)}.region`, 'Aliyun SMS regionId is not set; default cn-hangzhou will be used', details);
}
);
return;
}
@@ -296,20 +288,11 @@ function validateAuthProviderPublicConfig(row) {
}
if (providerIn(provider, AUTH_PROVIDER_ALIASES.tencent)) {
blockMissingPublicConfig(row, missingPublicKeyGroups(configPublic, [
{ label: 'smsSdkAppId/appId', keys: ['smsSdkAppId', 'appId'] },
{ label: 'signName', keys: ['signName'] },
{ label: 'templateId', keys: ['templateId'] },
]));
validateProviderUrl({
id: `db.auth.${safeProviderName(row.provider)}.endpoint`,
value: publicString(configPublic, ['endpoint']),
allowedHosts: ['tencentcloudapi.com'],
block(
`db.auth.${safeProviderName(row.provider)}.legacy_sms_provider`,
'Tencent SMS auth provider must not be active/testing in production; use aliyun-pnvs',
details,
});
if (!publicString(configPublic, ['region'])) {
warn(`db.auth.${safeProviderName(row.provider)}.region`, 'Tencent SMS region is not set; default ap-guangzhou will be used', details);
}
);
return;
}