dnfs2 基于 libhttp + libmsg + boost::json 重写 Python dnfs,接口完全兼容: - 4 个路由 (get_notes/add_note/delete_note/update_note) + 特殊节点 (link/js/image/file) - Token 验签经 gateway /whoami (fail-closed 503) - AI 内容审核 fail-closed - AsyncQueue 异步日志 → db2 Logs 表 - 安全响应头 (CSP/X-Frame-Options 等) 修复 dnfs 继承的 6 项 P0/P1: - P0-4 统一 _call_db() 检查 success 后再访问 data - P1-6 setMaxBodySize(10MB) - P1-7 日志客户端复用主配置 - P1-8 update_note pid≠0 校验父节点存在 - P1-9 RpcClient retry_on_refused=true - P1-11 note_id 显式 as_int64() + 类型校验 审计新发现并修复 4 项: - P1-N1 stop_watcher detach 改 join,修复 use-after-free (CWE-416) - P1-N2 main() 添加 curl_global_init,修复多线程首次 curl_easy_init 竞态 (CWE-362) - P2-N3 delete_note 分离 db 错误(500) 和子节点检查(400) - P2-N4 threads 上限 256,对齐项目约定 安全评级 A-,6 项已知限制已记录。
27 lines
701 B
Makefile
27 lines
701 B
Makefile
CPP = g++
|
|
CPPFLAGS = -std=c++20 -O3 -Wall -Werror -pipe
|
|
INCS = -I ../libhttp/inc -I ../libmsg/inc -I /opt/homebrew/include
|
|
LIBS = -L ../libhttp/build -L ../libmsg/build -L /opt/homebrew/lib \
|
|
-lus_http -lus_httpclient -lus_msg -lboost_json \
|
|
-lssl -lcrypto -lcurl -lpthread
|
|
RPATH = -Wl,-rpath,'$$ORIGIN/../../libhttp/build' \
|
|
-Wl,-rpath,'$$ORIGIN/../../libmsg/build' \
|
|
-Wl,-rpath,/opt/homebrew/lib
|
|
|
|
BUILD = build
|
|
TARGET = $(BUILD)/dnfs2
|
|
SRC = src/dnfs2.cpp
|
|
|
|
all: $(TARGET)
|
|
|
|
$(BUILD):
|
|
mkdir -p $(BUILD)
|
|
|
|
$(TARGET): $(SRC) | $(BUILD)
|
|
$(CPP) $(CPPFLAGS) $(INCS) -o $@ $< $(LIBS) $(RPATH)
|
|
|
|
clean:
|
|
rm -f $(TARGET)
|
|
|
|
.PHONY: all clean
|