Loading...
Loading...
Compare original and translation side by side
../codeprobe/shared-preamble.md../codeprobe/references/full../codeprobe/shared-preamble.md../codeprobe/references/fullcodeprobe-securitySECHandler.phpcodeprobe-securitycodeprobe-securitySECHandler.phpcodeprobe-security| ID Prefix | What to Detect | How to Detect | Severity |
|---|---|---|---|
| Empty catch blocks | Search for | Major |
| Catch-log-only without handling | Find catch blocks that only contain a log/print statement but don't rethrow, return an error, or take any recovery action. The exception is swallowed after logging. | Minor |
| Overly broad exception catching | | Major |
| ID前缀 | 检测内容 | 检测方式 | 严重程度 |
|---|---|---|---|
| 空catch块 | 搜索空主体的 | 主要 |
| 仅记录日志但不处理的catch块 | 查找仅包含日志/打印语句,但不重新抛出、返回错误或采取任何恢复操作的catch块。异常在记录日志后被吞掉。 | 次要 |
| 过于宽泛的异常捕获 | | 主要 |
| ID Prefix | What to Detect | How to Detect | Severity |
|---|---|---|---|
| External API calls without try/catch | Search for HTTP client calls (Guzzle, axios, fetch, requests, HttpClient), payment SDK calls (Stripe, PayPal), AWS SDK calls, and other external service integrations. Flag when these calls are NOT wrapped in try/catch or .catch(). | Major |
| Unhandled promise rejections | Search for async functions or promise chains without | Major |
| File I/O without error handling | | Minor |
| ID前缀 | 检测内容 | 检测方式 | 严重程度 |
|---|---|---|---|
| 外部API调用未包裹try/catch | 搜索HTTP客户端调用(Guzzle、axios、fetch、requests、HttpClient)、支付SDK调用(Stripe、PayPal)、AWS SDK调用及其他外部服务集成。当这些调用未被try/catch或.catch()包裹时进行标记。 | 主要 |
| 未处理的Promise拒绝 | 搜索未配置 | 主要 |
| 文件I/O操作未做错误处理 | | 次要 |
| ID Prefix | What to Detect | How to Detect | Severity |
|---|---|---|---|
| Generic error messages | API responses returning only "Something went wrong", "Internal server error", or similar without error codes or actionable detail for the client. | Minor |
| Leaking internal errors to API consumers | Exception messages, stack traces, SQL errors, or file paths exposed in API JSON/HTML responses. Check error handling middleware configuration. | Major |
| Missing structured error responses | API endpoints returning errors without consistent structure (no error code field, no message field, inconsistent formats across endpoints). | Minor |
| ID前缀 | 检测内容 | 检测方式 | 严重程度 |
|---|---|---|---|
| 通用错误消息 | API响应仅返回"Something went wrong"、"Internal server error"或类似内容,未提供错误码或可供客户端操作的详细信息。 | 次要 |
| 向API消费者泄露内部错误 | API的JSON/HTML响应中暴露异常消息、堆栈跟踪、SQL错误或文件路径。检查错误处理中间件的配置。 | 主要 |
| 缺失结构化错误响应 | API端点返回的错误无一致结构(无错误码字段、无消息字段、端点间格式不一致)。 | 次要 |
| ID Prefix | What to Detect | How to Detect | Severity |
|---|---|---|---|
| External service calls without timeout | HTTP client calls without timeout configuration. Guzzle without | Major |
| No retry for transient failures | External API calls that could fail transiently (HTTP 429, 503, network errors) with no retry mechanism. | Minor |
| No circuit breaker for cascading failures | Service-to-service calls in microservice architectures with no circuit breaker or fallback pattern. | Suggestion |
| ID前缀 | 检测内容 | 检测方式 | 严重程度 |
|---|---|---|---|
| 外部服务调用未设置超时 | 未配置超时的HTTP客户端调用。Guzzle未设置 | 主要 |
| 瞬态故障未配置重试 | 可能发生瞬态故障(HTTP 429、503、网络错误)的外部API调用未配置重试机制。 | 次要 |
| 未配置断路器以防止级联故障 | 微服务架构中的服务间调用未使用断路器或降级模式。 | 建议 |
| ID Prefix | What to Detect | How to Detect | Severity |
|---|---|---|---|
| Missing input validation before processing | Functions that accept external input (request params, file contents, API payloads) and use them directly without validation. | Major |
| Implicit null assumptions | Accessing properties or calling methods on values that could be null/undefined without null checks. Chaining | Minor |
| Type coercion bugs | PHP | Minor |
| ID前缀 | 检测内容 | 检测方式 | 严重程度 |
|---|---|---|---|
| 处理前缺失输入验证 | 接收外部输入(请求参数、文件内容、API负载)并直接使用,未做验证的函数。 | 主要 |
| 隐式空值假设 | 访问可能为null/undefined的值的属性或调用其方法,未做空值检查。对可能为null的返回值进行链式 | 次要 |
| 类型转换漏洞 | PHP中在安全敏感比较时使用 | 次要 |
| ID Prefix | What to Detect | How to Detect | Severity |
|---|---|---|---|
| Multi-step DB ops without transactions | Multiple | Critical |
| Transaction without proper rollback | Transaction blocks that catch exceptions but don't rollback, or that have code after the transaction that assumes success without checking. | Major |
| ID前缀 | 检测内容 | 检测方式 | 严重程度 |
|---|---|---|---|
| 多步骤数据库操作未使用事务 | 连续执行多个 | 严重 |
| 事务未配置正确回滚 | 捕获异常但不执行回滚的事务块,或事务后存在假设操作成功而未做检查的代码。 | 主要 |
| ID Prefix | What to Detect | How to Detect | Severity |
|---|---|---|---|
| No logging on critical failure paths | Catch blocks in critical business logic (payment, auth, order processing) that don't include any logging. Failures happen silently. | Major |
| Missing correlation/request IDs | Log statements in request-handling code without correlation ID, request ID, or trace ID. Makes debugging distributed issues impossible. | Minor |
| ID前缀 | 检测内容 | 检测方式 | 严重程度 |
|---|---|---|---|
| 关键故障路径无日志记录 | 关键业务逻辑(支付、认证、订单处理)中的catch块未包含任何日志记录。故障会静默发生。 | 主要 |
| 缺失关联/请求ID | 请求处理代码中的日志语句未包含关联ID、请求ID或跟踪ID。这会导致无法调试分布式问题。 | 次要 |
ERR-ERR-001ERR-002ERR-ERR-001ERR-002PaymentService@charge\Stripe\Exception\ApiErrorException$orderId$amountPaymentFailedExceptionDB::transaction()OrderService@createapp/Services/NotificationService.php:88ExternalApiClient.php:30->timeout(10)->retry(3, 100)PaymentService@charge\Stripe\Exception\ApiErrorException$orderId$amountPaymentFailedExceptionOrderService@createDB::transaction()app/Services/NotificationService.php:88ExternalApiClient.php:30->timeout(10)->retry(3, 100)