@runhalo/engine 0.4.0 → 0.6.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/ast-engine.d.ts +60 -0
- package/dist/ast-engine.js +653 -0
- package/dist/ast-engine.js.map +1 -0
- package/dist/context-analyzer.d.ts +209 -0
- package/dist/context-analyzer.js +408 -0
- package/dist/context-analyzer.js.map +1 -0
- package/dist/data-flow-tracer.d.ts +106 -0
- package/dist/data-flow-tracer.js +506 -0
- package/dist/data-flow-tracer.js.map +1 -0
- package/dist/fp-patterns.d.ts +36 -0
- package/dist/fp-patterns.js +426 -0
- package/dist/fp-patterns.js.map +1 -0
- package/dist/frameworks/angular.d.ts +11 -0
- package/dist/frameworks/angular.js +41 -0
- package/dist/frameworks/angular.js.map +1 -0
- package/dist/frameworks/django.d.ts +11 -0
- package/dist/frameworks/django.js +57 -0
- package/dist/frameworks/django.js.map +1 -0
- package/dist/frameworks/index.d.ts +59 -0
- package/dist/frameworks/index.js +99 -0
- package/dist/frameworks/index.js.map +1 -0
- package/dist/frameworks/nextjs.d.ts +11 -0
- package/dist/frameworks/nextjs.js +59 -0
- package/dist/frameworks/nextjs.js.map +1 -0
- package/dist/frameworks/rails.d.ts +11 -0
- package/dist/frameworks/rails.js +58 -0
- package/dist/frameworks/rails.js.map +1 -0
- package/dist/frameworks/react.d.ts +13 -0
- package/dist/frameworks/react.js +36 -0
- package/dist/frameworks/react.js.map +1 -0
- package/dist/frameworks/types.d.ts +29 -0
- package/dist/frameworks/types.js +11 -0
- package/dist/frameworks/types.js.map +1 -0
- package/dist/frameworks/vue.d.ts +9 -0
- package/dist/frameworks/vue.js +39 -0
- package/dist/frameworks/vue.js.map +1 -0
- package/dist/graduation/fp-verdict-logger.d.ts +81 -0
- package/dist/graduation/fp-verdict-logger.js +130 -0
- package/dist/graduation/fp-verdict-logger.js.map +1 -0
- package/dist/graduation/graduation-codifier.d.ts +37 -0
- package/dist/graduation/graduation-codifier.js +205 -0
- package/dist/graduation/graduation-codifier.js.map +1 -0
- package/dist/graduation/graduation-validator.d.ts +73 -0
- package/dist/graduation/graduation-validator.js +204 -0
- package/dist/graduation/graduation-validator.js.map +1 -0
- package/dist/graduation/index.d.ts +71 -0
- package/dist/graduation/index.js +105 -0
- package/dist/graduation/index.js.map +1 -0
- package/dist/graduation/pattern-aggregator.d.ts +77 -0
- package/dist/graduation/pattern-aggregator.js +154 -0
- package/dist/graduation/pattern-aggregator.js.map +1 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.js +718 -61
- package/dist/index.js.map +1 -1
- package/dist/review-board/two-agent-review.d.ts +152 -0
- package/dist/review-board/two-agent-review.js +463 -0
- package/dist/review-board/two-agent-review.js.map +1 -0
- package/dist/scope-analyzer.d.ts +91 -0
- package/dist/scope-analyzer.js +300 -0
- package/dist/scope-analyzer.js.map +1 -0
- package/package.json +9 -2
- package/rules/coppa-tier-1.yaml +17 -10
- package/rules/rules.json +2094 -99
- package/rules/validation-report.json +58 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Halo AST Rule Engine
|
|
3
|
+
*
|
|
4
|
+
* Takes a parsed tree-sitter AST + rule ID and returns an AST-based verdict
|
|
5
|
+
* that supplements the regex scanner. AST analysis can suppress false positives
|
|
6
|
+
* (e.g., a Schema that already has TTL) or confirm true positives with higher
|
|
7
|
+
* confidence.
|
|
8
|
+
*
|
|
9
|
+
* Sprint 8: 10 rule analyzers for JS/TS.
|
|
10
|
+
* HARD SCOPE: Single-file only (via DataFlowTracer).
|
|
11
|
+
*/
|
|
12
|
+
import Parser from 'tree-sitter';
|
|
13
|
+
export type ASTVerdict = 'confirmed' | 'suppressed' | 'regex_only';
|
|
14
|
+
export interface ASTResult {
|
|
15
|
+
/** Whether the violation is confirmed, suppressed, or not analyzable by AST */
|
|
16
|
+
verdict: ASTVerdict;
|
|
17
|
+
/** Confidence in the verdict: 0.0 to 1.0 */
|
|
18
|
+
confidence: number;
|
|
19
|
+
/** Human-readable reason for the verdict */
|
|
20
|
+
reason?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Minimal violation info needed for AST analysis */
|
|
23
|
+
export interface ViolationInfo {
|
|
24
|
+
ruleId: string;
|
|
25
|
+
line: number;
|
|
26
|
+
column: number;
|
|
27
|
+
codeSnippet: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class ASTRuleEngine {
|
|
30
|
+
private scopeAnalyzer;
|
|
31
|
+
constructor();
|
|
32
|
+
/**
|
|
33
|
+
* Analyze a regex-detected violation using AST context.
|
|
34
|
+
*
|
|
35
|
+
* @param ruleId - The COPPA/ethical rule ID
|
|
36
|
+
* @param content - Full file content
|
|
37
|
+
* @param violation - The violation from the regex scanner
|
|
38
|
+
* @param tree - Parsed tree-sitter AST
|
|
39
|
+
* @returns ASTResult with verdict, confidence, and reason
|
|
40
|
+
*/
|
|
41
|
+
analyzeViolation(ruleId: string, content: string, violation: ViolationInfo, tree: Parser.Tree): ASTResult;
|
|
42
|
+
/**
|
|
43
|
+
* Analyze a violation with a known file path (used from scanFileWithAST integration).
|
|
44
|
+
* This version passes the real file path for scope analysis.
|
|
45
|
+
*/
|
|
46
|
+
analyzeViolationWithPath(ruleId: string, filePath: string, content: string, violation: ViolationInfo, tree: Parser.Tree): ASTResult;
|
|
47
|
+
private getAnalyzer;
|
|
48
|
+
private analyzeTracking003;
|
|
49
|
+
private analyzeRetention005;
|
|
50
|
+
private analyzeExtLinks017;
|
|
51
|
+
private analyzeXSS015;
|
|
52
|
+
private analyzeAuth001;
|
|
53
|
+
private analyzeUI008;
|
|
54
|
+
private checkPrivacyInContent;
|
|
55
|
+
private analyzeUGC014;
|
|
56
|
+
private analyzeFlow009;
|
|
57
|
+
private analyzeCookies016;
|
|
58
|
+
private analyzeInfiniteScroll001;
|
|
59
|
+
}
|
|
60
|
+
export default ASTRuleEngine;
|