forked from wangziqi/gongxue-base
feat: add platform audit alert notifications
This commit is contained in:
@@ -20,6 +20,7 @@ const safeBaseEnv = {
|
||||
WORKER_ASSET_SECURITY_SCAN_HTTP_ENDPOINT: 'https://scanner.gongxue100.com/api/scan',
|
||||
WORKER_ASSET_SECURITY_SCAN_HTTP_TOKEN: 's3cure-asset-scanner-token-2026-06-30-abcdef',
|
||||
WORKER_ASSET_SECURITY_SCAN_FAIL_OPEN: 'false',
|
||||
WORKER_PLATFORM_AUDIT_NOTIFICATION_ALLOW_INSECURE_LOCALHOST: 'false',
|
||||
};
|
||||
|
||||
const safeApiEnv = {
|
||||
@@ -78,6 +79,17 @@ const unsafeWorkerScanner = runImport(workerConfigUrl, {
|
||||
assert.notEqual(unsafeWorkerScanner.status, 0, 'production worker config should require external scanner');
|
||||
assert.match(unsafeWorkerScanner.output, /WORKER_ASSET_SECURITY_SCANNER must include http/, 'worker config should require http scanner');
|
||||
|
||||
const unsafeWorkerPlatformAuditNotification = runImport(workerConfigUrl, {
|
||||
...safeBaseEnv,
|
||||
WORKER_PLATFORM_AUDIT_NOTIFICATION_ALLOW_INSECURE_LOCALHOST: 'true',
|
||||
});
|
||||
assert.notEqual(unsafeWorkerPlatformAuditNotification.status, 0, 'production worker config should reject platform audit notification localhost mode');
|
||||
assert.match(
|
||||
unsafeWorkerPlatformAuditNotification.output,
|
||||
/WORKER_PLATFORM_AUDIT_NOTIFICATION_ALLOW_INSECURE_LOCALHOST=true/,
|
||||
'worker config should name unsafe platform audit notification localhost mode',
|
||||
);
|
||||
|
||||
const safeWorker = runImport(workerConfigUrl, safeBaseEnv);
|
||||
assert.equal(safeWorker.status, 0, `safe production worker config should load: ${safeWorker.output}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user