修复SQLite替换操作绕过资源引用保护并补充回归测试
This commit is contained in:
1 parent
cad238a5e8
commit
92c844fb23
8 files changed
+246
-2
No files matched your search
@@ -241,7 +241,7 @@ func assertSQLiteCLIUpgradeUsable(t *testing.T, fixture sqliteBusinessFixture) {
|
||||
}
|
||||
defer db.Close()
|
||||
var version, bindings int
|
||||
if err := db.DB.QueryRowContext(t.Context(), "SELECT MAX(version) FROM schema_migrations").Scan(&version); err != nil || version != 11 {
|
||||
if err := db.DB.QueryRowContext(t.Context(), "SELECT MAX(version) FROM schema_migrations").Scan(&version); err != nil || version != 12 {
|
||||
t.Fatalf("正式应用入口未完成历史升级:%d,%v", version, err)
|
||||
}
|
||||
project, err := repository.NewSQLProjectRepository(db.DB).GetProject(t.Context(), domain.DefaultProjectID)
|
||||
@@ -259,6 +259,8 @@ func assertSQLiteCLIUpgradeUsable(t *testing.T, fixture sqliteBusinessFixture) {
|
||||
`DELETE FROM projects WHERE id = 'default'`,
|
||||
`UPDATE domains SET project_id = 'missing' WHERE id = 'domain'`,
|
||||
`UPDATE domain_servers SET server_id = 'missing' WHERE domain_id = 'domain'`,
|
||||
`INSERT OR REPLACE INTO projects (id, name, description) VALUES ('default', '不应覆盖', '')`,
|
||||
`INSERT OR REPLACE INTO domains (rowid, id, name, certificate_type, sans_json, status) SELECT rowid, 'replacement', 'replacement.example.test', certificate_type, sans_json, status FROM domains WHERE id = 'domain'`,
|
||||
} {
|
||||
if _, err := db.DB.ExecContext(t.Context(), statement); err == nil {
|
||||
t.Fatalf("恢复后的项目引用保护失效:%s", statement)
|
||||
|
||||
Reference in new issue
Block a user