circle-ir 3.21.0 → 3.22.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/configs/sinks/golang.json +144 -0
- package/configs/sources/golang.json +150 -0
- package/dist/analyzer.js +9 -0
- package/dist/analyzer.js.map +1 -1
- package/dist/browser/circle-ir.js +1387 -183
- package/dist/core/circle-ir-core.cjs +610 -0
- package/dist/core/circle-ir-core.js +610 -0
- package/dist/core/extractors/calls.js +133 -0
- package/dist/core/extractors/calls.js.map +1 -1
- package/dist/core/extractors/cfg.js +68 -0
- package/dist/core/extractors/cfg.js.map +1 -1
- package/dist/core/extractors/dfg.js +270 -0
- package/dist/core/extractors/dfg.js.map +1 -1
- package/dist/core/extractors/imports.js +78 -0
- package/dist/core/extractors/imports.js.map +1 -1
- package/dist/core/extractors/types.js +160 -0
- package/dist/core/extractors/types.js.map +1 -1
- package/dist/core/parser.d.ts +1 -1
- package/dist/languages/plugins/go.d.ts +61 -0
- package/dist/languages/plugins/go.js +615 -0
- package/dist/languages/plugins/go.js.map +1 -0
- package/dist/languages/plugins/index.d.ts +1 -0
- package/dist/languages/plugins/index.js +3 -0
- package/dist/languages/plugins/index.js.map +1 -1
- package/dist/languages/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/wasm/tree-sitter-go.wasm +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go Language Plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides Go-specific AST handling, taint patterns, and framework detection.
|
|
5
|
+
*/
|
|
6
|
+
import { BaseLanguagePlugin } from './base.js';
|
|
7
|
+
/**
|
|
8
|
+
* Go language plugin implementation.
|
|
9
|
+
*/
|
|
10
|
+
export class GoPlugin extends BaseLanguagePlugin {
|
|
11
|
+
id = 'go';
|
|
12
|
+
name = 'Go';
|
|
13
|
+
extensions = ['.go'];
|
|
14
|
+
wasmPath = 'tree-sitter-go.wasm';
|
|
15
|
+
nodeTypes = {
|
|
16
|
+
// Type declarations
|
|
17
|
+
classDeclaration: ['type_declaration'],
|
|
18
|
+
interfaceDeclaration: ['type_declaration'],
|
|
19
|
+
enumDeclaration: [], // Go has no enums (uses iota constants)
|
|
20
|
+
functionDeclaration: ['function_declaration'],
|
|
21
|
+
methodDeclaration: ['method_declaration'],
|
|
22
|
+
// Expressions
|
|
23
|
+
methodCall: ['call_expression'],
|
|
24
|
+
functionCall: ['call_expression'],
|
|
25
|
+
assignment: ['short_var_declaration', 'assignment_statement', 'var_declaration'],
|
|
26
|
+
variableDeclaration: ['short_var_declaration', 'var_declaration'],
|
|
27
|
+
// Parameters and arguments
|
|
28
|
+
parameter: ['parameter_declaration'],
|
|
29
|
+
argument: ['argument_list'],
|
|
30
|
+
// Annotations/decorators
|
|
31
|
+
annotation: [], // Go has no annotations
|
|
32
|
+
decorator: [], // Go has no decorators
|
|
33
|
+
// Imports
|
|
34
|
+
importStatement: ['import_declaration'],
|
|
35
|
+
// Control flow
|
|
36
|
+
ifStatement: ['if_statement'],
|
|
37
|
+
forStatement: ['for_statement'],
|
|
38
|
+
whileStatement: [], // Go uses for with condition
|
|
39
|
+
tryStatement: [], // Go uses defer/recover
|
|
40
|
+
returnStatement: ['return_statement'],
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Detect Go web frameworks from imports.
|
|
44
|
+
*/
|
|
45
|
+
detectFramework(context) {
|
|
46
|
+
const indicators = [];
|
|
47
|
+
let framework;
|
|
48
|
+
let confidence = 0;
|
|
49
|
+
for (const imp of context.imports) {
|
|
50
|
+
const path = imp.from_package || imp.imported_name;
|
|
51
|
+
// Gin
|
|
52
|
+
if (path.includes('gin-gonic/gin')) {
|
|
53
|
+
framework = 'gin';
|
|
54
|
+
confidence = Math.max(confidence, 0.95);
|
|
55
|
+
indicators.push(`import: ${path}`);
|
|
56
|
+
}
|
|
57
|
+
// Echo
|
|
58
|
+
if (path.includes('labstack/echo')) {
|
|
59
|
+
framework = 'echo';
|
|
60
|
+
confidence = Math.max(confidence, 0.95);
|
|
61
|
+
indicators.push(`import: ${path}`);
|
|
62
|
+
}
|
|
63
|
+
// Fiber
|
|
64
|
+
if (path.includes('gofiber/fiber')) {
|
|
65
|
+
framework = 'fiber';
|
|
66
|
+
confidence = Math.max(confidence, 0.95);
|
|
67
|
+
indicators.push(`import: ${path}`);
|
|
68
|
+
}
|
|
69
|
+
// Chi
|
|
70
|
+
if (path.includes('go-chi/chi')) {
|
|
71
|
+
framework = 'chi';
|
|
72
|
+
confidence = Math.max(confidence, 0.9);
|
|
73
|
+
indicators.push(`import: ${path}`);
|
|
74
|
+
}
|
|
75
|
+
// GORM
|
|
76
|
+
if (path.includes('gorm.io/gorm')) {
|
|
77
|
+
indicators.push(`import: ${path}`);
|
|
78
|
+
}
|
|
79
|
+
// net/http (stdlib)
|
|
80
|
+
if (path === 'net/http') {
|
|
81
|
+
framework = framework || 'net/http';
|
|
82
|
+
confidence = Math.max(confidence, 0.8);
|
|
83
|
+
indicators.push(`import: ${path}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (framework) {
|
|
87
|
+
return { name: framework, confidence, indicators };
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Go taint source patterns.
|
|
93
|
+
*/
|
|
94
|
+
getBuiltinSources() {
|
|
95
|
+
return [
|
|
96
|
+
// net/http request methods
|
|
97
|
+
{
|
|
98
|
+
method: 'FormValue',
|
|
99
|
+
class: 'Request',
|
|
100
|
+
type: 'http_param',
|
|
101
|
+
severity: 'high',
|
|
102
|
+
confidence: 0.95,
|
|
103
|
+
returnTainted: true,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
method: 'PostFormValue',
|
|
107
|
+
class: 'Request',
|
|
108
|
+
type: 'http_param',
|
|
109
|
+
severity: 'high',
|
|
110
|
+
confidence: 0.95,
|
|
111
|
+
returnTainted: true,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
method: 'Query',
|
|
115
|
+
class: 'URL',
|
|
116
|
+
type: 'http_param',
|
|
117
|
+
severity: 'high',
|
|
118
|
+
confidence: 0.95,
|
|
119
|
+
returnTainted: true,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
method: 'Get',
|
|
123
|
+
class: 'Header',
|
|
124
|
+
type: 'http_header',
|
|
125
|
+
severity: 'high',
|
|
126
|
+
confidence: 0.9,
|
|
127
|
+
returnTainted: true,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
method: 'Cookie',
|
|
131
|
+
class: 'Request',
|
|
132
|
+
type: 'http_cookie',
|
|
133
|
+
severity: 'high',
|
|
134
|
+
confidence: 0.9,
|
|
135
|
+
returnTainted: true,
|
|
136
|
+
},
|
|
137
|
+
// Gin framework
|
|
138
|
+
{
|
|
139
|
+
method: 'Query',
|
|
140
|
+
class: 'Context',
|
|
141
|
+
type: 'http_param',
|
|
142
|
+
severity: 'high',
|
|
143
|
+
confidence: 0.95,
|
|
144
|
+
returnTainted: true,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
method: 'Param',
|
|
148
|
+
class: 'Context',
|
|
149
|
+
type: 'http_path',
|
|
150
|
+
severity: 'high',
|
|
151
|
+
confidence: 0.95,
|
|
152
|
+
returnTainted: true,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
method: 'PostForm',
|
|
156
|
+
class: 'Context',
|
|
157
|
+
type: 'http_param',
|
|
158
|
+
severity: 'high',
|
|
159
|
+
confidence: 0.95,
|
|
160
|
+
returnTainted: true,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
method: 'GetRawData',
|
|
164
|
+
class: 'Context',
|
|
165
|
+
type: 'http_body',
|
|
166
|
+
severity: 'high',
|
|
167
|
+
confidence: 0.95,
|
|
168
|
+
returnTainted: true,
|
|
169
|
+
},
|
|
170
|
+
// Standard library I/O
|
|
171
|
+
{
|
|
172
|
+
method: 'Getenv',
|
|
173
|
+
class: 'os',
|
|
174
|
+
type: 'env_var',
|
|
175
|
+
severity: 'medium',
|
|
176
|
+
confidence: 0.85,
|
|
177
|
+
returnTainted: true,
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
method: 'ReadAll',
|
|
181
|
+
class: 'io',
|
|
182
|
+
type: 'io_input',
|
|
183
|
+
severity: 'medium',
|
|
184
|
+
confidence: 0.8,
|
|
185
|
+
returnTainted: true,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
method: 'ReadFile',
|
|
189
|
+
class: 'os',
|
|
190
|
+
type: 'file_input',
|
|
191
|
+
severity: 'medium',
|
|
192
|
+
confidence: 0.8,
|
|
193
|
+
returnTainted: true,
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
method: 'Text',
|
|
197
|
+
class: 'Scanner',
|
|
198
|
+
type: 'io_input',
|
|
199
|
+
severity: 'medium',
|
|
200
|
+
confidence: 0.8,
|
|
201
|
+
returnTainted: true,
|
|
202
|
+
},
|
|
203
|
+
];
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Go taint sink patterns.
|
|
207
|
+
*/
|
|
208
|
+
getBuiltinSinks() {
|
|
209
|
+
return [
|
|
210
|
+
// SQL Injection
|
|
211
|
+
{
|
|
212
|
+
method: 'Query',
|
|
213
|
+
class: 'DB',
|
|
214
|
+
type: 'sql_injection',
|
|
215
|
+
cwe: 'CWE-89',
|
|
216
|
+
severity: 'critical',
|
|
217
|
+
argPositions: [0],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
method: 'QueryRow',
|
|
221
|
+
class: 'DB',
|
|
222
|
+
type: 'sql_injection',
|
|
223
|
+
cwe: 'CWE-89',
|
|
224
|
+
severity: 'critical',
|
|
225
|
+
argPositions: [0],
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
method: 'Exec',
|
|
229
|
+
class: 'DB',
|
|
230
|
+
type: 'sql_injection',
|
|
231
|
+
cwe: 'CWE-89',
|
|
232
|
+
severity: 'critical',
|
|
233
|
+
argPositions: [0],
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
method: 'Query',
|
|
237
|
+
class: 'Tx',
|
|
238
|
+
type: 'sql_injection',
|
|
239
|
+
cwe: 'CWE-89',
|
|
240
|
+
severity: 'critical',
|
|
241
|
+
argPositions: [0],
|
|
242
|
+
},
|
|
243
|
+
// Command Injection
|
|
244
|
+
{
|
|
245
|
+
method: 'Command',
|
|
246
|
+
class: 'exec',
|
|
247
|
+
type: 'command_injection',
|
|
248
|
+
cwe: 'CWE-78',
|
|
249
|
+
severity: 'critical',
|
|
250
|
+
argPositions: [0],
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
method: 'CommandContext',
|
|
254
|
+
class: 'exec',
|
|
255
|
+
type: 'command_injection',
|
|
256
|
+
cwe: 'CWE-78',
|
|
257
|
+
severity: 'critical',
|
|
258
|
+
argPositions: [1],
|
|
259
|
+
},
|
|
260
|
+
// Path Traversal
|
|
261
|
+
{
|
|
262
|
+
method: 'Open',
|
|
263
|
+
class: 'os',
|
|
264
|
+
type: 'path_traversal',
|
|
265
|
+
cwe: 'CWE-22',
|
|
266
|
+
severity: 'high',
|
|
267
|
+
argPositions: [0],
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
method: 'ReadFile',
|
|
271
|
+
class: 'os',
|
|
272
|
+
type: 'path_traversal',
|
|
273
|
+
cwe: 'CWE-22',
|
|
274
|
+
severity: 'high',
|
|
275
|
+
argPositions: [0],
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
method: 'WriteFile',
|
|
279
|
+
class: 'os',
|
|
280
|
+
type: 'path_traversal',
|
|
281
|
+
cwe: 'CWE-22',
|
|
282
|
+
severity: 'high',
|
|
283
|
+
argPositions: [0],
|
|
284
|
+
},
|
|
285
|
+
// XSS (writing to http.ResponseWriter without escaping)
|
|
286
|
+
{
|
|
287
|
+
method: 'Fprintf',
|
|
288
|
+
class: 'fmt',
|
|
289
|
+
type: 'xss',
|
|
290
|
+
cwe: 'CWE-79',
|
|
291
|
+
severity: 'high',
|
|
292
|
+
argPositions: [1],
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
method: 'Write',
|
|
296
|
+
class: 'ResponseWriter',
|
|
297
|
+
type: 'xss',
|
|
298
|
+
cwe: 'CWE-79',
|
|
299
|
+
severity: 'high',
|
|
300
|
+
argPositions: [0],
|
|
301
|
+
},
|
|
302
|
+
// SSRF
|
|
303
|
+
{
|
|
304
|
+
method: 'Get',
|
|
305
|
+
class: 'http',
|
|
306
|
+
type: 'ssrf',
|
|
307
|
+
cwe: 'CWE-918',
|
|
308
|
+
severity: 'high',
|
|
309
|
+
argPositions: [0],
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
method: 'Post',
|
|
313
|
+
class: 'http',
|
|
314
|
+
type: 'ssrf',
|
|
315
|
+
cwe: 'CWE-918',
|
|
316
|
+
severity: 'high',
|
|
317
|
+
argPositions: [0, 2],
|
|
318
|
+
},
|
|
319
|
+
// Deserialization
|
|
320
|
+
{
|
|
321
|
+
method: 'Unmarshal',
|
|
322
|
+
class: 'json',
|
|
323
|
+
type: 'deserialization',
|
|
324
|
+
cwe: 'CWE-502',
|
|
325
|
+
severity: 'medium',
|
|
326
|
+
argPositions: [0],
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
method: 'Decode',
|
|
330
|
+
class: 'Decoder',
|
|
331
|
+
type: 'deserialization',
|
|
332
|
+
cwe: 'CWE-502',
|
|
333
|
+
severity: 'medium',
|
|
334
|
+
argPositions: [0],
|
|
335
|
+
},
|
|
336
|
+
];
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Get receiver type from a Go call expression.
|
|
340
|
+
*/
|
|
341
|
+
getReceiverType(node, _context) {
|
|
342
|
+
if (node.type !== 'call_expression')
|
|
343
|
+
return undefined;
|
|
344
|
+
const func = node.childForFieldName('function');
|
|
345
|
+
if (!func)
|
|
346
|
+
return undefined;
|
|
347
|
+
// selector_expression: obj.Method() or pkg.Function()
|
|
348
|
+
if (func.type === 'selector_expression') {
|
|
349
|
+
const operand = func.childForFieldName('operand');
|
|
350
|
+
if (operand) {
|
|
351
|
+
return operand.text;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return undefined;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Check if node is a Go string literal.
|
|
358
|
+
*/
|
|
359
|
+
isStringLiteral(node) {
|
|
360
|
+
return node.type === 'interpreted_string_literal' ||
|
|
361
|
+
node.type === 'raw_string_literal';
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Get string value from Go string literal.
|
|
365
|
+
*/
|
|
366
|
+
getStringValue(node) {
|
|
367
|
+
if (!this.isStringLiteral(node))
|
|
368
|
+
return undefined;
|
|
369
|
+
const text = node.text;
|
|
370
|
+
// Handle raw strings `...`
|
|
371
|
+
if (text.startsWith('`') && text.endsWith('`')) {
|
|
372
|
+
return text.slice(1, -1);
|
|
373
|
+
}
|
|
374
|
+
// Handle interpreted strings "..."
|
|
375
|
+
if (text.startsWith('"') && text.endsWith('"')) {
|
|
376
|
+
return text.slice(1, -1);
|
|
377
|
+
}
|
|
378
|
+
return text;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Extract type information from Go source.
|
|
382
|
+
*/
|
|
383
|
+
extractTypes(context) {
|
|
384
|
+
const types = [];
|
|
385
|
+
const root = context.tree.rootNode;
|
|
386
|
+
// Find type_declaration nodes (type Foo struct {...} or type Bar interface {...})
|
|
387
|
+
const typeDecls = this.findNodes(root, 'type_declaration');
|
|
388
|
+
for (const decl of typeDecls) {
|
|
389
|
+
// type_declaration contains type_spec children
|
|
390
|
+
for (let i = 0; i < decl.childCount; i++) {
|
|
391
|
+
const spec = decl.child(i);
|
|
392
|
+
if (!spec || spec.type !== 'type_spec')
|
|
393
|
+
continue;
|
|
394
|
+
const nameNode = spec.childForFieldName('name');
|
|
395
|
+
const typeNode = spec.childForFieldName('type');
|
|
396
|
+
if (!nameNode || !typeNode)
|
|
397
|
+
continue;
|
|
398
|
+
const name = nameNode.text;
|
|
399
|
+
const isInterface = typeNode.type === 'interface_type';
|
|
400
|
+
const isStruct = typeNode.type === 'struct_type';
|
|
401
|
+
if (isStruct || isInterface) {
|
|
402
|
+
const fields = [];
|
|
403
|
+
const methods = [];
|
|
404
|
+
if (isStruct) {
|
|
405
|
+
// Extract struct fields
|
|
406
|
+
const fieldList = typeNode.childForFieldName('fields') ??
|
|
407
|
+
this.findChildByType(typeNode, 'field_declaration_list');
|
|
408
|
+
if (fieldList) {
|
|
409
|
+
for (let j = 0; j < fieldList.childCount; j++) {
|
|
410
|
+
const field = fieldList.child(j);
|
|
411
|
+
if (!field || field.type !== 'field_declaration')
|
|
412
|
+
continue;
|
|
413
|
+
const fieldName = field.childForFieldName('name');
|
|
414
|
+
const fieldType = field.childForFieldName('type');
|
|
415
|
+
if (fieldName) {
|
|
416
|
+
fields.push({
|
|
417
|
+
name: fieldName.text,
|
|
418
|
+
type: fieldType?.text || null,
|
|
419
|
+
modifiers: [],
|
|
420
|
+
annotations: [],
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
// Find methods declared for this type (method_declaration with matching receiver)
|
|
427
|
+
const methodDecls = this.findNodes(root, 'method_declaration');
|
|
428
|
+
for (const md of methodDecls) {
|
|
429
|
+
const receiver = md.childForFieldName('receiver');
|
|
430
|
+
if (!receiver)
|
|
431
|
+
continue;
|
|
432
|
+
const receiverText = receiver.text;
|
|
433
|
+
// Match (t *TypeName) or (t TypeName)
|
|
434
|
+
if (receiverText.includes(name)) {
|
|
435
|
+
const methodName = md.childForFieldName('name');
|
|
436
|
+
const params = md.childForFieldName('parameters');
|
|
437
|
+
const result = md.childForFieldName('result');
|
|
438
|
+
if (methodName) {
|
|
439
|
+
methods.push({
|
|
440
|
+
name: methodName.text,
|
|
441
|
+
return_type: result?.text || null,
|
|
442
|
+
parameters: params ? this.extractGoParams(params) : [],
|
|
443
|
+
annotations: [],
|
|
444
|
+
modifiers: [],
|
|
445
|
+
start_line: md.startPosition.row + 1,
|
|
446
|
+
end_line: md.endPosition.row + 1,
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
types.push({
|
|
452
|
+
name,
|
|
453
|
+
kind: isInterface ? 'interface' : 'class',
|
|
454
|
+
package: context.package || null,
|
|
455
|
+
extends: null,
|
|
456
|
+
implements: [],
|
|
457
|
+
annotations: [],
|
|
458
|
+
methods,
|
|
459
|
+
fields,
|
|
460
|
+
start_line: decl.startPosition.row + 1,
|
|
461
|
+
end_line: decl.endPosition.row + 1,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return types;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Extract call information from Go source.
|
|
470
|
+
*/
|
|
471
|
+
extractCalls(context) {
|
|
472
|
+
const calls = [];
|
|
473
|
+
const root = context.tree.rootNode;
|
|
474
|
+
const callExprs = this.findNodes(root, 'call_expression');
|
|
475
|
+
for (const call of callExprs) {
|
|
476
|
+
const func = call.childForFieldName('function');
|
|
477
|
+
if (!func)
|
|
478
|
+
continue;
|
|
479
|
+
let methodName;
|
|
480
|
+
let receiver = null;
|
|
481
|
+
if (func.type === 'selector_expression') {
|
|
482
|
+
// pkg.Function() or obj.Method()
|
|
483
|
+
const operand = func.childForFieldName('operand');
|
|
484
|
+
const field = func.childForFieldName('field');
|
|
485
|
+
receiver = operand?.text || null;
|
|
486
|
+
methodName = field?.text || func.text;
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
// Plain function call: funcName()
|
|
490
|
+
methodName = func.text;
|
|
491
|
+
}
|
|
492
|
+
const args = call.childForFieldName('arguments');
|
|
493
|
+
const argInfos = [];
|
|
494
|
+
let argPos = 0;
|
|
495
|
+
if (args) {
|
|
496
|
+
for (let i = 0; i < args.childCount; i++) {
|
|
497
|
+
const arg = args.child(i);
|
|
498
|
+
if (arg && arg.type !== '(' && arg.type !== ')' && arg.type !== ',') {
|
|
499
|
+
argInfos.push({
|
|
500
|
+
position: argPos++,
|
|
501
|
+
expression: arg.text,
|
|
502
|
+
variable: arg.type === 'identifier' ? arg.text : null,
|
|
503
|
+
literal: (arg.type === 'interpreted_string_literal' || arg.type === 'int_literal') ? arg.text : null,
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
calls.push({
|
|
509
|
+
method_name: methodName,
|
|
510
|
+
receiver,
|
|
511
|
+
arguments: argInfos,
|
|
512
|
+
location: {
|
|
513
|
+
line: call.startPosition.row + 1,
|
|
514
|
+
column: call.startPosition.column,
|
|
515
|
+
},
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
return calls;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Extract import information from Go source.
|
|
522
|
+
*/
|
|
523
|
+
extractImports(context) {
|
|
524
|
+
const imports = [];
|
|
525
|
+
const root = context.tree.rootNode;
|
|
526
|
+
const importDecls = this.findNodes(root, 'import_declaration');
|
|
527
|
+
for (const decl of importDecls) {
|
|
528
|
+
// Single import: import "fmt"
|
|
529
|
+
const singleSpec = this.findChildByType(decl, 'import_spec');
|
|
530
|
+
if (singleSpec) {
|
|
531
|
+
const parsed = this.parseImportSpec(singleSpec);
|
|
532
|
+
if (parsed)
|
|
533
|
+
imports.push(parsed);
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
536
|
+
// Grouped imports: import ( "fmt"; "net/http" )
|
|
537
|
+
const specList = this.findChildByType(decl, 'import_spec_list');
|
|
538
|
+
if (specList) {
|
|
539
|
+
for (let i = 0; i < specList.childCount; i++) {
|
|
540
|
+
const spec = specList.child(i);
|
|
541
|
+
if (!spec || spec.type !== 'import_spec')
|
|
542
|
+
continue;
|
|
543
|
+
const parsed = this.parseImportSpec(spec);
|
|
544
|
+
if (parsed)
|
|
545
|
+
imports.push(parsed);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return imports;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Extract package name from Go source.
|
|
553
|
+
*/
|
|
554
|
+
extractPackage(context) {
|
|
555
|
+
const root = context.tree.rootNode;
|
|
556
|
+
const pkgClause = this.findChildByType(root, 'package_clause');
|
|
557
|
+
if (!pkgClause)
|
|
558
|
+
return undefined;
|
|
559
|
+
// package_clause has a child with the package name
|
|
560
|
+
for (let i = 0; i < pkgClause.childCount; i++) {
|
|
561
|
+
const child = pkgClause.child(i);
|
|
562
|
+
if (child && child.type === 'package_identifier') {
|
|
563
|
+
return child.text;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return undefined;
|
|
567
|
+
}
|
|
568
|
+
// ── Private helpers ─────────────────────────────────────────────────────
|
|
569
|
+
parseImportSpec(spec) {
|
|
570
|
+
// import_spec: optional alias + path (interpreted_string_literal)
|
|
571
|
+
let alias = null;
|
|
572
|
+
let path;
|
|
573
|
+
for (let i = 0; i < spec.childCount; i++) {
|
|
574
|
+
const child = spec.child(i);
|
|
575
|
+
if (!child)
|
|
576
|
+
continue;
|
|
577
|
+
if (child.type === 'package_identifier' || child.type === 'blank_identifier' || child.type === 'dot') {
|
|
578
|
+
alias = child.text;
|
|
579
|
+
}
|
|
580
|
+
if (child.type === 'interpreted_string_literal') {
|
|
581
|
+
path = child.text.slice(1, -1); // Remove quotes
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
if (!path)
|
|
585
|
+
return null;
|
|
586
|
+
// Extract short name from path (e.g., "net/http" → "http")
|
|
587
|
+
const shortName = alias || path.split('/').pop() || path;
|
|
588
|
+
return {
|
|
589
|
+
imported_name: shortName,
|
|
590
|
+
from_package: path,
|
|
591
|
+
alias,
|
|
592
|
+
is_wildcard: alias === '.',
|
|
593
|
+
line_number: spec.startPosition.row + 1,
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
extractGoParams(params) {
|
|
597
|
+
const result = [];
|
|
598
|
+
for (let i = 0; i < params.childCount; i++) {
|
|
599
|
+
const param = params.child(i);
|
|
600
|
+
if (!param || param.type !== 'parameter_declaration')
|
|
601
|
+
continue;
|
|
602
|
+
const nameNode = param.childForFieldName('name');
|
|
603
|
+
const typeNode = param.childForFieldName('type');
|
|
604
|
+
if (nameNode) {
|
|
605
|
+
result.push({
|
|
606
|
+
name: nameNode.text,
|
|
607
|
+
type: typeNode?.text || null,
|
|
608
|
+
annotations: [],
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
return result;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
//# sourceMappingURL=go.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../src/languages/plugins/go.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,kBAAkB;IACrC,EAAE,GAAG,IAAa,CAAC;IACnB,IAAI,GAAG,IAAI,CAAC;IACZ,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,QAAQ,GAAG,qBAAqB,CAAC;IAEjC,SAAS,GAAsB;QACtC,oBAAoB;QACpB,gBAAgB,EAAE,CAAC,kBAAkB,CAAC;QACtC,oBAAoB,EAAE,CAAC,kBAAkB,CAAC;QAC1C,eAAe,EAAE,EAAE,EAAG,wCAAwC;QAC9D,mBAAmB,EAAE,CAAC,sBAAsB,CAAC;QAC7C,iBAAiB,EAAE,CAAC,oBAAoB,CAAC;QAEzC,cAAc;QACd,UAAU,EAAE,CAAC,iBAAiB,CAAC;QAC/B,YAAY,EAAE,CAAC,iBAAiB,CAAC;QACjC,UAAU,E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AAiB,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YACjD,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,QAAQ,CAAC,IAAI;oBACnB,IAAI,EAAE,QAAQ,EAAE,IAAI,IAAI,IAAI;oBAC5B,WAAW,EAAE,EAAE;iBAChB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -9,6 +9,7 @@ export { PythonPlugin } from './python.js';
|
|
|
9
9
|
export { RustPlugin } from './rust.js';
|
|
10
10
|
export { BashPlugin } from './bash.js';
|
|
11
11
|
export { HtmlPlugin } from './html.js';
|
|
12
|
+
export { GoPlugin } from './go.js';
|
|
12
13
|
/**
|
|
13
14
|
* Register all built-in language plugins with the global registry.
|
|
14
15
|
* Call this during analyzer initialization.
|
|
@@ -9,6 +9,7 @@ export { PythonPlugin } from './python.js';
|
|
|
9
9
|
export { RustPlugin } from './rust.js';
|
|
10
10
|
export { BashPlugin } from './bash.js';
|
|
11
11
|
export { HtmlPlugin } from './html.js';
|
|
12
|
+
export { GoPlugin } from './go.js';
|
|
12
13
|
import { registerLanguage } from '../registry.js';
|
|
13
14
|
import { JavaPlugin } from './java.js';
|
|
14
15
|
import { JavaScriptPlugin } from './javascript.js';
|
|
@@ -16,6 +17,7 @@ import { PythonPlugin } from './python.js';
|
|
|
16
17
|
import { RustPlugin } from './rust.js';
|
|
17
18
|
import { BashPlugin } from './bash.js';
|
|
18
19
|
import { HtmlPlugin } from './html.js';
|
|
20
|
+
import { GoPlugin } from './go.js';
|
|
19
21
|
/**
|
|
20
22
|
* Register all built-in language plugins with the global registry.
|
|
21
23
|
* Call this during analyzer initialization.
|
|
@@ -27,5 +29,6 @@ export function registerBuiltinPlugins() {
|
|
|
27
29
|
registerLanguage(new RustPlugin());
|
|
28
30
|
registerLanguage(new BashPlugin());
|
|
29
31
|
registerLanguage(new HtmlPlugin());
|
|
32
|
+
registerLanguage(new GoPlugin());
|
|
30
33
|
}
|
|
31
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/languages/plugins/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/languages/plugins/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,W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