跳到正文
Skillpedia
安全75k · #3035

stack-trace-exposure

它能做什么

这个技能检查服务器代码和 API 响应中的错误处理,确保详细的错误信息被私下记录,而不是展示给用户。它面向希望减少攻击者能从应用中获取信息的开发者。

适用场景

  • ✓你请智能体检查 API 或服务器代码中的错误处理是否安全的时候。
  • ✓线上错误响应中包含堆栈跟踪、文件路径或库的细节的时候。
  • ✓你希望有一个统一的错误处理程序来处理所有路由的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/stack-trace-exposure/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/stack-trace-exposure/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“出错时,我的 API 会把完整的错误堆栈发送到浏览器。请帮我改成显示安全的提示,并把细节私下记录下来吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会找出原始错误对象、堆栈跟踪或内部路径被发送到客户端的地方。它会添加一个统一的错误处理程序,在服务器上记录完整细节,并返回通用消息,同时附带一个关联 ID,以便将日志与用户反馈对应起来。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Prevent stack trace exposure in production error responses

Stack traces reveal file paths, function names, library versions, and sometimes database schema or configuration details. An attacker uses this information to identify the exact version of a framework or ORM, look up known CVEs for that version, and craft a targeted exploit. OWASP lists "Security Logging and Monitoring Failures" (A09) as a top-10 risk partly because organisations often expose this information without realising it.

Quick Reference

  • Never return raw error objects or stack traces in API responses
  • Log full error details server-side; send only a generic message to the client
  • Use a central error handler to ensure consistent sanitisation across all routes
  • Assign correlation IDs so support teams can match client-visible errors to server logs

Check

Check whether production API error responses include stack traces, file paths, or internal implementation details.

Fix

Implement a central error handler that logs full details server-side and returns only a sanitised, generic error message to the client.

Explain

Explain what information stack traces reveal and how attackers use that information to identify and exploit vulnerabilities.

Code Review

Review error handlers, catch blocks, and API response code. Flag any location where error.stack, error.message (raw), or internal paths are serialised directly into a response body.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/security/stack-trace-exposure

常见问题

为什么堆栈跟踪有风险?

这个技能说,它们可能泄露攻击者用来寻找已知弱点的文件路径、函数名和库版本。

什么是关联 ID?

这个技能建议将它作为参考代码,以便支持团队能将访客的错误与服务器日志对应起来。

这涵盖 OWASP 的指导吗?

这个技能提到了 OWASP 关于日志和监控风险的说明作为依据,但它的检查重点是响应中暴露了什么。

详情

作者的原始描述

Use when reviewing error handling middleware, API route handlers, or server responses for security-sensitive information disclosure.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#3035
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能