Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:lock: https://github.com/siyuan-note/siyuan/security/advisories/GHSA-j7wh-x834-p3r7

Danield5e2d0bce0df
diff --git a/kernel/api/search.go b/kernel/api/search.go
index a22cf25fa8..fbb845792b 100644
--- a/kernel/api/search.go
+++ b/kernel/api/search.go
@@ -396,6 +396,14 @@ func fullTextSearchBlock(c *gin.Context) {
}
page, pageSize, query, paths, boxes, types, method, orderBy, groupBy := parseSearchBlockArgs(arg)
+
+ // SQL mode requires admin privileges, consistent with /api/query/sql
+ if method == 2 && !model.IsAdminRoleContext(c) {
+ ret.Code = -1
+ ret.Msg = "SQL search requires administrator privileges"
+ return
+ }
+
blocks, matchedBlockCount, matchedRootCount, pageCount, docMode := model.FullTextSearchBlock(query, boxes, paths, types, method, orderBy, groupBy, page, pageSize)
if model.IsReadOnlyRoleContext(c) {
publishAccess := model.GetPublishAccess()