( workspaceDir: string, logger: LoggerLike, config: OpenClawConfig, )
| 871 | } |
| 872 | |
| 873 | export function detectMisConfiguration( |
| 874 | workspaceDir: string, |
| 875 | logger: LoggerLike, |
| 876 | config: OpenClawConfig, |
| 877 | ): Warning | null { |
| 878 | logger?.info(`[FoundationScan] start misconfiguration scan, workspace=${workspaceDir}`); |
| 879 | if (!config) { |
| 880 | logger?.error("[FoundationScan] no config provided, skip misconfiguration scan."); |
| 881 | return null; |
| 882 | } |
| 883 | |
| 884 | const gatewayExposureIssue = detectGatewayExposureMisconfiguration(config); |
| 885 | if (gatewayExposureIssue) { |
| 886 | logger?.info(`[FoundationScan] misconfiguration blocked: ${gatewayExposureIssue.replace(/\n/g, " | ")}`); |
| 887 | return createMisConfigurationWarning(gatewayExposureIssue); |
| 888 | } |
| 889 | |
| 890 | const accessControlIssue = detectAccessControlMisconfiguration(config); |
| 891 | if (accessControlIssue) { |
| 892 | logger?.info(`[FoundationScan] misconfiguration blocked: ${accessControlIssue.replace(/\n/g, " | ")}`); |
| 893 | return createMisConfigurationWarning(accessControlIssue); |
| 894 | } |
| 895 | |
| 896 | logger?.info("[FoundationScan] misconfiguration scan completed, no warning."); |
| 897 | return null; |
| 898 | } |
| 899 | |
| 900 | export async function detectFoundationScan( |
| 901 | workspaceDir: string, |
no test coverage detected