漏洞概述 该网页截图展示了一个关于多租户运行时上下文和可插拔安全后端的代码提交。主要涉及对AdLoop运行时环境的改进,包括本地模式下的配置加载、服务器模式的配置解析、计划存储、认证提供者接口、以及SSRF(服务器端请求伪造)防护等。 影响范围 多租户运行时上下文:影响AdLoop的本地和服务器模式下的配置加载和解析。 计划存储:影响基于租户的计划存储,确保每个租户的草稿不会被其他租户看到。 认证提供者接口:影响本地和服务器模式下的认证流程,特别是OAuth和Google API认证。 SSRF防护:影响AdLoop的URL验证和图像资产处理,防止恶意URL导致的安全问题。 修复方案 1. 多租户运行时上下文: - 本地模式:从 加载配置,服务器模式:每个请求解析配置。 - 服务器模式:模块级配置移除,所有工具解析配置通过当前配置。 - 导入AdLoop服务器现在侧效自由(无配置读取,无信号处理,无SDK补丁)。 2. 计划存储: - 计划存储:基于租户的计划键,每个租户的草稿不会被其他租户看到。 - 审计日志接口:使用租户标记的审计日志。 3. 认证提供者接口: - 本地提供者:拒绝服务器模式,OAuth回退仅在真实终端上启用。 - 服务器模式:使用 接口,本地提供者拒绝服务器模式,OAuth回退仅在真实终端上启用。 4. SSRF防护: - URL验证:拒绝解析到非公共地址的URL,防止SSRF攻击。 - 图像资产:检查阻止操作,防止恶意图像资产。 POC代码或利用代码 ```python def _get_credentials_path(config: AdLoopConfig) -> Path """Resolve OAuth client credentials using a priority chain.""" return None def _get_gad_credentials(config: AdLoopConfig) -> Credentials: """Return authenticated credentials for GAA APIs.""" creds_path = _get_credentials_path(config) if creds_path is not None: import json with open(creds_path) as f: creds_info = json.load(f) if creds_info.get("type") == "service_account": from google.oauth2 import service_account return service_account.Credentials.from_service_account_file( str(creds_path), scopes=_GAD_SCOPES, ) return _oauth_flow(config, creds_path) import google.auth credentials, _ = google.auth.default(scopes=_GAD_SCOPES) return credentials def _get_ads_credentials(config: