@nahisaho/musubix-security 3.0.11 → 3.0.14
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/extractors/go-extractor.d.ts +43 -70
- package/dist/extractors/go-extractor.d.ts.map +1 -1
- package/dist/extractors/go-extractor.js +596 -648
- package/dist/extractors/go-extractor.js.map +1 -1
- package/dist/extractors/index.d.ts +15 -3
- package/dist/extractors/index.d.ts.map +1 -1
- package/dist/extractors/index.js +30 -5
- package/dist/extractors/index.js.map +1 -1
- package/dist/extractors/java-extractor.d.ts +5 -0
- package/dist/extractors/java-extractor.d.ts.map +1 -1
- package/dist/extractors/java-extractor.js +7 -0
- package/dist/extractors/java-extractor.js.map +1 -1
- package/dist/extractors/ruby-extractor.d.ts +64 -0
- package/dist/extractors/ruby-extractor.d.ts.map +1 -0
- package/dist/extractors/ruby-extractor.js +491 -0
- package/dist/extractors/ruby-extractor.js.map +1 -0
- package/dist/extractors/rust-extractor.d.ts +68 -0
- package/dist/extractors/rust-extractor.d.ts.map +1 -0
- package/dist/extractors/rust-extractor.js +585 -0
- package/dist/extractors/rust-extractor.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,105 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Go Language Extractor
|
|
3
3
|
* @module @nahisaho/musubix-security/extractors/go-extractor
|
|
4
|
-
* @trace TSK-
|
|
5
|
-
* @trace REQ-SEC-
|
|
4
|
+
* @trace TSK-GO-001, TSK-GO-002, TSK-GO-003, TSK-GO-004, TSK-GO-005
|
|
5
|
+
* @trace REQ-SEC-GO-001, REQ-SEC-GO-002, REQ-SEC-GO-003, REQ-SEC-GO-004
|
|
6
|
+
* @trace REQ-SEC-GO-005, REQ-SEC-GO-006, REQ-SEC-GO-007, REQ-SEC-GO-008
|
|
6
7
|
*/
|
|
7
|
-
import { BaseExtractor, type ASTNode, type DataFlowGraph, type ControlFlowGraph, type SymbolTable, type FrameworkModel, type
|
|
8
|
+
import { BaseExtractor, type ASTNode, type ASTEdge, type DataFlowGraph, type ControlFlowGraph, type SymbolTable, type FrameworkModel, type SupportedLanguage } from './base-extractor.js';
|
|
8
9
|
/**
|
|
9
|
-
* Go
|
|
10
|
+
* Go Language Extractor
|
|
11
|
+
* @trace TSK-GO-001, REQ-SEC-GO-001
|
|
10
12
|
*/
|
|
11
13
|
export declare class GoExtractor extends BaseExtractor {
|
|
14
|
+
readonly language: SupportedLanguage;
|
|
15
|
+
readonly extensions: string[];
|
|
12
16
|
private parser;
|
|
13
17
|
private tree;
|
|
14
18
|
private nodeIdCounter;
|
|
15
19
|
private blockIdCounter;
|
|
16
20
|
/**
|
|
17
|
-
*
|
|
21
|
+
* Get framework models for Go
|
|
22
|
+
* @trace REQ-SEC-GO-004
|
|
18
23
|
*/
|
|
19
|
-
|
|
24
|
+
getFrameworkModels(): FrameworkModel[];
|
|
20
25
|
/**
|
|
21
26
|
* Initialize tree-sitter parser
|
|
27
|
+
* @trace REQ-SEC-GO-002
|
|
22
28
|
*/
|
|
23
|
-
|
|
29
|
+
private initParser;
|
|
24
30
|
/**
|
|
25
|
-
*
|
|
31
|
+
* Build AST from source code
|
|
32
|
+
* @trace TSK-GO-002, REQ-SEC-GO-002
|
|
26
33
|
*/
|
|
27
|
-
|
|
34
|
+
protected buildAST(source: string, filePath: string): Promise<{
|
|
35
|
+
ast: ASTNode;
|
|
36
|
+
astNodes: Map<string, ASTNode>;
|
|
37
|
+
astEdges: ASTEdge[];
|
|
38
|
+
}>;
|
|
28
39
|
/**
|
|
29
|
-
* Convert tree-sitter node to
|
|
40
|
+
* Convert tree-sitter node to AST format
|
|
30
41
|
*/
|
|
31
42
|
private convertTreeSitterNode;
|
|
32
43
|
/**
|
|
33
|
-
* Extract
|
|
44
|
+
* Extract properties from node
|
|
45
|
+
* @trace REQ-SEC-GO-003
|
|
34
46
|
*/
|
|
35
|
-
private
|
|
47
|
+
private extractNodeProperties;
|
|
36
48
|
/**
|
|
37
|
-
*
|
|
49
|
+
* Create fallback AST when tree-sitter is unavailable
|
|
38
50
|
*/
|
|
39
|
-
private
|
|
40
|
-
/**
|
|
41
|
-
* Extract import specifications
|
|
42
|
-
*/
|
|
43
|
-
private extractImports;
|
|
44
|
-
/**
|
|
45
|
-
* Build control flow graph
|
|
46
|
-
*/
|
|
47
|
-
buildCFG(ast: ASTNode): Promise<ControlFlowGraph>;
|
|
48
|
-
/**
|
|
49
|
-
* Build CFG for a single function
|
|
50
|
-
*/
|
|
51
|
-
private buildFunctionCFG;
|
|
52
|
-
/**
|
|
53
|
-
* Process a block of statements
|
|
54
|
-
*/
|
|
55
|
-
private processBlock;
|
|
56
|
-
/**
|
|
57
|
-
* Check if statement is control flow
|
|
58
|
-
*/
|
|
59
|
-
private isControlFlowStatement;
|
|
60
|
-
/**
|
|
61
|
-
* Process control flow statement
|
|
62
|
-
*/
|
|
63
|
-
private processControlFlow;
|
|
64
|
-
/**
|
|
65
|
-
* Build data flow graph
|
|
66
|
-
*/
|
|
67
|
-
buildDFG(ast: ASTNode, cfg: ControlFlowGraph): Promise<DataFlowGraph>;
|
|
68
|
-
/**
|
|
69
|
-
* Create DFG nodes for assignment
|
|
70
|
-
*/
|
|
71
|
-
private createDFGNodesForAssignment;
|
|
72
|
-
/**
|
|
73
|
-
* Create DFG nodes for function parameters
|
|
74
|
-
*/
|
|
75
|
-
private createDFGNodesForParameters;
|
|
76
|
-
/**
|
|
77
|
-
* Infer taint label from parameter
|
|
78
|
-
*/
|
|
79
|
-
private inferTaintLabel;
|
|
80
|
-
/**
|
|
81
|
-
* Build DFG edges
|
|
82
|
-
*/
|
|
83
|
-
private buildDFGEdges;
|
|
51
|
+
private createFallbackAST;
|
|
84
52
|
/**
|
|
85
|
-
* Build
|
|
53
|
+
* Build Data Flow Graph
|
|
54
|
+
* @trace TSK-GO-003, REQ-SEC-GO-005
|
|
86
55
|
*/
|
|
87
|
-
|
|
56
|
+
protected buildDFG(astNodes: Map<string, ASTNode>, _astEdges: ASTEdge[], frameworkModels: FrameworkModel[]): Promise<DataFlowGraph>;
|
|
88
57
|
/**
|
|
89
|
-
*
|
|
58
|
+
* Build Control Flow Graph
|
|
59
|
+
* @trace TSK-GO-004, REQ-SEC-GO-006
|
|
90
60
|
*/
|
|
91
|
-
|
|
61
|
+
protected buildCFG(astNodes: Map<string, ASTNode>, _astEdges: ASTEdge[]): Promise<ControlFlowGraph>;
|
|
92
62
|
/**
|
|
93
|
-
*
|
|
63
|
+
* Extract symbols from AST
|
|
64
|
+
* @trace TSK-GO-005, REQ-SEC-GO-007
|
|
94
65
|
*/
|
|
95
|
-
|
|
66
|
+
protected extractSymbols(astNodes: Map<string, ASTNode>): Promise<SymbolTable>;
|
|
96
67
|
/**
|
|
97
|
-
*
|
|
68
|
+
* Check if identifier is exported (public)
|
|
69
|
+
* Go exports identifiers starting with uppercase
|
|
98
70
|
*/
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Find nodes by type(s) in AST
|
|
102
|
-
*/
|
|
103
|
-
private findNodesByType;
|
|
71
|
+
isExported(name: string): boolean;
|
|
104
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Create Go extractor instance
|
|
75
|
+
* @trace REQ-SEC-GO-001
|
|
76
|
+
*/
|
|
77
|
+
export declare function createGoExtractor(): GoExtractor;
|
|
105
78
|
//# sourceMappingURL=go-extractor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go-extractor.d.ts","sourceRoot":"","sources":["../../src/extractors/go-extractor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"go-extractor.d.ts","sourceRoot":"","sources":["../../src/extractors/go-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,aAAa,EACb,KAAK,OAAO,EACZ,KAAK,OAAO,EAGZ,KAAK,aAAa,EAGlB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAKhB,KAAK,cAAc,EACnB,KAAK,iBAAiB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