fix(libhttp): 修复P1-5静态文件路径遍历 + 同步审计文档

- 新增 isSafeStaticPath() 校验静态文件路径,拒绝 ..、空字节、非/开头及URL编码遍历(%2e/%2f/%5c)
- handleRequest 静态文件服务前校验 target_path
- 审计文档标记 P1-5 已修复
This commit is contained in:
qing committed 2026-08-04 00:04:55 +08:00
1 parent da4957c52d
commit fb485ebac4
3 files changed
+26 -5

No files matched your search

+1
View File
@@ -167,6 +167,7 @@ private:
std::mutex sessions_mutex_;
std::unordered_map<std::string, std::string> parseQueryParams(const std::string& query);
bool isSafeStaticPath(const std::string& path) const;
std::regex wildcardToRegex(const std::string& pattern);
bool matchPath(const std::string& path, const std::regex& pattern);
http::response<http::string_body> handleRequest(const http::request<http::string_body>& req);