@code-sentinel-cli/code-sentinel-cli 3.0.11 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +46121 -41067
- package/dist/builtin-rules/ai/angular/api-service-contract-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/angular/component-state-flow.prompt.md +2 -2
- package/dist/builtin-rules/ai/angular/cross-feature-api-drift.prompt.md +2 -2
- package/dist/builtin-rules/ai/angular/cross-feature-route-permission-drift.prompt.md +2 -2
- package/dist/builtin-rules/ai/angular/reactive-form-flow.prompt.md +2 -2
- package/dist/builtin-rules/ai/angular/route-permission-flow.prompt.md +2 -2
- package/dist/builtin-rules/ai/angular/rxjs-flow-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/angular/template-contract-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/flutter/dynamic-content-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/flutter/feature-state-flow-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/flutter/native-platform-consistency-risk.prompt.md +2 -3
- package/dist/builtin-rules/ai/flutter/network-auth-flow-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/flutter/ui-responsive-accessibility-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/general/code-clarity.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/business-invariant-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/cache-consistency-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/cross-feature-error-handling-drift.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/cross-feature-transaction-boundary-drift.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/error-handling-completeness.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/event-publishing-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/import-template-contract-risk.prompt.md +74 -0
- package/dist/builtin-rules/ai/spring-boot/import-template-contract-risk.rule.yaml +24 -0
- package/dist/builtin-rules/ai/spring-boot/io-boundary-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/native-dml-consistency-risk.prompt.md +75 -0
- package/dist/builtin-rules/ai/spring-boot/native-dml-consistency-risk.rule.yaml +24 -0
- package/dist/builtin-rules/ai/spring-boot/native-query-performance-risk.prompt.md +73 -0
- package/dist/builtin-rules/ai/spring-boot/native-query-performance-risk.rule.yaml +24 -0
- package/dist/builtin-rules/ai/spring-boot/ownership-scope-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/pagination-query-consistency-risk.prompt.md +75 -0
- package/dist/builtin-rules/ai/spring-boot/pagination-query-consistency-risk.rule.yaml +25 -0
- package/dist/builtin-rules/ai/spring-boot/pagination-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/partial-update-mapper-risk.prompt.md +73 -0
- package/dist/builtin-rules/ai/spring-boot/partial-update-mapper-risk.rule.yaml +24 -0
- package/dist/builtin-rules/ai/spring-boot/query-contract-risk.prompt.md +80 -0
- package/dist/builtin-rules/ai/spring-boot/query-contract-risk.rule.yaml +25 -0
- package/dist/builtin-rules/ai/spring-boot/query-date-boundary-risk.prompt.md +74 -0
- package/dist/builtin-rules/ai/spring-boot/query-date-boundary-risk.rule.yaml +24 -0
- package/dist/builtin-rules/ai/spring-boot/security-authorization-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/security-mass-assignment-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/security-redirect-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/security-sensitive-data-risk.prompt.md +9 -4
- package/dist/builtin-rules/ai/spring-boot/security-sensitive-data-risk.rule.yaml +6 -5
- package/dist/builtin-rules/ai/spring-boot/soft-delete-publication-consistency-risk.prompt.md +74 -0
- package/dist/builtin-rules/ai/spring-boot/soft-delete-publication-consistency-risk.rule.yaml +24 -0
- package/dist/builtin-rules/ai/spring-boot/transaction-loop-risk.prompt.md +2 -2
- package/dist/builtin-rules/ai/spring-boot/versioned-entity-concurrency-risk.prompt.md +73 -0
- package/dist/builtin-rules/ai/spring-boot/versioned-entity-concurrency-risk.rule.yaml +24 -0
- package/dist/index.d.ts +308 -250
- package/dist/index.js +46253 -41192
- package/package.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Bạn là senior Spring Boot reviewer. Chỉ đánh giá **tính đúng của paged/single-row result window**: ordering, value/count parity và page membership.
|
|
2
|
+
|
|
3
|
+
## CRITICAL RULES
|
|
4
|
+
|
|
5
|
+
- Rule này KHÔNG yêu cầu thêm pagination. `spring-boot/pagination-risk` sở hữu unbounded/findAll/unpaged/page-size bugs.
|
|
6
|
+
- `line` BẮT BUỘC trỏ vào PRIMARY file. Nếu query nằm trong support repository, dùng dòng PRIMARY gọi flow; nếu PRIMARY là repository, dùng dòng query/method.
|
|
7
|
+
- CHỈ report khi cluster cho thấy query/page implementation cụ thể và tác động đến page content/total/order.
|
|
8
|
+
- Không report generic index/full-scan/CTE cost hoặc sở thích sort.
|
|
9
|
+
- Không duplicate `query-contract-risk` cho scalar/list bind, column, join-key hoặc projection alias mismatch không liên quan paging.
|
|
10
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
11
|
+
|
|
12
|
+
## CHỈ REPORT KHI có paged-query correctness bug cụ thể
|
|
13
|
+
|
|
14
|
+
- `ORDER BY` không có unique/stable tie-breaker khi primary sort field có thể trùng theo evidence (timestamp/status/name/version), khiến row duplicate/missing giữa page.
|
|
15
|
+
- Query có `Pageable` nhưng không có default ordering và caller có thể gửi unsorted page, nên DB order bất định.
|
|
16
|
+
- `LIMIT 1`, `TOP 1`, `setMaxResults(1)`, `findFirst...` hoặc `findTop...` chọn một row nhưng thiếu explicit/derived unique ordering, nên cùng input có thể trả record khác nhau.
|
|
17
|
+
- `value` query và `countQuery` áp filter/join/date boundary khác nhau, làm content và `totalElements` mô tả hai tập record khác nhau.
|
|
18
|
+
- One-to-many JOIN nhân row trong value/count query; `DISTINCT`/grouping áp chỉ một phía hoặc không giữ entity uniqueness.
|
|
19
|
+
- Service load hard-limited page rồi mới filter requested ids/permission/status trong memory, gây valid row ngoài first window bị mất hoặc page metadata sai.
|
|
20
|
+
- Service thêm ancestor/root/synthetic rows vào page content nhưng không điều chỉnh page size/total/order contract.
|
|
21
|
+
|
|
22
|
+
## KHÔNG flag
|
|
23
|
+
|
|
24
|
+
- Unbounded list/export, missing page-size clamp, fake pagination do load full table: để `pagination-risk` nếu lỗi chỉ là result-window.
|
|
25
|
+
- Ordering có unique id/code tie-breaker hoặc DB query dùng deterministic keyset pagination.
|
|
26
|
+
- Count query bỏ fetch-only JOIN nhưng giữ cùng filter semantics.
|
|
27
|
+
- Pure query performance/index advice.
|
|
28
|
+
- Filter scope/auth thiếu nhưng page mechanics đúng; để ownership/authorization rules.
|
|
29
|
+
|
|
30
|
+
## Primary file
|
|
31
|
+
|
|
32
|
+
File: `{{file}}`
|
|
33
|
+
Language: `{{language}}`
|
|
34
|
+
|
|
35
|
+
```{{language}}
|
|
36
|
+
{{code}}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Support files cùng cluster
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
{{cluster_files}}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
{{cluster_summary}}
|
|
46
|
+
|
|
47
|
+
## Output yêu cầu
|
|
48
|
+
|
|
49
|
+
Trả về JSON hợp lệ duy nhất:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
{
|
|
53
|
+
"violations": [
|
|
54
|
+
{
|
|
55
|
+
"line": <số nguyên dương, 1-based, trong PRIMARY>,
|
|
56
|
+
"endLine": <số nguyên dương | null>,
|
|
57
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, nêu page ordering/count/membership bị sai>",
|
|
58
|
+
"suggestion": "<gợi ý stable ordering/parity bằng tiếng Việt có dấu | null>",
|
|
59
|
+
"confidence": <số nguyên 0-100>
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Không có lỗi rõ ràng: `{"violations": []}`.
|
|
66
|
+
|
|
67
|
+
## REPEAT CRITICAL RULES
|
|
68
|
+
|
|
69
|
+
- Chỉ xét paged hoặc single-row result window; unbounded result thuộc `pagination-risk`.
|
|
70
|
+
- `line` phải thuộc PRIMARY dù PRIMARY là controller, service hoặc repository.
|
|
71
|
+
- Cần user-visible page content/total/order impact, không báo performance/style.
|
|
72
|
+
- Không duplicate query-contract hoặc ownership/auth rules.
|
|
73
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
74
|
+
|
|
75
|
+
Không giải thích. JSON thuần.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
id: spring-boot/pagination-query-consistency-risk
|
|
2
|
+
version: 2
|
|
3
|
+
kind: ai
|
|
4
|
+
title: "Spring paged query có ordering/count/filter nhất quán không?"
|
|
5
|
+
description: |
|
|
6
|
+
Per-cluster AI rule for correctness defects in paginated or single-row-window queries:
|
|
7
|
+
non-deterministic ordering without a unique tie-breaker, value/count query
|
|
8
|
+
predicate drift, joins that multiply page rows, and filtering requested ids
|
|
9
|
+
only after a hard-limited page has been loaded, and LIMIT/TOP/findFirst
|
|
10
|
+
selection without deterministic ordering.
|
|
11
|
+
severity: warning
|
|
12
|
+
category: backend-pagination-correctness
|
|
13
|
+
languages: [java]
|
|
14
|
+
scope: spring-boot
|
|
15
|
+
baseConfidence: 58
|
|
16
|
+
prompt: ./pagination-query-consistency-risk.prompt.md
|
|
17
|
+
contextScope: per-cluster
|
|
18
|
+
aiConfig:
|
|
19
|
+
tier: regular
|
|
20
|
+
prRouting:
|
|
21
|
+
group: spring-data-consistency-group
|
|
22
|
+
targetLayers: [controller, service, repository]
|
|
23
|
+
triggers: ["Pageable", "PageRequest", "countQuery", "ORDER BY", "PageImpl", "DISTINCT", "ROW_NUMBER", "totalElements", "LIMIT 1", "TOP 1", "findFirst", "findTop", "ids"]
|
|
24
|
+
riskWeight: 4
|
|
25
|
+
requiresContext: [diff, primaryFile, relatedController, relatedService, relatedRepository]
|
|
@@ -61,8 +61,8 @@ Tra ve **JSON HOP LE DUY NHAT** (khong markdown fence, khong text khac) theo sch
|
|
|
61
61
|
{
|
|
62
62
|
"line": <so nguyen duong, 1-based, trong PRIMARY>,
|
|
63
63
|
"endLine": <so nguyen duong | null>,
|
|
64
|
-
"message": "
|
|
65
|
-
"suggestion": "<
|
|
64
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, nêu luồng list/search/export không giới hạn>",
|
|
65
|
+
"suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
|
|
66
66
|
"confidence": <so nguyen 0-100>
|
|
67
67
|
}
|
|
68
68
|
]
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Bạn là senior Spring Boot reviewer. Chỉ đánh giá **PATCH/partial-update/mapper write contract**.
|
|
2
|
+
|
|
3
|
+
## CRITICAL RULES
|
|
4
|
+
|
|
5
|
+
- CHỈ report khi cluster cho thấy request DTO đi qua mapper/copy helper rồi ghi vào persisted entity.
|
|
6
|
+
- `line` BẮT BUỘC trỏ về PRIMARY controller, tại endpoint/call kích hoạt unsafe mapper flow.
|
|
7
|
+
- Không gọi mọi DTO mapping là mass assignment. Phải nêu field phía server hoặc omitted-field semantics bị vi phạm.
|
|
8
|
+
- Không duplicate `security-mass-assignment-risk` cho `@RequestBody` JPA entity binding trực tiếp; rule này sở hữu DTO/mapper/PATCH flow.
|
|
9
|
+
- Không report style MapStruct, naming hoặc thiếu annotation nếu generated/manual behavior vẫn an toàn.
|
|
10
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
11
|
+
|
|
12
|
+
## CHỈ REPORT KHI có mapper contract bug cụ thể
|
|
13
|
+
|
|
14
|
+
- PATCH/partialUpdate copy null từ omitted DTO field xuống entity vì thiếu/mất `NullValuePropertyMappingStrategy.IGNORE`, `BeanUtils.copyProperties` ignore-list, hoặc equivalent guard.
|
|
15
|
+
- Mapper/copy helper cho phép request ghi `id`, parent/owner id, tenant/workspace/department, `deleted`, audit fields, workflow/status/approval fields, `isPublic`, lock, version, profile/refer code hoặc stored object path.
|
|
16
|
+
- Upload/derived server value được set trước, sau đó mapper ghi DTO null/blank/client value đè lại.
|
|
17
|
+
- Full update tạo detached entity và `save` có thể revive soft-deleted row, đổi parent/identity, hoặc reset server-controlled state.
|
|
18
|
+
- Mapper kế thừa/override method nhưng làm mất cấu hình ignore/allowlist của mapper cha, với evidence method đó được write flow gọi.
|
|
19
|
+
|
|
20
|
+
## KHÔNG flag
|
|
21
|
+
|
|
22
|
+
- DTO chỉ chứa user-editable fields hoặc mapper có explicit allowlist/ignore cho server fields.
|
|
23
|
+
- PUT replacement semantics cố ý cho phép null và contract hiện rõ; không áp PATCH semantics lên PUT.
|
|
24
|
+
- Mapper chỉ dùng cho response `toDto`, import staging chưa persist, hoặc test/generated code.
|
|
25
|
+
- Pure state-transition bug không đến từ mapper/copy; để `business-invariant-risk`.
|
|
26
|
+
- Pure owner/auth/query scope gap; để security/ownership rules.
|
|
27
|
+
|
|
28
|
+
## Primary file
|
|
29
|
+
|
|
30
|
+
File: `{{file}}`
|
|
31
|
+
Language: `{{language}}`
|
|
32
|
+
|
|
33
|
+
```{{language}}
|
|
34
|
+
{{code}}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Support files cùng cluster
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
{{cluster_files}}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
{{cluster_summary}}
|
|
44
|
+
|
|
45
|
+
## Output yêu cầu
|
|
46
|
+
|
|
47
|
+
Trả về JSON hợp lệ duy nhất:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
{
|
|
51
|
+
"violations": [
|
|
52
|
+
{
|
|
53
|
+
"line": <số nguyên dương, 1-based, trong PRIMARY>,
|
|
54
|
+
"endLine": <số nguyên dương | null>,
|
|
55
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, nêu mapper/copy flow và field bị ghi đè>",
|
|
56
|
+
"suggestion": "<gợi ý allowlist/null-ignore bằng tiếng Việt có dấu | null>",
|
|
57
|
+
"confidence": <số nguyên 0-100>
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Không có lỗi rõ ràng: `{"violations": []}`.
|
|
64
|
+
|
|
65
|
+
## REPEAT CRITICAL RULES
|
|
66
|
+
|
|
67
|
+
- Cần request DTO → mapper/copy → persisted entity evidence.
|
|
68
|
+
- `line` phải thuộc PRIMARY controller.
|
|
69
|
+
- Chỉ báo omitted-field overwrite hoặc server-controlled field assignment cụ thể.
|
|
70
|
+
- Không duplicate direct Entity binding, pure workflow, ownership hoặc style rule.
|
|
71
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
72
|
+
|
|
73
|
+
Không giải thích. JSON thuần.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
id: spring-boot/partial-update-mapper-risk
|
|
2
|
+
version: 1
|
|
3
|
+
kind: ai
|
|
4
|
+
title: "Spring partial update/mapper có ghi đè field phía server không?"
|
|
5
|
+
description: |
|
|
6
|
+
Per-cluster AI rule for PATCH and mapper contracts that overwrite omitted
|
|
7
|
+
values or copy server-controlled identity, audit, workflow, ownership,
|
|
8
|
+
publication, or version fields from request DTOs. It requires a visible
|
|
9
|
+
request-to-mapper-to-entity write flow.
|
|
10
|
+
severity: warning
|
|
11
|
+
category: backend-data-integrity
|
|
12
|
+
languages: [java]
|
|
13
|
+
scope: spring-boot
|
|
14
|
+
baseConfidence: 60
|
|
15
|
+
prompt: ./partial-update-mapper-risk.prompt.md
|
|
16
|
+
contextScope: per-cluster
|
|
17
|
+
aiConfig:
|
|
18
|
+
tier: regular
|
|
19
|
+
prRouting:
|
|
20
|
+
group: spring-data-consistency-group
|
|
21
|
+
targetLayers: [controller, service, mapper, dto, entity]
|
|
22
|
+
triggers: ["partialUpdate", "@BeanMapping", "NullValuePropertyMappingStrategy", "BeanUtils", "copyProperties", "toEntity", "PATCH", "@Mapping"]
|
|
23
|
+
riskWeight: 5
|
|
24
|
+
requiresContext: [diff, primaryFile, relatedController, relatedService, relatedMapper, relatedDto, relatedEntity]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Bạn là senior Spring Boot reviewer. Chỉ đánh giá **tính đúng của contract JPQL/native SQL/projection** trong review unit.
|
|
2
|
+
|
|
3
|
+
## CRITICAL RULES
|
|
4
|
+
|
|
5
|
+
- CHỈ report khi PRIMARY hoặc support files cung cấp bằng chứng cụ thể cho cả hai phía của mismatch. Không suy đoán schema hoặc business meaning không nhìn thấy.
|
|
6
|
+
- `line` BẮT BUỘC trỏ vào PRIMARY file. Nếu lỗi nằm trong support repository, dùng dòng PRIMARY gọi flow đó; nếu PRIMARY chính là repository, dùng dòng query/method.
|
|
7
|
+
- KHÔNG report SQL injection/string concatenation; `spring-boot/no-sql-string-concat` sở hữu lỗi đó.
|
|
8
|
+
- KHÔNG report query chậm, thiếu index, wildcard search, N+1 hoặc result không giới hạn; `native-query-performance-risk` sở hữu performance có bằng chứng.
|
|
9
|
+
- KHÔNG duplicate `pagination-query-consistency-risk` cho ordering/count-page drift hoặc `soft-delete-publication-consistency-risk` cho deleted/public/latest predicates.
|
|
10
|
+
- KHÔNG duplicate temporal boundary hoặc native UPDATE/DELETE contract; để `query-date-boundary-risk` và `native-dml-consistency-risk`.
|
|
11
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
12
|
+
|
|
13
|
+
## CHỈ REPORT KHI có query-contract bug cụ thể
|
|
14
|
+
|
|
15
|
+
- DTO/request/repository signature khai `List`/collection nhưng JPQL so sánh với field scalar bằng `=` thay vì `IN`, hoặc dùng collection trong ngữ cảnh scalar như `:ids IS NULL` khiến provider/DB bind sai.
|
|
16
|
+
- Named placeholder không có matching method parameter/`@Param`, `@Param` trỏ sai tên, hoặc Java parameter type không tương thích column/expression type theo entity/schema evidence.
|
|
17
|
+
- Empty collection/null parameter đi vào `IN`/`NOT IN`/optional-filter shape mà visible caller cho phép và provider/query semantics tạo lỗi runtime hoặc trả sai tập row.
|
|
18
|
+
- JPQL dùng property không tồn tại trên entity, hoặc native SQL dùng column/table không khớp entity/migration/schema evidence nhìn thấy trong cluster.
|
|
19
|
+
- Native query dùng function/cast/pagination syntax không được datasource dialect visible hỗ trợ (`DATE_TRUNC`, `IFNULL`, `NVL`, `ILIKE`, `LIMIT`/`TOP`/`ROWNUM`), không báo portability khi hệ thống chỉ khai đúng DB đó.
|
|
20
|
+
- JOIN dùng hai key khác semantics/type theo entity fields hoặc flow ghi dữ liệu nhìn thấy, khiến row không match hoặc match sai.
|
|
21
|
+
- `= NULL`, nullable `NOT IN`, hoặc predicate trên nullable side của `LEFT JOIN` đặt ở `WHERE` làm loại row trái với response/business contract visible.
|
|
22
|
+
- Native/JPQL projection alias không khớp getter/record constructor field, hoặc SELECT branches có số/thứ tự column không nhất quán.
|
|
23
|
+
- Cùng parameter/filter được khai và truyền nhưng query bỏ qua, gắn vào nhầm field, hoặc so enum bằng literal không tồn tại trong enum evidence.
|
|
24
|
+
- Scalar subquery có thể trả nhiều row, hoặc correlated subquery thiếu outer business/tenant key theo entity/query evidence khiến lấy dữ liệu của group khác.
|
|
25
|
+
- Aggregate/join có bằng chứng chắc chắn nhân bản row, thiếu required `GROUP BY`, dùng `WHERE` thay `HAVING`, đảo bucket, ghi vào nhầm alias/setter, hoặc trả null vào primitive contract.
|
|
26
|
+
|
|
27
|
+
## KHÔNG flag
|
|
28
|
+
|
|
29
|
+
- Query hợp lệ nhưng có thể tối ưu bằng index/CTE/full-text.
|
|
30
|
+
- Style như dùng raw string thay enum nếu chưa có bằng chứng literal drift hoặc lỗi runtime.
|
|
31
|
+
- Khác biệt có chủ đích giữa value/count query không ảnh hưởng tập row/page.
|
|
32
|
+
- Repository method chưa có caller trong cluster và không chứng minh được user-visible impact.
|
|
33
|
+
- Lỗi authorization, ownership, transaction, mapper, import parser hoặc generic validation.
|
|
34
|
+
|
|
35
|
+
## Primary file
|
|
36
|
+
|
|
37
|
+
File: `{{file}}`
|
|
38
|
+
Language: `{{language}}`
|
|
39
|
+
|
|
40
|
+
```{{language}}
|
|
41
|
+
{{code}}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Support files cùng cluster
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
{{cluster_files}}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
{{cluster_summary}}
|
|
51
|
+
|
|
52
|
+
## Output yêu cầu
|
|
53
|
+
|
|
54
|
+
Trả về JSON hợp lệ duy nhất:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
{
|
|
58
|
+
"violations": [
|
|
59
|
+
{
|
|
60
|
+
"line": <số nguyên dương, 1-based, trong PRIMARY>,
|
|
61
|
+
"endLine": <số nguyên dương | null>,
|
|
62
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, nêu hai phía contract không khớp và tác động>",
|
|
63
|
+
"suggestion": "<gợi ý sửa cụ thể bằng tiếng Việt có dấu | null>",
|
|
64
|
+
"confidence": <số nguyên 0-100>
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Không có lỗi rõ ràng: `{"violations": []}`.
|
|
71
|
+
|
|
72
|
+
## REPEAT CRITICAL RULES
|
|
73
|
+
|
|
74
|
+
- Phải chỉ ra mismatch bằng evidence cụ thể; không đoán schema/business contract.
|
|
75
|
+
- `line` phải thuộc PRIMARY dù PRIMARY là controller, service hoặc repository.
|
|
76
|
+
- Không báo performance/index, SQL injection, authorization hoặc style.
|
|
77
|
+
- Không duplicate pagination-query, soft-delete/publication, temporal-boundary hoặc native-DML rule.
|
|
78
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
79
|
+
|
|
80
|
+
Không giải thích. JSON thuần.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
id: spring-boot/query-contract-risk
|
|
2
|
+
version: 2
|
|
3
|
+
kind: ai
|
|
4
|
+
title: "Spring Data query/projection contract có sai lệch không?"
|
|
5
|
+
description: |
|
|
6
|
+
Per-cluster AI rule for concrete JPQL/native-query contract defects: collection
|
|
7
|
+
parameters used as scalars, invalid entity/column names, broken join keys,
|
|
8
|
+
projection aliases, null/subquery/aggregation semantics, and DB-dialect or
|
|
9
|
+
binding mismatches proven by visible configuration/schema. It does not report
|
|
10
|
+
SQL injection, temporal boundaries, native DML, or generic performance advice.
|
|
11
|
+
severity: warning
|
|
12
|
+
category: backend-query-correctness
|
|
13
|
+
languages: [java]
|
|
14
|
+
scope: spring-boot
|
|
15
|
+
baseConfidence: 60
|
|
16
|
+
prompt: ./query-contract-risk.prompt.md
|
|
17
|
+
contextScope: per-cluster
|
|
18
|
+
aiConfig:
|
|
19
|
+
tier: regular
|
|
20
|
+
prRouting:
|
|
21
|
+
group: spring-data-consistency-group
|
|
22
|
+
targetLayers: [controller, service, repository, dto, entity]
|
|
23
|
+
triggers: ["@Query", "@Param", "nativeQuery", "countQuery", "SELECT", "JOIN", "Projection", " IN ", "IS NULL", "NOT IN", "GROUP BY", "HAVING", "alias"]
|
|
24
|
+
riskWeight: 5
|
|
25
|
+
requiresContext: [diff, primaryFile, relatedController, relatedService, relatedRepository, relatedDto, relatedEntity, relatedMigration, databaseConfig]
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Bạn là senior Spring Boot reviewer. Chỉ đánh giá **date/time boundary và timezone semantics trong JPQL/native SQL query flow**.
|
|
2
|
+
|
|
3
|
+
## CRITICAL RULES
|
|
4
|
+
|
|
5
|
+
- CHỈ report khi thấy cả caller parameter conversion và query predicate, hoặc query tự chứa temporal mismatch rõ ràng.
|
|
6
|
+
- `line` BẮT BUỘC trỏ vào PRIMARY file. Nếu predicate nằm trong support repository, dùng dòng PRIMARY gọi query; nếu PRIMARY là repository, dùng dòng query/method.
|
|
7
|
+
- Không report `LocalDateTime.now()`/`new Date()` đơn lẻ; `spring-boot/no-unzoned-datetime` sở hữu Java clock construction.
|
|
8
|
+
- Không report function-on-column chỉ vì có thể chậm; `native-query-performance-risk` sở hữu sargability/index cost.
|
|
9
|
+
- Không suy đoán DB timezone, column type hay endpoint date contract khi cluster không có evidence.
|
|
10
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
11
|
+
|
|
12
|
+
## CHỈ REPORT KHI có temporal-query bug cụ thể
|
|
13
|
+
|
|
14
|
+
- Caller nhận ngày kết thúc dạng `LocalDate`/`yyyy-MM-dd`, chuyển thành đầu ngày rồi query `<= :to` hoặc `BETWEEN :from AND :to`, làm mất phần còn lại của ngày kết thúc.
|
|
15
|
+
- Hai window liên tiếp đều dùng inclusive upper bound, hoặc code cộng `23:59:59` với precision thấp hơn column, gây duplicate/missing row; contract đúng nên là half-open `[from, toExclusive)`.
|
|
16
|
+
- Query so `DATE` với `TIMESTAMP`/`Instant` bằng implicit cast/truncation và visible Java/column contract chứng minh record có time component bị loại hoặc gom sai ngày.
|
|
17
|
+
- Caller tạo boundary theo local JVM zone nhưng persisted column/query dùng UTC hoặc zone khác được khai rõ, khiến boundary dịch ngày/giờ.
|
|
18
|
+
- Native DB timezone conversion/truncation được áp khác nhau giữa value/count query hoặc outer/subquery, làm cùng timestamp thuộc hai tập kết quả khác nhau.
|
|
19
|
+
- Nullable from/to filter đặt fallback/min/max sai phía hoặc đảo inclusive/exclusive semantics, tạo interval rỗng hay rộng hơn request.
|
|
20
|
+
|
|
21
|
+
## KHÔNG flag
|
|
22
|
+
|
|
23
|
+
- Query dùng `>= :from AND < :toExclusive` với conversion/zone nhất quán.
|
|
24
|
+
- Pure Java clock/testability issue không đi vào query predicate.
|
|
25
|
+
- Date filter hợp lệ nhưng có thể tối ưu index; để performance rule.
|
|
26
|
+
- Business status/latest/soft-delete filter sai nhưng temporal boundary đúng.
|
|
27
|
+
- DB-specific date function đúng với datasource evidence; portability preference đơn lẻ không phải finding.
|
|
28
|
+
|
|
29
|
+
## Primary file
|
|
30
|
+
|
|
31
|
+
File: `{{file}}`
|
|
32
|
+
Language: `{{language}}`
|
|
33
|
+
|
|
34
|
+
```{{language}}
|
|
35
|
+
{{code}}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Support files cùng cluster
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
{{cluster_files}}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
{{cluster_summary}}
|
|
45
|
+
|
|
46
|
+
## Output yêu cầu
|
|
47
|
+
|
|
48
|
+
Trả về JSON hợp lệ duy nhất:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
{
|
|
52
|
+
"violations": [
|
|
53
|
+
{
|
|
54
|
+
"line": <số nguyên dương, 1-based, trong PRIMARY>,
|
|
55
|
+
"endLine": <số nguyên dương | null>,
|
|
56
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, nêu boundary/zone và record bị mất hoặc trùng>",
|
|
57
|
+
"suggestion": "<gợi ý half-open interval/type/zone nhất quán bằng tiếng Việt có dấu | null>",
|
|
58
|
+
"confidence": <số nguyên 0-100>
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Không có lỗi rõ ràng: `{"violations": []}`.
|
|
65
|
+
|
|
66
|
+
## REPEAT CRITICAL RULES
|
|
67
|
+
|
|
68
|
+
- Cần visible query + conversion/type/zone evidence; không đoán.
|
|
69
|
+
- `line` phải thuộc PRIMARY dù PRIMARY là controller, service hoặc repository.
|
|
70
|
+
- Chỉ report temporal result correctness, không report Java clock hay performance preference.
|
|
71
|
+
- Ưu tiên half-open interval khi finding chứng minh inclusive boundary làm sai tập row.
|
|
72
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
73
|
+
|
|
74
|
+
Không giải thích. JSON thuần.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
id: spring-boot/query-date-boundary-risk
|
|
2
|
+
version: 1
|
|
3
|
+
kind: ai
|
|
4
|
+
title: "Spring query có sai date/time boundary hoặc timezone semantics không?"
|
|
5
|
+
description: |
|
|
6
|
+
Per-cluster AI rule for concrete temporal-predicate defects in JPQL/native
|
|
7
|
+
SQL: inclusive end-of-day mistakes, DATE/TIMESTAMP truncation, incompatible
|
|
8
|
+
timezone assumptions, and caller/query boundary contracts that omit or
|
|
9
|
+
duplicate records. Java clock construction remains a static-rule concern.
|
|
10
|
+
severity: warning
|
|
11
|
+
category: backend-query-correctness
|
|
12
|
+
languages: [java]
|
|
13
|
+
scope: spring-boot
|
|
14
|
+
baseConfidence: 60
|
|
15
|
+
prompt: ./query-date-boundary-risk.prompt.md
|
|
16
|
+
contextScope: per-cluster
|
|
17
|
+
aiConfig:
|
|
18
|
+
tier: regular
|
|
19
|
+
prRouting:
|
|
20
|
+
group: spring-data-consistency-group
|
|
21
|
+
targetLayers: [controller, service, repository, dto, entity]
|
|
22
|
+
triggers: ["LocalDate", "LocalDateTime", "Instant", "Timestamp", "BETWEEN", "createdAt", "updatedAt", "DATE(", "AT TIME ZONE", "toExclusive"]
|
|
23
|
+
riskWeight: 4
|
|
24
|
+
requiresContext: [diff, primaryFile, relatedController, relatedService, relatedRepository, relatedDto, relatedEntity, databaseConfig]
|
|
@@ -55,8 +55,8 @@ Return ONLY valid JSON, no markdown fence and no extra text:
|
|
|
55
55
|
{
|
|
56
56
|
"line": <positive integer, 1-based, in PRIMARY>,
|
|
57
57
|
"endLine": <positive integer | null>,
|
|
58
|
-
"message": "
|
|
59
|
-
"suggestion": "<
|
|
58
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, giải thích việc thiếu phân quyền route>",
|
|
59
|
+
"suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
|
|
60
60
|
"confidence": <integer 0-100>
|
|
61
61
|
}
|
|
62
62
|
]
|
|
@@ -54,8 +54,8 @@ Return ONLY valid JSON, no markdown fence and no extra text:
|
|
|
54
54
|
{
|
|
55
55
|
"line": <positive integer, 1-based, in PRIMARY>,
|
|
56
56
|
"endLine": <positive integer | null>,
|
|
57
|
-
"message": "
|
|
58
|
-
"suggestion": "<
|
|
57
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, giải thích mass assignment hoặc đầu vào trạng thái bảo mật>",
|
|
58
|
+
"suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
|
|
59
59
|
"confidence": <integer 0-100>
|
|
60
60
|
}
|
|
61
61
|
]
|
|
@@ -54,8 +54,8 @@ Return ONLY valid JSON, no markdown fence and no extra text:
|
|
|
54
54
|
{
|
|
55
55
|
"line": <positive integer, 1-based, in PRIMARY>,
|
|
56
56
|
"endLine": <positive integer | null>,
|
|
57
|
-
"message": "
|
|
58
|
-
"suggestion": "<
|
|
57
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, giải thích open redirect hoặc forward không an toàn>",
|
|
58
|
+
"suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
|
|
59
59
|
"confidence": <integer 0-100>
|
|
60
60
|
}
|
|
61
61
|
]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
You are a senior Spring Boot security reviewer. Review this unit ONLY for
|
|
1
|
+
You are a senior Spring Boot security reviewer. Review this unit ONLY for credential, audit-snapshot, and domain-PII exposure.
|
|
2
2
|
|
|
3
3
|
## CRITICAL RULES
|
|
4
4
|
|
|
@@ -6,6 +6,7 @@ CRITICAL NON-VIOLATIONS:
|
|
|
6
6
|
|
|
7
7
|
- NEVER report generic missing auth, owner scope, mass assignment, open redirect, filesystem, generic SSRF, transaction, or validation here.
|
|
8
8
|
- NEVER report a log of public id/username/order number by itself.
|
|
9
|
+
- NEVER report a normal business DTO merely because it contains a name/email/phone. Domain PII needs an unexpected sink or clearly over-broad response contract.
|
|
9
10
|
- NEVER report raw exception handling unless the exception detail is returned to the client or serialized.
|
|
10
11
|
|
|
11
12
|
1. Report ONLY evidence visible in the PRIMARY controller or support files.
|
|
@@ -15,12 +16,16 @@ CRITICAL NON-VIOLATIONS:
|
|
|
15
16
|
## Flag only these sensitive data bugs
|
|
16
17
|
|
|
17
18
|
- Log statement prints request or entity fields named like `password`, `passwd`, `pwd`, `token`, `secret`, `apiKey`, `api_key`, `jwt`, `session`, `authorization`, `credential`, or `cookie` without masking.
|
|
19
|
+
- Log statement prints a whole DTO/entity/audit snapshot or domain fields such as `identityCode`, national ID, date of birth, address, medical/health/discipline/family/salary data, `beforeData`, or `afterData` without explicit redaction.
|
|
20
|
+
- API response/DTO unexpectedly exposes server-controlled credential or audit fields such as `passwordHash`, token/secret, raw `beforeData`/`afterData`, object-storage path, or full nested sensitive profile when the endpoint's visible purpose is metadata/sharing/lookup rather than returning that data.
|
|
18
21
|
- Controller catches exception and returns `e.getMessage()`, `e.toString()`, `ex.getCause()`, raw `Exception`, or serialized exception object in response body.
|
|
19
22
|
- Request credential (`Authorization`, `Cookie`, JWT, session token, API key, password) is forwarded to a URL/webhook selected by request data without destination allowlist.
|
|
20
23
|
|
|
21
24
|
## DO NOT flag
|
|
22
25
|
|
|
23
26
|
- Log data is masked/redacted before logging.
|
|
27
|
+
- An authorized profile/detail endpoint intentionally returns the documented domain DTO; missing authorization or department/owner scope belongs to `security-authorization-risk` / `ownership-scope-risk`.
|
|
28
|
+
- Export contains domain data expected by its contract and has visible authorization/scope; size/performance belongs to `pagination-risk`.
|
|
24
29
|
- Error response is controlled DTO/message such as `new ErrorResponse(code, "Generic error")`.
|
|
25
30
|
- Generic outbound URL/SSRF without credential forwarding; use `io-boundary-risk`.
|
|
26
31
|
- Missing domain exception mapping without data exposure; use `error-handling-completeness`.
|
|
@@ -55,8 +60,8 @@ Return ONLY valid JSON, no markdown fence and no extra text:
|
|
|
55
60
|
{
|
|
56
61
|
"line": <positive integer, 1-based, in PRIMARY>,
|
|
57
62
|
"endLine": <positive integer | null>,
|
|
58
|
-
"message": "
|
|
59
|
-
"suggestion": "<
|
|
63
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, giải thích việc lộ dữ liệu nhạy cảm>",
|
|
64
|
+
"suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
|
|
60
65
|
"confidence": <integer 0-100>
|
|
61
66
|
}
|
|
62
67
|
]
|
|
@@ -68,7 +73,7 @@ If no clear sensitive data exposure exists: `{"violations": []}`.
|
|
|
68
73
|
## REPEAT CRITICAL RULES
|
|
69
74
|
|
|
70
75
|
- `line` must point to PRIMARY controller, not support files.
|
|
71
|
-
- Report only credential/secret/
|
|
76
|
+
- Report only credential/secret/PII/audit exposure with a visible source and unexpected sink or response contract.
|
|
72
77
|
- Do not duplicate `security-authorization-risk`, `security-mass-assignment-risk`, `security-redirect-risk`, `io-boundary-risk`, or `error-handling-completeness`.
|
|
73
78
|
- Confidence `<50` means DO NOT emit.
|
|
74
79
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
id: spring-boot/security-sensitive-data-risk
|
|
2
|
-
version:
|
|
2
|
+
version: 3
|
|
3
3
|
kind: ai
|
|
4
4
|
title: "Spring Boot sensitive data exposure?"
|
|
5
5
|
description: |
|
|
6
6
|
Per-cluster AI rule for sensitive data exposure in Spring Boot flows:
|
|
7
|
-
credentials/secrets/tokens written to logs,
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
credentials/secrets/tokens or domain PII written to logs, server-controlled
|
|
8
|
+
credential/audit fields unexpectedly returned in API DTOs, raw exception
|
|
9
|
+
details returned to clients, and request credentials forwarded to untrusted
|
|
10
|
+
request-selected destinations.
|
|
10
11
|
severity: warning
|
|
11
12
|
category: security
|
|
12
13
|
languages: [java]
|
|
@@ -19,6 +20,6 @@ aiConfig:
|
|
|
19
20
|
prRouting:
|
|
20
21
|
group: spring-security-risk-group
|
|
21
22
|
targetLayers: [controller, service]
|
|
22
|
-
triggers: ["password", "secret", "token", "credential", "email", "phone", "ssn", "personal", "export"]
|
|
23
|
+
triggers: ["password", "passwordHash", "secret", "token", "credential", "identityCode", "beforeData", "afterData", "medical", "salary", "address", "email", "phone", "ssn", "personal", "export", "log"]
|
|
23
24
|
riskWeight: 5
|
|
24
25
|
requiresContext: [diff, primaryFile, relatedController, relatedService]
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Bạn là senior Spring Boot reviewer. Chỉ đánh giá **soft-delete, publication eligibility và latest-version consistency** trong luồng đọc/ghi Spring Data.
|
|
2
|
+
|
|
3
|
+
## CRITICAL RULES
|
|
4
|
+
|
|
5
|
+
- Phải có entity/repository/service evidence cụ thể về `deleted`, publication/status hoặc lineage/version semantics.
|
|
6
|
+
- `line` BẮT BUỘC trỏ vào PRIMARY file. Nếu lỗi nằm trong support repository, dùng dòng PRIMARY gọi flow; nếu PRIMARY là repository, dùng dòng query/method.
|
|
7
|
+
- Không report generic missing owner/tenant/auth; để security/ownership rules.
|
|
8
|
+
- Không report generic unbounded list/pagination hay query performance.
|
|
9
|
+
- Không report chỉ vì nullable Boolean dùng `= false` nếu không có evidence dữ liệu null có thể tồn tại.
|
|
10
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
11
|
+
|
|
12
|
+
## CHỈ REPORT KHI có consistency bug cụ thể
|
|
13
|
+
|
|
14
|
+
- Detail/list/export/report query bỏ `deleted=false`, `isPublic`, eligible status/dossier status trong khi sibling flow hoặc entity contract cho thấy các predicate này bắt buộc.
|
|
15
|
+
- Subquery/CTE `MAX(version)` hoặc `ROW_NUMBER` chọn trên tập rộng hơn outer eligible set, khiến draft/private/deleted version mới che khuất published version hợp lệ.
|
|
16
|
+
- Filter `deleted=false` trước ranking làm version cũ sống lại sau khi latest version bị soft-delete, trái latest-lineage semantics nhìn thấy.
|
|
17
|
+
- Value query, count query, export query hoặc report summary/detail áp deleted/public/status/latest predicates khác nhau và tạo user-visible result drift.
|
|
18
|
+
- Child aggregate/report join include child soft-deleted rows dù child entity/repository có visible soft-delete convention.
|
|
19
|
+
- Delete/update/import flow revive row hoặc để `deleted=null` khiến record biến mất/xuất hiện trái convention có DB/entity evidence.
|
|
20
|
+
|
|
21
|
+
## KHÔNG flag
|
|
22
|
+
|
|
23
|
+
- Hard-delete domain không có soft-delete field/convention.
|
|
24
|
+
- Admin/audit endpoint cố ý include deleted và contract thể hiện rõ.
|
|
25
|
+
- Pure IDOR/owner scope trên một id; để `ownership-scope-risk`.
|
|
26
|
+
- Sai JOIN/column/alias không liên quan eligibility; để `query-contract-risk`.
|
|
27
|
+
- Lost update/version allocation race; để `versioned-entity-concurrency-risk`.
|
|
28
|
+
|
|
29
|
+
## Primary file
|
|
30
|
+
|
|
31
|
+
File: `{{file}}`
|
|
32
|
+
Language: `{{language}}`
|
|
33
|
+
|
|
34
|
+
```{{language}}
|
|
35
|
+
{{code}}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Support files cùng cluster
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
{{cluster_files}}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
{{cluster_summary}}
|
|
45
|
+
|
|
46
|
+
## Output yêu cầu
|
|
47
|
+
|
|
48
|
+
Trả về JSON hợp lệ duy nhất:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
{
|
|
52
|
+
"violations": [
|
|
53
|
+
{
|
|
54
|
+
"line": <số nguyên dương, 1-based, trong PRIMARY>,
|
|
55
|
+
"endLine": <số nguyên dương | null>,
|
|
56
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, nêu predicate/ranking lệch và record bị lộ/ẩn/hồi sinh>",
|
|
57
|
+
"suggestion": "<gợi ý đồng bộ eligible set bằng tiếng Việt có dấu | null>",
|
|
58
|
+
"confidence": <số nguyên 0-100>
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Không có lỗi rõ ràng: `{"violations": []}`.
|
|
65
|
+
|
|
66
|
+
## REPEAT CRITICAL RULES
|
|
67
|
+
|
|
68
|
+
- Cần evidence về deleted/public/status/latest semantics.
|
|
69
|
+
- `line` phải thuộc PRIMARY dù PRIMARY là controller, service hoặc repository.
|
|
70
|
+
- Không suy diễn nullable Boolean hoặc admin audit semantics.
|
|
71
|
+
- Không duplicate owner/auth, pagination, query-contract hoặc concurrency rules.
|
|
72
|
+
- Confidence `<50` thì KHÔNG emit.
|
|
73
|
+
|
|
74
|
+
Không giải thích. JSON thuần.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
id: spring-boot/soft-delete-publication-consistency-risk
|
|
2
|
+
version: 2
|
|
3
|
+
kind: ai
|
|
4
|
+
title: "Spring soft-delete/latest/publication query có nhất quán không?"
|
|
5
|
+
description: |
|
|
6
|
+
Per-cluster AI rule for query flows whose deleted, publication, status, or
|
|
7
|
+
latest-version predicates are internally inconsistent. It flags concrete
|
|
8
|
+
cases where deleted/draft/private or historical records can be exposed,
|
|
9
|
+
counted, revived, or can hide the eligible published record.
|
|
10
|
+
severity: warning
|
|
11
|
+
category: backend-data-consistency
|
|
12
|
+
languages: [java]
|
|
13
|
+
scope: spring-boot
|
|
14
|
+
baseConfidence: 60
|
|
15
|
+
prompt: ./soft-delete-publication-consistency-risk.prompt.md
|
|
16
|
+
contextScope: per-cluster
|
|
17
|
+
aiConfig:
|
|
18
|
+
tier: regular
|
|
19
|
+
prRouting:
|
|
20
|
+
group: spring-data-consistency-group
|
|
21
|
+
targetLayers: [controller, service, repository, entity]
|
|
22
|
+
triggers: ["deleted", "isPublic", "status", "dossierStatus", "MAX(version)", "ROW_NUMBER", "latest", "softDelete", "findAll"]
|
|
23
|
+
riskWeight: 5
|
|
24
|
+
requiresContext: [diff, primaryFile, relatedController, relatedService, relatedRepository, relatedEntity]
|
|
@@ -58,8 +58,8 @@ Tra ve **JSON HOP LE DUY NHAT** (khong markdown fence, khong text khac) theo sch
|
|
|
58
58
|
{
|
|
59
59
|
"line": <so nguyen duong, 1-based, trong PRIMARY>,
|
|
60
60
|
"endLine": <so nguyen duong | null>,
|
|
61
|
-
"message": "
|
|
62
|
-
"suggestion": "<
|
|
61
|
+
"message": "<≤200 ký tự, tiếng Việt có dấu, nêu luồng và nguy cơ về tính nguyên tử hoặc công việc không giới hạn>",
|
|
62
|
+
"suggestion": "<gợi ý sửa lỗi bằng tiếng Việt có dấu | null>",
|
|
63
63
|
"confidence": <so nguyen 0-100>
|
|
64
64
|
}
|
|
65
65
|
]
|