docs: annotate Foundry source and deployment lifecycle in Chinese [skip ci]
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// 本文件记录研究 API 的回归契约;测试注释描述实际断言,不代表本次已运行测试。
|
||||
package research
|
||||
|
||||
import (
|
||||
@@ -8,6 +9,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestStoredAuthorShapes 覆盖姓名字符串及一到四项作者元组,验证姓名重排、机构忽略、空数组和坏结构拒绝。
|
||||
func TestStoredAuthorShapes(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
raw string
|
||||
@@ -35,6 +37,7 @@ func TestStoredAuthorShapes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestQueryValuesRemainBound 将攻击性文本当作普通搜索词,断言它只进入参数而不拼入 SQL,并检查全文/作者/主题分支。
|
||||
func TestQueryValuesRemainBound(t *testing.T) {
|
||||
query := `graph'); DROP TABLE papers; -- OR author:*`
|
||||
where, args := whereClause(Filters{Query: query, Topic: "cs.LG", SearchIn: "text"})
|
||||
@@ -58,6 +61,7 @@ func TestQueryValuesRemainBound(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestSchemaCannotEscapeQualification 验证 schema 名白名单与 nil 连接拒绝,并检查所有占位符都被限定到同一 schema。
|
||||
func TestSchemaCannotEscapeQualification(t *testing.T) {
|
||||
for _, name := range []string{"", `research";DROP SCHEMA public;--`, "a.b", "Public", strings.Repeat("a", 37)} {
|
||||
if _, err := NewPostgresRepository(&sql.DB{}, name); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user