@codacy/tools-flawfinder-2 0.1.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/index.js ADDED
@@ -0,0 +1,2166 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => index_default
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_tooling2 = require("@codacy/tooling");
37
+
38
+ // src/adapter.ts
39
+ var import_tooling = require("@codacy/tooling");
40
+ var import_path = __toESM(require("path"));
41
+ var import_promises = __toESM(require("fs/promises"));
42
+
43
+ // src/patterns.json
44
+ var patterns_default = [
45
+ {
46
+ id: "flawfinder_access",
47
+ category: "Security",
48
+ severityLevel: "High",
49
+ title: "Detect Potential Security Flaws in access() Calls",
50
+ enabled: false,
51
+ parameters: []
52
+ },
53
+ {
54
+ id: "flawfinder_AddAccessAllowedAce",
55
+ category: "Security",
56
+ severityLevel: "High",
57
+ title: "Avoid AddAccessAllowedAce calls without setting inheritance bits",
58
+ enabled: false,
59
+ parameters: []
60
+ },
61
+ {
62
+ id: "flawfinder_atoi",
63
+ category: "Security",
64
+ severityLevel: "High",
65
+ title: "Avoid unsafe usage of atoi",
66
+ enabled: false,
67
+ parameters: []
68
+ },
69
+ {
70
+ id: "flawfinder_atol",
71
+ category: "Security",
72
+ severityLevel: "High",
73
+ title: "Avoid unchecked use of atol",
74
+ enabled: false,
75
+ parameters: []
76
+ },
77
+ {
78
+ id: "flawfinder_bcopy",
79
+ category: "Security",
80
+ severityLevel: "High",
81
+ title: "Avoid unsafe use of bcopy",
82
+ enabled: false,
83
+ parameters: []
84
+ },
85
+ {
86
+ id: "flawfinder_char",
87
+ category: "Security",
88
+ severityLevel: "High",
89
+ title: "Detect Potential Security Problems in char Array Usage",
90
+ enabled: false,
91
+ parameters: []
92
+ },
93
+ {
94
+ id: "flawfinder_chgrp",
95
+ category: "Security",
96
+ severityLevel: "High",
97
+ title: "Avoid Race Condition in chgrp Calls",
98
+ enabled: false,
99
+ parameters: []
100
+ },
101
+ {
102
+ id: "flawfinder_chmod",
103
+ category: "Security",
104
+ severityLevel: "High",
105
+ title: "Avoid insecure use of chmod with filename arguments",
106
+ enabled: false,
107
+ parameters: []
108
+ },
109
+ {
110
+ id: "flawfinder_chown",
111
+ category: "Security",
112
+ severityLevel: "High",
113
+ title: "Avoid insecure use of chown calls",
114
+ enabled: false,
115
+ parameters: []
116
+ },
117
+ {
118
+ id: "flawfinder_chroot",
119
+ category: "Security",
120
+ severityLevel: "High",
121
+ title: "Detect Potential Security Issues in chroot Calls",
122
+ enabled: false,
123
+ parameters: []
124
+ },
125
+ {
126
+ id: "flawfinder_CoImpersonateClient",
127
+ category: "Security",
128
+ severityLevel: "Error",
129
+ title: "Avoid failing CoImpersonateClient calls",
130
+ enabled: false,
131
+ parameters: []
132
+ },
133
+ {
134
+ id: "flawfinder_CopyMemory",
135
+ category: "Security",
136
+ severityLevel: "Error",
137
+ title: "Avoid Unsafe CopyMemory Calls",
138
+ enabled: false,
139
+ parameters: []
140
+ },
141
+ {
142
+ id: "flawfinder_CreateProcess",
143
+ category: "Security",
144
+ severityLevel: "High",
145
+ title: "Avoid Unsafe Use of CreateProcess Calls",
146
+ enabled: false,
147
+ parameters: []
148
+ },
149
+ {
150
+ id: "flawfinder_CreateProcessAsUser",
151
+ category: "Security",
152
+ severityLevel: "High",
153
+ title: "Avoid Unsafe Use of CreateProcessAsUser",
154
+ enabled: false,
155
+ parameters: []
156
+ },
157
+ {
158
+ id: "flawfinder_CreateProcessWithLogon",
159
+ category: "Security",
160
+ severityLevel: "Error",
161
+ title: "Avoid Unsafe Use of CreateProcessWithLogon",
162
+ enabled: false,
163
+ parameters: []
164
+ },
165
+ {
166
+ id: "flawfinder_crypt",
167
+ category: "Security",
168
+ severityLevel: "High",
169
+ title: "Avoid Using Weak crypt() Function",
170
+ enabled: false,
171
+ parameters: []
172
+ },
173
+ {
174
+ id: "flawfinder_crypt_r",
175
+ category: "Security",
176
+ severityLevel: "High",
177
+ title: "Avoid Using crypt_r with Weak Hashing Algorithm",
178
+ enabled: false,
179
+ parameters: []
180
+ },
181
+ {
182
+ id: "flawfinder_curl_getenv",
183
+ category: "Security",
184
+ severityLevel: "High",
185
+ title: "Avoid Using curl_getenv with Untrusted Environment Variables",
186
+ enabled: false,
187
+ parameters: []
188
+ },
189
+ {
190
+ id: "flawfinder_cuserid",
191
+ category: "Security",
192
+ severityLevel: "High",
193
+ title: "Avoid use of cuserid() function",
194
+ enabled: false,
195
+ parameters: []
196
+ },
197
+ {
198
+ id: "flawfinder_drand48",
199
+ category: "Security",
200
+ severityLevel: "High",
201
+ title: "Avoid Using drand48 for Security-Sensitive Randomness",
202
+ enabled: false,
203
+ parameters: []
204
+ },
205
+ {
206
+ id: "flawfinder_equal",
207
+ category: "Security",
208
+ severityLevel: "High",
209
+ title: "Avoid unsafe use of equal calls",
210
+ enabled: false,
211
+ parameters: []
212
+ },
213
+ {
214
+ id: "flawfinder_erand48",
215
+ category: "Security",
216
+ severityLevel: "High",
217
+ title: "Avoid Using erand48 for Security-Critical Randomness",
218
+ enabled: false,
219
+ parameters: []
220
+ },
221
+ {
222
+ id: "flawfinder_EVP_des_cbc",
223
+ category: "Security",
224
+ severityLevel: "High",
225
+ title: "Avoid Use of EVP_des_cbc (DES with CBC mode)",
226
+ enabled: false,
227
+ parameters: []
228
+ },
229
+ {
230
+ id: "flawfinder_EVP_des_cfb",
231
+ category: "Security",
232
+ severityLevel: "Error",
233
+ title: "Avoid Using EVP_des_cfb Due to Weak DES Encryption",
234
+ enabled: false,
235
+ parameters: []
236
+ },
237
+ {
238
+ id: "flawfinder_EVP_des_ecb",
239
+ category: "Security",
240
+ severityLevel: "High",
241
+ title: "Avoid Using EVP_des_ecb for Encryption",
242
+ enabled: false,
243
+ parameters: []
244
+ },
245
+ {
246
+ id: "flawfinder_EVP_des_ofb",
247
+ category: "Security",
248
+ severityLevel: "High",
249
+ title: "Avoid Using EVP_des_ofb with DES",
250
+ enabled: false,
251
+ parameters: []
252
+ },
253
+ {
254
+ id: "flawfinder_EVP_desx_cbc",
255
+ category: "Security",
256
+ severityLevel: "Error",
257
+ title: "Avoid Using EVP_desx_cbc with DES Encryption",
258
+ enabled: false,
259
+ parameters: []
260
+ },
261
+ {
262
+ id: "flawfinder_EVP_rc2_40_cbc",
263
+ category: "Security",
264
+ severityLevel: "High",
265
+ title: "Avoid Using EVP_rc2_40_cbc with Small Key Sizes",
266
+ enabled: false,
267
+ parameters: []
268
+ },
269
+ {
270
+ id: "flawfinder_EVP_rc2_64_cbc",
271
+ category: "Security",
272
+ severityLevel: "High",
273
+ title: "Avoid Using EVP_rc2_64_cbc with Small Key Sizes",
274
+ enabled: false,
275
+ parameters: []
276
+ },
277
+ {
278
+ id: "flawfinder_EVP_rc4_40",
279
+ category: "Security",
280
+ severityLevel: "High",
281
+ title: "Avoid Using EVP_rc4_40 with Small Key Sizes",
282
+ enabled: false,
283
+ parameters: []
284
+ },
285
+ {
286
+ id: "flawfinder_execl",
287
+ category: "Security",
288
+ severityLevel: "Error",
289
+ title: "Avoid unsafe use of execl calls",
290
+ enabled: false,
291
+ parameters: []
292
+ },
293
+ {
294
+ id: "flawfinder_execle",
295
+ category: "Security",
296
+ severityLevel: "High",
297
+ title: "Avoid insecure use of execle calls",
298
+ enabled: false,
299
+ parameters: []
300
+ },
301
+ {
302
+ id: "flawfinder_execlp",
303
+ category: "Security",
304
+ severityLevel: "High",
305
+ title: "Avoid Unsafe Use of execlp Calls",
306
+ enabled: false,
307
+ parameters: []
308
+ },
309
+ {
310
+ id: "flawfinder_execv",
311
+ category: "Security",
312
+ severityLevel: "High",
313
+ title: "Avoid Unsafe execv Calls",
314
+ enabled: false,
315
+ parameters: []
316
+ },
317
+ {
318
+ id: "flawfinder_execvp",
319
+ category: "Security",
320
+ severityLevel: "High",
321
+ title: "Avoid Unsafe Use of execvp",
322
+ enabled: false,
323
+ parameters: []
324
+ },
325
+ {
326
+ id: "flawfinder_fgetc",
327
+ category: "Security",
328
+ severityLevel: "High",
329
+ title: "Check Buffer Boundaries in fgetc Calls",
330
+ enabled: true,
331
+ parameters: []
332
+ },
333
+ {
334
+ id: "flawfinder_fopen",
335
+ category: "Security",
336
+ severityLevel: "High",
337
+ title: "Avoid Unsafe fopen Calls",
338
+ enabled: false,
339
+ parameters: []
340
+ },
341
+ {
342
+ id: "flawfinder_fprintf",
343
+ category: "Security",
344
+ severityLevel: "Error",
345
+ title: "Avoid Unsafe fprintf Usage",
346
+ enabled: false,
347
+ parameters: []
348
+ },
349
+ {
350
+ id: "flawfinder_fread",
351
+ category: "Security",
352
+ severityLevel: "High",
353
+ title: "Detect Potential Security Issues in fread Calls",
354
+ enabled: false,
355
+ parameters: []
356
+ },
357
+ {
358
+ id: "flawfinder_fscanf",
359
+ category: "Security",
360
+ severityLevel: "Error",
361
+ title: "Avoid unsafe fscanf %s usage",
362
+ enabled: false,
363
+ parameters: []
364
+ },
365
+ {
366
+ id: "flawfinder__ftcscat",
367
+ category: "Security",
368
+ severityLevel: "High",
369
+ title: "Avoid unsafe use of _ftcscat",
370
+ enabled: false,
371
+ parameters: []
372
+ },
373
+ {
374
+ id: "flawfinder__ftcscpy",
375
+ category: "Security",
376
+ severityLevel: "Error",
377
+ title: "Avoid unsafe _ftcscpy usage",
378
+ enabled: false,
379
+ parameters: []
380
+ },
381
+ {
382
+ id: "flawfinder__ftprintf",
383
+ category: "Security",
384
+ severityLevel: "Error",
385
+ title: "Avoid Unsafe _ftprintf Calls",
386
+ enabled: false,
387
+ parameters: []
388
+ },
389
+ {
390
+ id: "flawfinder__ftscanf",
391
+ category: "Security",
392
+ severityLevel: "High",
393
+ title: "Avoid unsafe _ftscanf %s usage",
394
+ enabled: false,
395
+ parameters: []
396
+ },
397
+ {
398
+ id: "flawfinder_fvwprintf",
399
+ category: "Security",
400
+ severityLevel: "Error",
401
+ title: "Avoid insecure use of fvwprintf",
402
+ enabled: false,
403
+ parameters: []
404
+ },
405
+ {
406
+ id: "flawfinder_fwprintf",
407
+ category: "Security",
408
+ severityLevel: "Error",
409
+ title: "Avoid insecure usage of fwprintf with attacker-controlled format strings",
410
+ enabled: false,
411
+ parameters: []
412
+ },
413
+ {
414
+ id: "flawfinder_fwscanf",
415
+ category: "Security",
416
+ severityLevel: "High",
417
+ title: "Avoid unsafe usage of fwscanf with %s specifier",
418
+ enabled: false,
419
+ parameters: []
420
+ },
421
+ {
422
+ id: "flawfinder_getc",
423
+ category: "Security",
424
+ severityLevel: "High",
425
+ title: "Avoid Unsafe Use of getc",
426
+ enabled: true,
427
+ parameters: []
428
+ },
429
+ {
430
+ id: "flawfinder_getchar",
431
+ category: "Security",
432
+ severityLevel: "High",
433
+ title: "Avoid Unsafe Use of getchar()",
434
+ enabled: true,
435
+ parameters: []
436
+ },
437
+ {
438
+ id: "flawfinder_getenv",
439
+ category: "Security",
440
+ severityLevel: "High",
441
+ title: "Avoid Unsafe Use of getenv",
442
+ enabled: false,
443
+ parameters: []
444
+ },
445
+ {
446
+ id: "flawfinder_getlogin",
447
+ category: "Security",
448
+ severityLevel: "High",
449
+ title: "Avoid Using getlogin() for Security-Related Purposes",
450
+ enabled: false,
451
+ parameters: []
452
+ },
453
+ {
454
+ id: "flawfinder_getopt",
455
+ category: "Security",
456
+ severityLevel: "High",
457
+ title: "Avoid Unsafe getopt Calls",
458
+ enabled: false,
459
+ parameters: []
460
+ },
461
+ {
462
+ id: "flawfinder_getopt_long",
463
+ category: "Security",
464
+ severityLevel: "High",
465
+ title: "Avoid Unsafe getopt_long Calls",
466
+ enabled: false,
467
+ parameters: []
468
+ },
469
+ {
470
+ id: "flawfinder_getpass",
471
+ category: "Security",
472
+ severityLevel: "High",
473
+ title: "Avoid Using Obsolete getpass Function",
474
+ enabled: false,
475
+ parameters: []
476
+ },
477
+ {
478
+ id: "flawfinder_getpw",
479
+ category: "Security",
480
+ severityLevel: "High",
481
+ title: "Avoid Using getpw Function",
482
+ enabled: false,
483
+ parameters: []
484
+ },
485
+ {
486
+ id: "flawfinder_gets",
487
+ category: "Security",
488
+ severityLevel: "Error",
489
+ title: "Avoid using gets function",
490
+ enabled: false,
491
+ parameters: []
492
+ },
493
+ {
494
+ id: "flawfinder__gettc",
495
+ category: "Security",
496
+ severityLevel: "High",
497
+ title: "Check buffer boundaries in _gettc calls",
498
+ enabled: true,
499
+ parameters: []
500
+ },
501
+ {
502
+ id: "flawfinder_GetTempFileName",
503
+ category: "Security",
504
+ severityLevel: "High",
505
+ title: "Avoid insecure use of GetTempFileName",
506
+ enabled: false,
507
+ parameters: []
508
+ },
509
+ {
510
+ id: "flawfinder__getts",
511
+ category: "Security",
512
+ severityLevel: "Error",
513
+ title: "Avoid _getts Calls",
514
+ enabled: false,
515
+ parameters: []
516
+ },
517
+ {
518
+ id: "flawfinder_getwd",
519
+ category: "Security",
520
+ severityLevel: "High",
521
+ title: "Avoid Using getwd Calls",
522
+ enabled: false,
523
+ parameters: []
524
+ },
525
+ {
526
+ id: "flawfinder_g_get_home_dir",
527
+ category: "Security",
528
+ severityLevel: "High",
529
+ title: "Avoid Using g_get_home_dir Due to Untrusted Input",
530
+ enabled: false,
531
+ parameters: []
532
+ },
533
+ {
534
+ id: "flawfinder_g_get_tmp_dir",
535
+ category: "Security",
536
+ severityLevel: "High",
537
+ title: "Avoid Using g_get_tmp_dir for Temporary Directory Retrieval",
538
+ enabled: false,
539
+ parameters: []
540
+ },
541
+ {
542
+ id: "flawfinder_g_rand_boolean",
543
+ category: "Security",
544
+ severityLevel: "High",
545
+ title: "Avoid Using g_rand_boolean for Security-Sensitive Randomness",
546
+ enabled: false,
547
+ parameters: []
548
+ },
549
+ {
550
+ id: "flawfinder_g_rand_double",
551
+ category: "Security",
552
+ severityLevel: "High",
553
+ title: "Avoid using g_rand_double for security-related randomness",
554
+ enabled: false,
555
+ parameters: []
556
+ },
557
+ {
558
+ id: "flawfinder_g_rand_double_range",
559
+ category: "Security",
560
+ severityLevel: "Error",
561
+ title: "Avoid use of g_rand_double_range for security-sensitive randomness",
562
+ enabled: false,
563
+ parameters: []
564
+ },
565
+ {
566
+ id: "flawfinder_g_rand_int",
567
+ category: "Security",
568
+ severityLevel: "Error",
569
+ title: "Avoid Using g_rand_int for Security-Critical Randomness",
570
+ enabled: false,
571
+ parameters: []
572
+ },
573
+ {
574
+ id: "flawfinder_g_rand_int_range",
575
+ category: "Security",
576
+ severityLevel: "Error",
577
+ title: "Avoid Using g_rand_int_range for Security-Critical Randomness",
578
+ enabled: false,
579
+ parameters: []
580
+ },
581
+ {
582
+ id: "flawfinder_g_random_boolean",
583
+ category: "Security",
584
+ severityLevel: "High",
585
+ title: "Avoid Using g_random_boolean for Security-Sensitive Randomness",
586
+ enabled: false,
587
+ parameters: []
588
+ },
589
+ {
590
+ id: "flawfinder_g_random_double",
591
+ category: "Security",
592
+ severityLevel: "High",
593
+ title: "Avoid Using g_random_double for Security-Critical Randomness",
594
+ enabled: false,
595
+ parameters: []
596
+ },
597
+ {
598
+ id: "flawfinder_g_random_double_range",
599
+ category: "Security",
600
+ severityLevel: "High",
601
+ title: "Avoid Using g_random_double_range for Security-Critical Randomness",
602
+ enabled: false,
603
+ parameters: []
604
+ },
605
+ {
606
+ id: "flawfinder_g_random_int",
607
+ category: "Security",
608
+ severityLevel: "High",
609
+ title: "Avoid Using g_random_int for Security-Sensitive Randomness",
610
+ enabled: false,
611
+ parameters: []
612
+ },
613
+ {
614
+ id: "flawfinder_g_random_int_range",
615
+ category: "Security",
616
+ severityLevel: "High",
617
+ title: "Avoid Using g_random_int_range for Security-Critical Randomness",
618
+ enabled: false,
619
+ parameters: []
620
+ },
621
+ {
622
+ id: "flawfinder_gsignal",
623
+ category: "Security",
624
+ severityLevel: "High",
625
+ title: "Avoid use of obsolete gsignal functions",
626
+ enabled: false,
627
+ parameters: []
628
+ },
629
+ {
630
+ id: "flawfinder_ImpersonateDdeClientWindow",
631
+ category: "Security",
632
+ severityLevel: "High",
633
+ title: "Detect Potential Security Issues in ImpersonateDdeClientWindow Calls",
634
+ enabled: false,
635
+ parameters: []
636
+ },
637
+ {
638
+ id: "flawfinder_ImpersonateLoggedOnUser",
639
+ category: "Security",
640
+ severityLevel: "High",
641
+ title: "Detect potential security problems in ImpersonateLoggedOnUser calls",
642
+ enabled: false,
643
+ parameters: []
644
+ },
645
+ {
646
+ id: "flawfinder_ImpersonateNamedPipeClient",
647
+ category: "Security",
648
+ severityLevel: "High",
649
+ title: "Detect Potential Security Issues in ImpersonateNamedPipeClient Calls",
650
+ enabled: false,
651
+ parameters: []
652
+ },
653
+ {
654
+ id: "flawfinder_ImpersonateSecurityContext",
655
+ category: "Security",
656
+ severityLevel: "High",
657
+ title: "Detect Potential Security Issues in ImpersonateSecurityContext Calls",
658
+ enabled: false,
659
+ parameters: []
660
+ },
661
+ {
662
+ id: "flawfinder_InitializeCriticalSection",
663
+ category: "Security",
664
+ severityLevel: "High",
665
+ title: "Avoid Exceptions in InitializeCriticalSection Calls",
666
+ enabled: false,
667
+ parameters: []
668
+ },
669
+ {
670
+ id: "flawfinder_is_permutation",
671
+ category: "Security",
672
+ severityLevel: "High",
673
+ title: "Avoid unsafe use of is_permutation that may cause iterator over-read",
674
+ enabled: false,
675
+ parameters: []
676
+ },
677
+ {
678
+ id: "flawfinder_jrand48",
679
+ category: "Security",
680
+ severityLevel: "High",
681
+ title: "Avoid Using jrand48 for Security-Related Randomness",
682
+ enabled: false,
683
+ parameters: []
684
+ },
685
+ {
686
+ id: "flawfinder_lcong48",
687
+ category: "Security",
688
+ severityLevel: "High",
689
+ title: "Avoid Using lcong48 for Security-Critical Randomness",
690
+ enabled: false,
691
+ parameters: []
692
+ },
693
+ {
694
+ id: "flawfinder_LoadLibrary",
695
+ category: "Security",
696
+ severityLevel: "High",
697
+ title: "Ensure Full Path in LoadLibrary Calls",
698
+ enabled: false,
699
+ parameters: []
700
+ },
701
+ {
702
+ id: "flawfinder_LoadLibraryEx",
703
+ category: "Security",
704
+ severityLevel: "High",
705
+ title: "Ensure Full Path in LoadLibraryEx Calls",
706
+ enabled: false,
707
+ parameters: []
708
+ },
709
+ {
710
+ id: "flawfinder_lrand48",
711
+ category: "Security",
712
+ severityLevel: "High",
713
+ title: "Avoid using lrand48 for security-sensitive randomness",
714
+ enabled: false,
715
+ parameters: []
716
+ },
717
+ {
718
+ id: "flawfinder_lstrcat",
719
+ category: "Security",
720
+ severityLevel: "Error",
721
+ title: "Avoid Unsafe Use of lstrcat",
722
+ enabled: false,
723
+ parameters: []
724
+ },
725
+ {
726
+ id: "flawfinder_lstrcatA",
727
+ category: "Security",
728
+ severityLevel: "Error",
729
+ title: "Avoid Unsafe Use of lstrcatA",
730
+ enabled: false,
731
+ parameters: []
732
+ },
733
+ {
734
+ id: "flawfinder_lstrcatn",
735
+ category: "Security",
736
+ severityLevel: "High",
737
+ title: "Avoid Incorrect Usage of lstrcatn",
738
+ enabled: true,
739
+ parameters: []
740
+ },
741
+ {
742
+ id: "flawfinder_lstrcatnA",
743
+ category: "Security",
744
+ severityLevel: "Error",
745
+ title: "Avoid Unsafe Use of lstrcatnA",
746
+ enabled: false,
747
+ parameters: []
748
+ },
749
+ {
750
+ id: "flawfinder_lstrcatnW",
751
+ category: "Security",
752
+ severityLevel: "High",
753
+ title: "Avoid unsafe use of lstrcatnW",
754
+ enabled: false,
755
+ parameters: []
756
+ },
757
+ {
758
+ id: "flawfinder_lstrcatW",
759
+ category: "Security",
760
+ severityLevel: "High",
761
+ title: "Avoid unsafe usage of lstrcatW",
762
+ enabled: false,
763
+ parameters: []
764
+ },
765
+ {
766
+ id: "flawfinder_lstrcpy",
767
+ category: "Security",
768
+ severityLevel: "High",
769
+ title: "Avoid unsafe use of lstrcpy",
770
+ enabled: false,
771
+ parameters: []
772
+ },
773
+ {
774
+ id: "flawfinder_lstrcpyA",
775
+ category: "Security",
776
+ severityLevel: "Error",
777
+ title: "Avoid unsafe use of lstrcpyA",
778
+ enabled: false,
779
+ parameters: []
780
+ },
781
+ {
782
+ id: "flawfinder_lstrcpyn",
783
+ category: "Security",
784
+ severityLevel: "High",
785
+ title: "Avoid Incorrect Use of lstrcpyn",
786
+ enabled: true,
787
+ parameters: []
788
+ },
789
+ {
790
+ id: "flawfinder_lstrcpynA",
791
+ category: "Security",
792
+ severityLevel: "Error",
793
+ title: "Avoid insecure use of lstrcpynA calls",
794
+ enabled: false,
795
+ parameters: []
796
+ },
797
+ {
798
+ id: "flawfinder_lstrcpynW",
799
+ category: "Security",
800
+ severityLevel: "Error",
801
+ title: "Avoid unsafe use of lstrcpynW",
802
+ enabled: false,
803
+ parameters: []
804
+ },
805
+ {
806
+ id: "flawfinder_lstrcpyW",
807
+ category: "Security",
808
+ severityLevel: "Error",
809
+ title: "Avoid Unsafe Use of lstrcpyW",
810
+ enabled: false,
811
+ parameters: []
812
+ },
813
+ {
814
+ id: "flawfinder_lstrncat",
815
+ category: "Security",
816
+ severityLevel: "High",
817
+ title: "Avoid unsafe use of lstrncat",
818
+ enabled: false,
819
+ parameters: []
820
+ },
821
+ {
822
+ id: "flawfinder__mbccat",
823
+ category: "Security",
824
+ severityLevel: "Error",
825
+ title: "Avoid unsafe use of _mbccat function",
826
+ enabled: false,
827
+ parameters: []
828
+ },
829
+ {
830
+ id: "flawfinder__mbccpy",
831
+ category: "Security",
832
+ severityLevel: "Error",
833
+ title: "Avoid _mbccpy Calls Without Buffer Overflow Checks",
834
+ enabled: false,
835
+ parameters: []
836
+ },
837
+ {
838
+ id: "flawfinder__mbscat",
839
+ category: "Security",
840
+ severityLevel: "High",
841
+ title: "Avoid Unsafe _mbscat Calls",
842
+ enabled: false,
843
+ parameters: []
844
+ },
845
+ {
846
+ id: "flawfinder__mbscpy",
847
+ category: "Security",
848
+ severityLevel: "High",
849
+ title: "Avoid _mbscpy Calls",
850
+ enabled: false,
851
+ parameters: []
852
+ },
853
+ {
854
+ id: "flawfinder__mbslen",
855
+ category: "Security",
856
+ severityLevel: "High",
857
+ title: "Avoid Unsafe _mbslen Calls",
858
+ enabled: true,
859
+ parameters: []
860
+ },
861
+ {
862
+ id: "flawfinder__mbsnbcat",
863
+ category: "Security",
864
+ severityLevel: "High",
865
+ title: "Avoid Unsafe Use of _mbsnbcat",
866
+ enabled: true,
867
+ parameters: []
868
+ },
869
+ {
870
+ id: "flawfinder__mbsnbcpy",
871
+ category: "Security",
872
+ severityLevel: "High",
873
+ title: "Avoid Incorrect Use of _mbsnbcpy",
874
+ enabled: true,
875
+ parameters: []
876
+ },
877
+ {
878
+ id: "flawfinder__mbsncpy",
879
+ category: "Security",
880
+ severityLevel: "Error",
881
+ title: "Avoid unsafe use of _mbsncpy",
882
+ enabled: false,
883
+ parameters: []
884
+ },
885
+ {
886
+ id: "flawfinder_memalign",
887
+ category: "Security",
888
+ severityLevel: "High",
889
+ title: "Avoid Unsafe memalign Usage",
890
+ enabled: true,
891
+ parameters: []
892
+ },
893
+ {
894
+ id: "flawfinder_memcpy",
895
+ category: "Security",
896
+ severityLevel: "Error",
897
+ title: "Avoid Unsafe memcpy Usage",
898
+ enabled: false,
899
+ parameters: []
900
+ },
901
+ {
902
+ id: "flawfinder_mismatch",
903
+ category: "Security",
904
+ severityLevel: "High",
905
+ title: "Avoid Unsafe Usage of std::mismatch",
906
+ enabled: false,
907
+ parameters: []
908
+ },
909
+ {
910
+ id: "flawfinder_mkstemp",
911
+ category: "Security",
912
+ severityLevel: "High",
913
+ title: "Detect Potential Security Vulnerabilities in mkstemp Calls",
914
+ enabled: false,
915
+ parameters: []
916
+ },
917
+ {
918
+ id: "flawfinder_mktemp",
919
+ category: "Security",
920
+ severityLevel: "Error",
921
+ title: "Avoid insecure mktemp usage",
922
+ enabled: false,
923
+ parameters: []
924
+ },
925
+ {
926
+ id: "flawfinder_mrand48",
927
+ category: "Security",
928
+ severityLevel: "High",
929
+ title: "Avoid using mrand48 for security-related randomness",
930
+ enabled: false,
931
+ parameters: []
932
+ },
933
+ {
934
+ id: "flawfinder_MultiByteToWideChar",
935
+ category: "Security",
936
+ severityLevel: "High",
937
+ title: "Ensure MultiByteToWideChar Maximum Length Is in Characters",
938
+ enabled: false,
939
+ parameters: []
940
+ },
941
+ {
942
+ id: "flawfinder_nrand48",
943
+ category: "Security",
944
+ severityLevel: "High",
945
+ title: "Avoid Using nrand48 for Security-Critical Randomness",
946
+ enabled: false,
947
+ parameters: []
948
+ },
949
+ {
950
+ id: "flawfinder_open",
951
+ category: "Security",
952
+ severityLevel: "High",
953
+ title: "Detect Potential Security Issues in open() Calls",
954
+ enabled: false,
955
+ parameters: []
956
+ },
957
+ {
958
+ id: "flawfinder_popen",
959
+ category: "Security",
960
+ severityLevel: "Error",
961
+ title: "Avoid Unsafe Use of popen",
962
+ enabled: false,
963
+ parameters: []
964
+ },
965
+ {
966
+ id: "flawfinder_printf",
967
+ category: "Security",
968
+ severityLevel: "Error",
969
+ title: "Avoid Unsafe Use of printf with Untrusted Format Strings",
970
+ enabled: false,
971
+ parameters: []
972
+ },
973
+ {
974
+ id: "flawfinder_random",
975
+ category: "Security",
976
+ severityLevel: "High",
977
+ title: "Avoid Using Insufficiently Random Functions for Security",
978
+ enabled: false,
979
+ parameters: []
980
+ },
981
+ {
982
+ id: "flawfinder_read",
983
+ category: "Security",
984
+ severityLevel: "Error",
985
+ title: "Check Buffer Boundaries in read Calls",
986
+ enabled: true,
987
+ parameters: []
988
+ },
989
+ {
990
+ id: "flawfinder_readlink",
991
+ category: "Security",
992
+ severityLevel: "High",
993
+ title: "Avoid insecure use of readlink",
994
+ enabled: false,
995
+ parameters: []
996
+ },
997
+ {
998
+ id: "flawfinder_readv",
999
+ category: "Security",
1000
+ severityLevel: "High",
1001
+ title: "Detect Potential Security Issues in readv Calls",
1002
+ enabled: false,
1003
+ parameters: []
1004
+ },
1005
+ {
1006
+ id: "flawfinder_realpath",
1007
+ category: "Security",
1008
+ severityLevel: "Error",
1009
+ title: "Avoid unsafe realpath usage",
1010
+ enabled: false,
1011
+ parameters: []
1012
+ },
1013
+ {
1014
+ id: "flawfinder_recv",
1015
+ category: "Security",
1016
+ severityLevel: "High",
1017
+ title: "Detect Potential Security Issues in recv Calls",
1018
+ enabled: false,
1019
+ parameters: []
1020
+ },
1021
+ {
1022
+ id: "flawfinder_recvfrom",
1023
+ category: "Security",
1024
+ severityLevel: "High",
1025
+ title: "Avoid unsafe usage of recvfrom calls",
1026
+ enabled: false,
1027
+ parameters: []
1028
+ },
1029
+ {
1030
+ id: "flawfinder_recvmsg",
1031
+ category: "Security",
1032
+ severityLevel: "High",
1033
+ title: "Detect Potential Security Issues in recvmsg Calls",
1034
+ enabled: false,
1035
+ parameters: []
1036
+ },
1037
+ {
1038
+ id: "flawfinder_RpcImpersonateClient",
1039
+ category: "Security",
1040
+ severityLevel: "High",
1041
+ title: "Check RpcImpersonateClient Call Success",
1042
+ enabled: false,
1043
+ parameters: []
1044
+ },
1045
+ {
1046
+ id: "flawfinder_scanf",
1047
+ category: "Security",
1048
+ severityLevel: "Error",
1049
+ title: "Avoid Unsafe scanf %s Usage",
1050
+ enabled: false,
1051
+ parameters: []
1052
+ },
1053
+ {
1054
+ id: "flawfinder_seed48",
1055
+ category: "Security",
1056
+ severityLevel: "High",
1057
+ title: "Avoid Using seed48 for Security-Critical Randomness",
1058
+ enabled: false,
1059
+ parameters: []
1060
+ },
1061
+ {
1062
+ id: "flawfinder_SetSecurityDescriptorDacl",
1063
+ category: "Security",
1064
+ severityLevel: "Error",
1065
+ title: "Avoid Creating NULL ACLs with SetSecurityDescriptorDacl",
1066
+ enabled: false,
1067
+ parameters: []
1068
+ },
1069
+ {
1070
+ id: "flawfinder_setstate",
1071
+ category: "Security",
1072
+ severityLevel: "High",
1073
+ title: "Avoid using setstate for security-related randomness",
1074
+ enabled: false,
1075
+ parameters: []
1076
+ },
1077
+ {
1078
+ id: "flawfinder_SetThreadToken",
1079
+ category: "Security",
1080
+ severityLevel: "High",
1081
+ title: "Detect Potential Security Issues in SetThreadToken Calls",
1082
+ enabled: false,
1083
+ parameters: []
1084
+ },
1085
+ {
1086
+ id: "flawfinder_ShellExecute",
1087
+ category: "Security",
1088
+ severityLevel: "High",
1089
+ title: "Avoid Unsafe ShellExecute Calls",
1090
+ enabled: false,
1091
+ parameters: []
1092
+ },
1093
+ {
1094
+ id: "flawfinder_snprintf",
1095
+ category: "Security",
1096
+ severityLevel: "Error",
1097
+ title: "Avoid insecure usage of snprintf",
1098
+ enabled: false,
1099
+ parameters: []
1100
+ },
1101
+ {
1102
+ id: "flawfinder__snprintf",
1103
+ category: "Security",
1104
+ severityLevel: "Error",
1105
+ title: "Detect Potential Security Issues in _snprintf Calls",
1106
+ enabled: false,
1107
+ parameters: []
1108
+ },
1109
+ {
1110
+ id: "flawfinder__sntprintf",
1111
+ category: "Security",
1112
+ severityLevel: "Error",
1113
+ title: "Avoid Unsafe Use of _sntprintf",
1114
+ enabled: false,
1115
+ parameters: []
1116
+ },
1117
+ {
1118
+ id: "flawfinder_sprintf",
1119
+ category: "Security",
1120
+ severityLevel: "Error",
1121
+ title: "Avoid Unsafe Use of sprintf",
1122
+ enabled: false,
1123
+ parameters: []
1124
+ },
1125
+ {
1126
+ id: "flawfinder_srand",
1127
+ category: "Security",
1128
+ severityLevel: "High",
1129
+ title: "Avoid Using srand for Security-Sensitive Randomness",
1130
+ enabled: false,
1131
+ parameters: []
1132
+ },
1133
+ {
1134
+ id: "flawfinder_srandom",
1135
+ category: "Security",
1136
+ severityLevel: "High",
1137
+ title: "Avoid Using srandom for Security-Sensitive Randomness",
1138
+ enabled: false,
1139
+ parameters: []
1140
+ },
1141
+ {
1142
+ id: "flawfinder_sscanf",
1143
+ category: "Security",
1144
+ severityLevel: "Error",
1145
+ title: "Avoid unsafe usage of sscanf with %s specifier",
1146
+ enabled: false,
1147
+ parameters: []
1148
+ },
1149
+ {
1150
+ id: "flawfinder_ssignal",
1151
+ category: "Security",
1152
+ severityLevel: "High",
1153
+ title: "Avoid usage of ssignal function",
1154
+ enabled: false,
1155
+ parameters: []
1156
+ },
1157
+ {
1158
+ id: "flawfinder__stprintf",
1159
+ category: "Security",
1160
+ severityLevel: "High",
1161
+ title: "Avoid unsafe use of _stprintf",
1162
+ enabled: false,
1163
+ parameters: []
1164
+ },
1165
+ {
1166
+ id: "flawfinder_strcadd",
1167
+ category: "Security",
1168
+ severityLevel: "Error",
1169
+ title: "Avoid unsafe use of strcadd",
1170
+ enabled: true,
1171
+ parameters: []
1172
+ },
1173
+ {
1174
+ id: "flawfinder_strcat",
1175
+ category: "Security",
1176
+ severityLevel: "Error",
1177
+ title: "Avoid unsafe use of strcat",
1178
+ enabled: false,
1179
+ parameters: []
1180
+ },
1181
+ {
1182
+ id: "flawfinder_StrCat",
1183
+ category: "Security",
1184
+ severityLevel: "Error",
1185
+ title: "Avoid Unsafe Use of strcat",
1186
+ enabled: false,
1187
+ parameters: []
1188
+ },
1189
+ {
1190
+ id: "flawfinder_StrCatA",
1191
+ category: "Security",
1192
+ severityLevel: "High",
1193
+ title: "Avoid unsafe use of StrCatA",
1194
+ enabled: false,
1195
+ parameters: []
1196
+ },
1197
+ {
1198
+ id: "flawfinder_strCatBuff",
1199
+ category: "Security",
1200
+ severityLevel: "Error",
1201
+ title: "Avoid Unsafe Use of strCatBuff",
1202
+ enabled: false,
1203
+ parameters: []
1204
+ },
1205
+ {
1206
+ id: "flawfinder_StrCatBuffA",
1207
+ category: "Security",
1208
+ severityLevel: "Error",
1209
+ title: "Avoid unsafe use of StrCatBuffA",
1210
+ enabled: false,
1211
+ parameters: []
1212
+ },
1213
+ {
1214
+ id: "flawfinder_StrCatBuffW",
1215
+ category: "Security",
1216
+ severityLevel: "High",
1217
+ title: "Avoid unsafe usage of StrCatBuffW",
1218
+ enabled: false,
1219
+ parameters: []
1220
+ },
1221
+ {
1222
+ id: "flawfinder_StrCatChainW",
1223
+ category: "Security",
1224
+ severityLevel: "High",
1225
+ title: "Avoid Unsafe Use of StrCatChainW",
1226
+ enabled: false,
1227
+ parameters: []
1228
+ },
1229
+ {
1230
+ id: "flawfinder_StrCatN",
1231
+ category: "Security",
1232
+ severityLevel: "Error",
1233
+ title: "Avoid unsafe use of StrCatN",
1234
+ enabled: false,
1235
+ parameters: []
1236
+ },
1237
+ {
1238
+ id: "flawfinder_StrCatNA",
1239
+ category: "Security",
1240
+ severityLevel: "Error",
1241
+ title: "Avoid unsafe use of StrCatNA",
1242
+ enabled: false,
1243
+ parameters: []
1244
+ },
1245
+ {
1246
+ id: "flawfinder_StrCatNW",
1247
+ category: "Security",
1248
+ severityLevel: "High",
1249
+ title: "Avoid unsafe use of StrCatNW",
1250
+ enabled: false,
1251
+ parameters: []
1252
+ },
1253
+ {
1254
+ id: "flawfinder_StrcatW",
1255
+ category: "Security",
1256
+ severityLevel: "Error",
1257
+ title: "Avoid unsafe use of StrcatW",
1258
+ enabled: false,
1259
+ parameters: []
1260
+ },
1261
+ {
1262
+ id: "flawfinder_strccpy",
1263
+ category: "Security",
1264
+ severityLevel: "High",
1265
+ title: "Avoid unsafe use of strccpy",
1266
+ enabled: true,
1267
+ parameters: []
1268
+ },
1269
+ {
1270
+ id: "flawfinder_strcpy",
1271
+ category: "Security",
1272
+ severityLevel: "Error",
1273
+ title: "Avoid unsafe use of strcpy",
1274
+ enabled: false,
1275
+ parameters: []
1276
+ },
1277
+ {
1278
+ id: "flawfinder_StrCpy",
1279
+ category: "Security",
1280
+ severityLevel: "Error",
1281
+ title: "Avoid Using strcpy to Prevent Buffer Overflows",
1282
+ enabled: false,
1283
+ parameters: []
1284
+ },
1285
+ {
1286
+ id: "flawfinder_strcpyA",
1287
+ category: "Security",
1288
+ severityLevel: "Error",
1289
+ title: "Avoid unsafe strcpyA calls",
1290
+ enabled: false,
1291
+ parameters: []
1292
+ },
1293
+ {
1294
+ id: "flawfinder_StrCpyA",
1295
+ category: "Security",
1296
+ severityLevel: "Error",
1297
+ title: "Avoid unsafe use of StrCpyA calls",
1298
+ enabled: false,
1299
+ parameters: []
1300
+ },
1301
+ {
1302
+ id: "flawfinder_StrCpyN",
1303
+ category: "Security",
1304
+ severityLevel: "High",
1305
+ title: "Avoid unsafe StrCpyN calls",
1306
+ enabled: false,
1307
+ parameters: []
1308
+ },
1309
+ {
1310
+ id: "flawfinder_strcpynA",
1311
+ category: "Security",
1312
+ severityLevel: "Error",
1313
+ title: "Avoid unsafe usage of strcpynA",
1314
+ enabled: false,
1315
+ parameters: []
1316
+ },
1317
+ {
1318
+ id: "flawfinder_StrCpyNA",
1319
+ category: "Security",
1320
+ severityLevel: "High",
1321
+ title: "Avoid Unsafe Use of StrCpyNA",
1322
+ enabled: false,
1323
+ parameters: []
1324
+ },
1325
+ {
1326
+ id: "flawfinder_StrCpyNW",
1327
+ category: "Security",
1328
+ severityLevel: "High",
1329
+ title: "Avoid Unsafe Use of StrCpyNW",
1330
+ enabled: false,
1331
+ parameters: []
1332
+ },
1333
+ {
1334
+ id: "flawfinder_strcpyW",
1335
+ category: "Security",
1336
+ severityLevel: "Error",
1337
+ title: "Avoid unsafe strcpyW usage",
1338
+ enabled: false,
1339
+ parameters: []
1340
+ },
1341
+ {
1342
+ id: "flawfinder_streadd",
1343
+ category: "Security",
1344
+ severityLevel: "High",
1345
+ title: "Avoid Using streadd Function",
1346
+ enabled: false,
1347
+ parameters: []
1348
+ },
1349
+ {
1350
+ id: "flawfinder_strecpy",
1351
+ category: "Security",
1352
+ severityLevel: "High",
1353
+ title: "Avoid Using strecpy Function",
1354
+ enabled: false,
1355
+ parameters: []
1356
+ },
1357
+ {
1358
+ id: "flawfinder_strfry",
1359
+ category: "Security",
1360
+ severityLevel: "High",
1361
+ title: "Avoid using strfry for security-related randomness",
1362
+ enabled: false,
1363
+ parameters: []
1364
+ },
1365
+ {
1366
+ id: "flawfinder_strlen",
1367
+ category: "Security",
1368
+ severityLevel: "Error",
1369
+ title: "Avoid unsafe usage of strlen on non-null-terminated strings",
1370
+ enabled: true,
1371
+ parameters: []
1372
+ },
1373
+ {
1374
+ id: "flawfinder_strncat",
1375
+ category: "Security",
1376
+ severityLevel: "High",
1377
+ title: "Avoid Incorrect Use of strncat",
1378
+ enabled: true,
1379
+ parameters: []
1380
+ },
1381
+ {
1382
+ id: "flawfinder_StrNCat",
1383
+ category: "Security",
1384
+ severityLevel: "Error",
1385
+ title: "Avoid unsafe strncat usage",
1386
+ enabled: false,
1387
+ parameters: []
1388
+ },
1389
+ {
1390
+ id: "flawfinder_StrNCatA",
1391
+ category: "Security",
1392
+ severityLevel: "Error",
1393
+ title: "Avoid Unsafe Use of StrNCatA",
1394
+ enabled: false,
1395
+ parameters: []
1396
+ },
1397
+ {
1398
+ id: "flawfinder_StrNCatW",
1399
+ category: "Security",
1400
+ severityLevel: "High",
1401
+ title: "Avoid unsafe StrNCatW calls",
1402
+ enabled: false,
1403
+ parameters: []
1404
+ },
1405
+ {
1406
+ id: "flawfinder_strncpy",
1407
+ category: "Security",
1408
+ severityLevel: "Error",
1409
+ title: "Avoid Incorrect Use of strncpy",
1410
+ enabled: true,
1411
+ parameters: []
1412
+ },
1413
+ {
1414
+ id: "flawfinder_StrNCpy",
1415
+ category: "Security",
1416
+ severityLevel: "Error",
1417
+ title: "Avoid unsafe usage of strncpy",
1418
+ enabled: false,
1419
+ parameters: []
1420
+ },
1421
+ {
1422
+ id: "flawfinder_StrNCpyA",
1423
+ category: "Security",
1424
+ severityLevel: "High",
1425
+ title: "Avoid unsafe use of StrNCpyA calls",
1426
+ enabled: false,
1427
+ parameters: []
1428
+ },
1429
+ {
1430
+ id: "flawfinder_StrNCpyW",
1431
+ category: "Security",
1432
+ severityLevel: "Error",
1433
+ title: "Avoid Unsafe Use of StrNCpyW",
1434
+ enabled: false,
1435
+ parameters: []
1436
+ },
1437
+ {
1438
+ id: "flawfinder_strtrns",
1439
+ category: "Security",
1440
+ severityLevel: "High",
1441
+ title: "Avoid Unsafe strtrns Calls",
1442
+ enabled: false,
1443
+ parameters: []
1444
+ },
1445
+ {
1446
+ id: "flawfinder_swprintf",
1447
+ category: "Security",
1448
+ severityLevel: "High",
1449
+ title: "Detect Potential Buffer Overflow in swprintf Calls",
1450
+ enabled: false,
1451
+ parameters: []
1452
+ },
1453
+ {
1454
+ id: "flawfinder_syslog",
1455
+ category: "Security",
1456
+ severityLevel: "Error",
1457
+ title: "Avoid Untrusted Input in syslog Format Strings",
1458
+ enabled: false,
1459
+ parameters: []
1460
+ },
1461
+ {
1462
+ id: "flawfinder_system",
1463
+ category: "Security",
1464
+ severityLevel: "High",
1465
+ title: "Avoid Using system() Calls",
1466
+ enabled: false,
1467
+ parameters: []
1468
+ },
1469
+ {
1470
+ id: "flawfinder__tccat",
1471
+ category: "Security",
1472
+ severityLevel: "High",
1473
+ title: "Avoid unsafe use of _tccat calls",
1474
+ enabled: false,
1475
+ parameters: []
1476
+ },
1477
+ {
1478
+ id: "flawfinder__tccpy",
1479
+ category: "Security",
1480
+ severityLevel: "High",
1481
+ title: "Avoid using _tccpy to prevent buffer overflows",
1482
+ enabled: false,
1483
+ parameters: []
1484
+ },
1485
+ {
1486
+ id: "flawfinder_TCHAR",
1487
+ category: "Security",
1488
+ severityLevel: "High",
1489
+ title: "Avoid Potential Security Problems in TCHAR Calls",
1490
+ enabled: false,
1491
+ parameters: []
1492
+ },
1493
+ {
1494
+ id: "flawfinder__tcscat",
1495
+ category: "Security",
1496
+ severityLevel: "Error",
1497
+ title: "Avoid unsafe use of _tcscat",
1498
+ enabled: false,
1499
+ parameters: []
1500
+ },
1501
+ {
1502
+ id: "flawfinder__tcscpy",
1503
+ category: "Security",
1504
+ severityLevel: "High",
1505
+ title: "Avoid Unsafe _tcscpy Usage",
1506
+ enabled: false,
1507
+ parameters: []
1508
+ },
1509
+ {
1510
+ id: "flawfinder__tcslen",
1511
+ category: "Security",
1512
+ severityLevel: "High",
1513
+ title: "Avoid Unsafe Use of _tcslen",
1514
+ enabled: true,
1515
+ parameters: []
1516
+ },
1517
+ {
1518
+ id: "flawfinder__tcsncat",
1519
+ category: "Security",
1520
+ severityLevel: "High",
1521
+ title: "Avoid Incorrect Usage of _tcsncat",
1522
+ enabled: true,
1523
+ parameters: []
1524
+ },
1525
+ {
1526
+ id: "flawfinder__tcsncpy",
1527
+ category: "Security",
1528
+ severityLevel: "High",
1529
+ title: "Avoid Incorrect Use of _tcsncpy",
1530
+ enabled: true,
1531
+ parameters: []
1532
+ },
1533
+ {
1534
+ id: "flawfinder_tempnam",
1535
+ category: "Security",
1536
+ severityLevel: "High",
1537
+ title: "Avoid Using tempnam for Temporary File Creation",
1538
+ enabled: false,
1539
+ parameters: []
1540
+ },
1541
+ {
1542
+ id: "flawfinder_tmpfile",
1543
+ category: "Security",
1544
+ severityLevel: "High",
1545
+ title: "Avoid Using tmpfile() Function",
1546
+ enabled: false,
1547
+ parameters: []
1548
+ },
1549
+ {
1550
+ id: "flawfinder_tmpnam",
1551
+ category: "Security",
1552
+ severityLevel: "Error",
1553
+ title: "Avoid Using tmpnam Function",
1554
+ enabled: false,
1555
+ parameters: []
1556
+ },
1557
+ {
1558
+ id: "flawfinder__tscanf",
1559
+ category: "Security",
1560
+ severityLevel: "Error",
1561
+ title: "Avoid unsafe usage of _tscanf with %s specifier",
1562
+ enabled: false,
1563
+ parameters: []
1564
+ },
1565
+ {
1566
+ id: "flawfinder_ulimit",
1567
+ category: "Security",
1568
+ severityLevel: "High",
1569
+ title: "Avoid Using Obsolete ulimit C Routine",
1570
+ enabled: true,
1571
+ parameters: []
1572
+ },
1573
+ {
1574
+ id: "flawfinder_umask",
1575
+ category: "Security",
1576
+ severityLevel: "High",
1577
+ title: "Enforce Restrictive umask Settings",
1578
+ enabled: true,
1579
+ parameters: []
1580
+ },
1581
+ {
1582
+ id: "flawfinder_usleep",
1583
+ category: "Security",
1584
+ severityLevel: "High",
1585
+ title: "Avoid using usleep function",
1586
+ enabled: true,
1587
+ parameters: []
1588
+ },
1589
+ {
1590
+ id: "flawfinder_vfork",
1591
+ category: "Security",
1592
+ severityLevel: "High",
1593
+ title: "Avoid Unsafe Use of vfork",
1594
+ enabled: false,
1595
+ parameters: []
1596
+ },
1597
+ {
1598
+ id: "flawfinder_vfprintf",
1599
+ category: "Security",
1600
+ severityLevel: "Error",
1601
+ title: "Avoid Unsafe vfprintf Usage",
1602
+ enabled: false,
1603
+ parameters: []
1604
+ },
1605
+ {
1606
+ id: "flawfinder_vfscanf",
1607
+ category: "Security",
1608
+ severityLevel: "High",
1609
+ title: "Avoid unsafe vfscanf %s usage without length limit",
1610
+ enabled: false,
1611
+ parameters: []
1612
+ },
1613
+ {
1614
+ id: "flawfinder__vftprintf",
1615
+ category: "Security",
1616
+ severityLevel: "Error",
1617
+ title: "Avoid unsafe _vftprintf calls",
1618
+ enabled: false,
1619
+ parameters: []
1620
+ },
1621
+ {
1622
+ id: "flawfinder_vfwprintf",
1623
+ category: "Security",
1624
+ severityLevel: "Error",
1625
+ title: "Avoid unsafe vfwprintf usage",
1626
+ enabled: false,
1627
+ parameters: []
1628
+ },
1629
+ {
1630
+ id: "flawfinder_vfwscanf",
1631
+ category: "Security",
1632
+ severityLevel: "Error",
1633
+ title: "Avoid unsafe usage of vfwscanf with %s specifier",
1634
+ enabled: false,
1635
+ parameters: []
1636
+ },
1637
+ {
1638
+ id: "flawfinder_vprintf",
1639
+ category: "Security",
1640
+ severityLevel: "Error",
1641
+ title: "Avoid insecure use of vprintf format strings",
1642
+ enabled: false,
1643
+ parameters: []
1644
+ },
1645
+ {
1646
+ id: "flawfinder_vscanf",
1647
+ category: "Security",
1648
+ severityLevel: "Error",
1649
+ title: "Avoid Unsafe vscanf Usage",
1650
+ enabled: false,
1651
+ parameters: []
1652
+ },
1653
+ {
1654
+ id: "flawfinder_vsnprintf",
1655
+ category: "Security",
1656
+ severityLevel: "High",
1657
+ title: "Avoid insecure usage of vsnprintf",
1658
+ enabled: false,
1659
+ parameters: []
1660
+ },
1661
+ {
1662
+ id: "flawfinder__vsntprintf",
1663
+ category: "Security",
1664
+ severityLevel: "High",
1665
+ title: "Detect Potential Security Issues in _vsntprintf Calls",
1666
+ enabled: false,
1667
+ parameters: []
1668
+ },
1669
+ {
1670
+ id: "flawfinder_vsprintf",
1671
+ category: "Security",
1672
+ severityLevel: "Error",
1673
+ title: "Avoid using vsprintf",
1674
+ enabled: false,
1675
+ parameters: []
1676
+ },
1677
+ {
1678
+ id: "flawfinder_vsscanf",
1679
+ category: "Security",
1680
+ severityLevel: "High",
1681
+ title: "Avoid Unsafe vsscanf Usage",
1682
+ enabled: false,
1683
+ parameters: []
1684
+ },
1685
+ {
1686
+ id: "flawfinder__vstprintf",
1687
+ category: "Security",
1688
+ severityLevel: "Error",
1689
+ title: "Avoid Unsafe _vstprintf Calls",
1690
+ enabled: false,
1691
+ parameters: []
1692
+ },
1693
+ {
1694
+ id: "flawfinder_vswprintf",
1695
+ category: "Security",
1696
+ severityLevel: "High",
1697
+ title: "Avoid Unsafe vswprintf Usage",
1698
+ enabled: false,
1699
+ parameters: []
1700
+ },
1701
+ {
1702
+ id: "flawfinder_vswscanf",
1703
+ category: "Security",
1704
+ severityLevel: "High",
1705
+ title: "Avoid unsafe use of vswscanf with %s specifier",
1706
+ enabled: false,
1707
+ parameters: []
1708
+ },
1709
+ {
1710
+ id: "flawfinder__vtprintf",
1711
+ category: "Security",
1712
+ severityLevel: "Error",
1713
+ title: "Avoid Unsafe Use of _vtprintf Calls",
1714
+ enabled: false,
1715
+ parameters: []
1716
+ },
1717
+ {
1718
+ id: "flawfinder_vwprintf",
1719
+ category: "Security",
1720
+ severityLevel: "High",
1721
+ title: "Avoid Unsafe vwprintf Calls",
1722
+ enabled: false,
1723
+ parameters: []
1724
+ },
1725
+ {
1726
+ id: "flawfinder_vwscanf",
1727
+ category: "Security",
1728
+ severityLevel: "Error",
1729
+ title: "Avoid unsafe vwscanf calls without length limit",
1730
+ enabled: false,
1731
+ parameters: []
1732
+ },
1733
+ {
1734
+ id: "flawfinder_wchar_t",
1735
+ category: "Security",
1736
+ severityLevel: "High",
1737
+ title: "Avoid Unsafe Usage of wchar_t Arrays",
1738
+ enabled: false,
1739
+ parameters: []
1740
+ },
1741
+ {
1742
+ id: "flawfinder_wcscat",
1743
+ category: "Security",
1744
+ severityLevel: "Error",
1745
+ title: "Avoid Unsafe Use of wcscat",
1746
+ enabled: false,
1747
+ parameters: []
1748
+ },
1749
+ {
1750
+ id: "flawfinder_wcscpy",
1751
+ category: "Security",
1752
+ severityLevel: "Error",
1753
+ title: "Avoid unsafe use of wcscpy",
1754
+ enabled: false,
1755
+ parameters: []
1756
+ },
1757
+ {
1758
+ id: "flawfinder_wcslen",
1759
+ category: "Security",
1760
+ severityLevel: "High",
1761
+ title: "Avoid unsafe wcslen calls",
1762
+ enabled: true,
1763
+ parameters: []
1764
+ },
1765
+ {
1766
+ id: "flawfinder_wcsncat",
1767
+ category: "Security",
1768
+ severityLevel: "Error",
1769
+ title: "Avoid Incorrect Use of wcsncat",
1770
+ enabled: true,
1771
+ parameters: []
1772
+ },
1773
+ {
1774
+ id: "flawfinder_wcsncpy",
1775
+ category: "Security",
1776
+ severityLevel: "High",
1777
+ title: "Avoid Incorrect Usage of wcsncpy",
1778
+ enabled: true,
1779
+ parameters: []
1780
+ },
1781
+ {
1782
+ id: "flawfinder_WinExec",
1783
+ category: "Security",
1784
+ severityLevel: "High",
1785
+ title: "Avoid Unsafe Use of WinExec",
1786
+ enabled: false,
1787
+ parameters: []
1788
+ },
1789
+ {
1790
+ id: "flawfinder_wprintf",
1791
+ category: "Security",
1792
+ severityLevel: "Error",
1793
+ title: "Avoid unsafe wprintf usage",
1794
+ enabled: false,
1795
+ parameters: []
1796
+ },
1797
+ {
1798
+ id: "flawfinder_wscanf",
1799
+ category: "Security",
1800
+ severityLevel: "High",
1801
+ title: "Avoid unsafe usage of wscanf with %s specifier",
1802
+ enabled: false,
1803
+ parameters: []
1804
+ },
1805
+ {
1806
+ id: "flawfinder__wtoi",
1807
+ category: "Security",
1808
+ severityLevel: "High",
1809
+ title: "Avoid unchecked use of _wtoi",
1810
+ enabled: false,
1811
+ parameters: []
1812
+ },
1813
+ {
1814
+ id: "flawfinder__wtoi64",
1815
+ category: "Security",
1816
+ severityLevel: "High",
1817
+ title: "Avoid unchecked use of _wtoi64",
1818
+ enabled: false,
1819
+ parameters: []
1820
+ }
1821
+ ];
1822
+
1823
+ // src/adapter.ts
1824
+ var TOOL_ID = "flawfinder";
1825
+ var PIP_PACKAGE = "flawfinder==2.0.19";
1826
+ var BINARY = "flawfinder";
1827
+ var PATTERN_META = new Map(
1828
+ patterns_default.map((p) => [
1829
+ p.id,
1830
+ {
1831
+ category: p.category,
1832
+ severity: p.severityLevel ?? "Info"
1833
+ }
1834
+ ])
1835
+ );
1836
+ function ruleMetadata(ruleId) {
1837
+ const patternId = (0, import_tooling.buildPatternId)(TOOL_ID, ruleId);
1838
+ return PATTERN_META.get(patternId) ?? { category: "Security", severity: "Info" };
1839
+ }
1840
+ function extractFunctionName(ruleName) {
1841
+ const slashIdx = ruleName.lastIndexOf("/");
1842
+ return slashIdx >= 0 ? ruleName.slice(slashIdx + 1) : ruleName;
1843
+ }
1844
+ function getLineContent(lines, lineNumber) {
1845
+ return lines[lineNumber - 1] ?? "";
1846
+ }
1847
+ async function readFileLines(filePath) {
1848
+ try {
1849
+ const content = await import_promises.default.readFile(filePath, "utf-8");
1850
+ return content.split("\n");
1851
+ } catch {
1852
+ return [];
1853
+ }
1854
+ }
1855
+ function buildResult(startedAt, completedAt, issues, errors, filesAnalyzed) {
1856
+ const durationMs = completedAt.getTime() - startedAt.getTime();
1857
+ return {
1858
+ metadata: {
1859
+ startedAt: startedAt.toISOString(),
1860
+ completedAt: completedAt.toISOString(),
1861
+ durationMs
1862
+ },
1863
+ issues,
1864
+ errors,
1865
+ summary: {
1866
+ toolId: TOOL_ID,
1867
+ status: errors.some((e) => e.level === "error") ? "partial" : "success",
1868
+ issueCount: issues.length,
1869
+ errorCount: errors.length,
1870
+ durationMs,
1871
+ filesAnalyzed
1872
+ }
1873
+ };
1874
+ }
1875
+ async function getVersionFromBinary(binaryPath) {
1876
+ try {
1877
+ const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(binaryPath, ["--version"], {
1878
+ cwd: process.cwd()
1879
+ });
1880
+ if (exitCode !== 0) return null;
1881
+ const output = (stdout || stderr || "").trim();
1882
+ const match = output.match(/(\d+\.\d+\.\d+)/);
1883
+ return match ? match[1] : null;
1884
+ } catch {
1885
+ return null;
1886
+ }
1887
+ }
1888
+ async function resolveBinaryPath(ctx) {
1889
+ const venvDir = (0, import_tooling.getVenvDir)(ctx.globalDir, adapter.id);
1890
+ const venvBin = import_path.default.join(venvDir, "bin", BINARY);
1891
+ const venvVersion = await getVersionFromBinary(venvBin);
1892
+ if (venvVersion) return venvBin;
1893
+ return BINARY;
1894
+ }
1895
+ var adapter = {
1896
+ id: TOOL_ID,
1897
+ displayName: "Flawfinder",
1898
+ preferredVersion: "2.0.19",
1899
+ compatibleVersions: ">=2.0.0",
1900
+ website: "https://dwheeler.com/flawfinder/",
1901
+ languages: ["C", "CPP"],
1902
+ filePatterns: ["**/*.c", "**/*.h", "**/*.cpp", "**/*.cc", "**/*.cxx", "**/*.hpp"],
1903
+ supportedOS: ["linux", "darwin"],
1904
+ supportedArch: ["x64", "arm64"],
1905
+ supportedRunners: ["local", "container"],
1906
+ prerequisites: [
1907
+ {
1908
+ name: "Python",
1909
+ versionRange: ">=3.8.0",
1910
+ preferredVersion: "3.12.0",
1911
+ checkCommand: "python3 --version"
1912
+ }
1913
+ ],
1914
+ /**
1915
+ * Checks whether the `flawfinder` binary is present and runnable.
1916
+ *
1917
+ * Checks in order:
1918
+ * 1. Codacy-managed venv at `~/.codacy/runtimes/flawfinder/venv/bin/flawfinder`
1919
+ * 2. Global PATH (`flawfinder`)
1920
+ *
1921
+ * Parses the version from `Flawfinder version X.Y.Z`. Returns `available: false`
1922
+ * (rather than throwing) if the binary is not found or returns a non-zero exit code.
1923
+ */
1924
+ async checkAvailability(ctx) {
1925
+ ctx.logger.debug("Checking availability", { toolId: TOOL_ID });
1926
+ const pythonInfo = await (0, import_tooling.findPython)(void 0, ctx.logger).catch(() => null);
1927
+ const dependencies = pythonInfo ? [{ name: "Python", available: true, version: pythonInfo.version, installation: "global" }] : [{ name: "Python", available: false, reason: "Python 3 not found" }];
1928
+ const venvDir = (0, import_tooling.getVenvDir)(ctx.globalDir, adapter.id);
1929
+ const venvBinPath = import_path.default.join(venvDir, "bin", BINARY);
1930
+ const venvVersion = await getVersionFromBinary(venvBinPath);
1931
+ if (venvVersion) {
1932
+ ctx.logger.debug("Found flawfinder in codacy venv", { toolId: TOOL_ID, version: venvVersion });
1933
+ return {
1934
+ available: true,
1935
+ version: venvVersion,
1936
+ path: venvBinPath,
1937
+ installation: "codacy",
1938
+ dependencies
1939
+ };
1940
+ }
1941
+ const globalVersion = await getVersionFromBinary(BINARY);
1942
+ if (globalVersion) {
1943
+ ctx.logger.debug("Found flawfinder on global PATH", { toolId: TOOL_ID, version: globalVersion });
1944
+ return {
1945
+ available: true,
1946
+ version: globalVersion,
1947
+ installation: "global",
1948
+ dependencies
1949
+ };
1950
+ }
1951
+ ctx.logger.debug("flawfinder not found", { toolId: TOOL_ID });
1952
+ return {
1953
+ available: false,
1954
+ reason: "flawfinder not found in PATH or Codacy venv",
1955
+ installHint: "pip install flawfinder # or\ncodacy-analysis analyze . --install-dependencies # auto-install",
1956
+ dependencies
1957
+ };
1958
+ },
1959
+ /**
1960
+ * Installs flawfinder into an isolated Python virtual environment.
1961
+ *
1962
+ * Steps:
1963
+ * 1. Find a Python 3 interpreter on the system.
1964
+ * 2. Create (or reuse) a venv at `~/.codacy/runtimes/flawfinder/venv/`.
1965
+ * 3. Run `pip install flawfinder==2.0.19` inside the venv.
1966
+ * 4. Verify the installed binary runs and return its path and version.
1967
+ */
1968
+ async install(ctx) {
1969
+ ctx.logger.info("Starting install", { toolId: TOOL_ID });
1970
+ const python = await (0, import_tooling.ensurePython)(ctx.globalDir, void 0, ctx.logger);
1971
+ if (!python) {
1972
+ return {
1973
+ success: false,
1974
+ error: {
1975
+ toolId: TOOL_ID,
1976
+ phase: "requirementCheck",
1977
+ kind: "MissingPrerequisite",
1978
+ message: "Python 3 could not be found or downloaded. Install Python 3.8+ or enable auto-install.",
1979
+ level: "error"
1980
+ }
1981
+ };
1982
+ }
1983
+ try {
1984
+ const venvDir = (0, import_tooling.getVenvDir)(ctx.globalDir, adapter.id);
1985
+ ctx.logger.info(`Ensuring venv at ${venvDir} (python: ${python.path})`);
1986
+ const venv = await (0, import_tooling.ensureVenv)(python.path, venvDir, ctx.logger);
1987
+ ctx.logger.info(`Installing ${PIP_PACKAGE} into venv...`);
1988
+ await (0, import_tooling.pipInstall)(venv, [PIP_PACKAGE], ctx.logger);
1989
+ const installedVersion = await (0, import_tooling.checkVenvTool)(
1990
+ venv,
1991
+ BINARY,
1992
+ "--version",
1993
+ /(\d+\.\d+\.\d+)/,
1994
+ ctx.logger
1995
+ );
1996
+ if (!installedVersion) {
1997
+ return {
1998
+ success: false,
1999
+ error: {
2000
+ toolId: TOOL_ID,
2001
+ phase: "toolInstall",
2002
+ kind: "VerificationFailed",
2003
+ message: "flawfinder was installed but the version could not be verified",
2004
+ level: "error"
2005
+ }
2006
+ };
2007
+ }
2008
+ const installedPath = (0, import_tooling.resolveVenvBinary)(venv, BINARY);
2009
+ ctx.logger.info(`Installed flawfinder v${installedVersion} at ${installedPath}`);
2010
+ return { success: true, installedPath, installedVersion };
2011
+ } catch (err) {
2012
+ return {
2013
+ success: false,
2014
+ error: {
2015
+ toolId: TOOL_ID,
2016
+ phase: "toolInstall",
2017
+ kind: "InstallError",
2018
+ message: `Failed to install flawfinder: ${err instanceof Error ? err.message : String(err)}`,
2019
+ level: "error"
2020
+ }
2021
+ };
2022
+ }
2023
+ },
2024
+ /**
2025
+ * Flawfinder has no configuration file — all options are passed via CLI flags.
2026
+ * Always returns `{ found: false }`.
2027
+ */
2028
+ async checkLocalConfigurationFile(_ctx) {
2029
+ _ctx.logger.debug("Checking for local config", { toolId: TOOL_ID });
2030
+ return { found: false };
2031
+ },
2032
+ /**
2033
+ * Runs `flawfinder --sarif --falsepositive <files...>` against the target files
2034
+ * and converts the SARIF JSON output into Codacy Issue objects.
2035
+ *
2036
+ * Key details:
2037
+ * - `--sarif` produces SARIF v2.1.0 JSON on stdout.
2038
+ * - `--falsepositive` / `-F` excludes likely false positives (matches legacy wrapper).
2039
+ * - Exit code is always 0 on successful analysis.
2040
+ * - Exit code 15 = encoding error, 16 = CLI option error.
2041
+ * - Pattern filtering is done post-hoc since flawfinder has no rule selection flag.
2042
+ *
2043
+ * SARIF parsing extracts `runs[0].results[]` — each result has a `ruleId`
2044
+ * (the function name), location, and message.
2045
+ *
2046
+ * Never throws — all errors are captured in the returned `errors` array.
2047
+ */
2048
+ async analyze(ctx, codacyConfig) {
2049
+ const startMs = Date.now();
2050
+ ctx.logger.info("Starting analysis", { toolId: TOOL_ID, fileCount: ctx.targetFiles.length });
2051
+ const startedAt = /* @__PURE__ */ new Date();
2052
+ const issues = [];
2053
+ const errors = [];
2054
+ if (ctx.targetFiles.length === 0) {
2055
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, 0);
2056
+ }
2057
+ const binary = await resolveBinaryPath(ctx);
2058
+ const absoluteFiles = ctx.targetFiles.map((f) => import_path.default.resolve(ctx.repositoryRoot, f));
2059
+ const args = ["--sarif", "--falsepositive", ...absoluteFiles];
2060
+ try {
2061
+ const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(binary, args, {
2062
+ cwd: ctx.repositoryRoot,
2063
+ logger: ctx.logger
2064
+ });
2065
+ if (exitCode !== 0) {
2066
+ errors.push({
2067
+ toolId: TOOL_ID,
2068
+ phase: "toolInvoke",
2069
+ kind: "NonZeroExit",
2070
+ message: `flawfinder exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
2071
+ level: "error"
2072
+ });
2073
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2074
+ }
2075
+ if (!stdout.trim()) {
2076
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2077
+ }
2078
+ let sarif;
2079
+ try {
2080
+ sarif = JSON.parse(stdout);
2081
+ } catch (err) {
2082
+ errors.push({
2083
+ toolId: TOOL_ID,
2084
+ phase: "outputParse",
2085
+ kind: "MalformedOutput",
2086
+ message: `Failed to parse flawfinder SARIF output: ${err instanceof Error ? err.message : String(err)}`,
2087
+ level: "error"
2088
+ });
2089
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2090
+ }
2091
+ const run = sarif.runs?.[0];
2092
+ const results = run?.results ?? [];
2093
+ const ruleIdToFunctionName = /* @__PURE__ */ new Map();
2094
+ for (const rule of run?.tool?.driver?.rules ?? []) {
2095
+ if (rule.id && rule.name) {
2096
+ ruleIdToFunctionName.set(rule.id, extractFunctionName(rule.name));
2097
+ }
2098
+ }
2099
+ const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
2100
+ const resultsByFile = /* @__PURE__ */ new Map();
2101
+ for (const result2 of results) {
2102
+ const loc = result2.locations?.[0]?.physicalLocation;
2103
+ if (!loc) continue;
2104
+ const uri = loc.artifactLocation?.uri;
2105
+ if (!uri) continue;
2106
+ const functionName = ruleIdToFunctionName.get(result2.ruleId) ?? result2.ruleId;
2107
+ const line = loc.region?.startLine ?? 1;
2108
+ const column = loc.region?.startColumn ?? 1;
2109
+ const absoluteFilePath = import_path.default.isAbsolute(uri) ? uri : import_path.default.resolve(ctx.repositoryRoot, uri);
2110
+ const list = resultsByFile.get(absoluteFilePath) ?? [];
2111
+ list.push({ result: result2, functionName, filePath: absoluteFilePath, line, column });
2112
+ resultsByFile.set(absoluteFilePath, list);
2113
+ }
2114
+ for (const [absoluteFilePath, fileResults] of resultsByFile) {
2115
+ const lines = await readFileLines(absoluteFilePath);
2116
+ const relPath = import_path.default.relative(ctx.repositoryRoot, absoluteFilePath);
2117
+ for (const { result: result2, functionName, line, column } of fileResults) {
2118
+ const patternId = (0, import_tooling.buildPatternId)(TOOL_ID, functionName);
2119
+ if (enabledPatterns.size > 0 && !enabledPatterns.has(patternId)) {
2120
+ continue;
2121
+ }
2122
+ const meta = ruleMetadata(functionName);
2123
+ issues.push({
2124
+ filePath: relPath,
2125
+ patternId,
2126
+ toolId: TOOL_ID,
2127
+ line,
2128
+ column,
2129
+ message: result2.message.text,
2130
+ lineContent: getLineContent(lines, line),
2131
+ category: meta.category,
2132
+ severity: meta.severity
2133
+ });
2134
+ }
2135
+ }
2136
+ if (stderr.trim()) {
2137
+ errors.push({
2138
+ toolId: TOOL_ID,
2139
+ phase: "outputParse",
2140
+ kind: "ParseWarning",
2141
+ message: `flawfinder stderr: ${stderr.trim()}`,
2142
+ level: "warning"
2143
+ });
2144
+ }
2145
+ } catch (err) {
2146
+ errors.push({
2147
+ toolId: TOOL_ID,
2148
+ phase: "toolInvoke",
2149
+ kind: "InvocationError",
2150
+ message: `Failed to run flawfinder: ${err instanceof Error ? err.message : String(err)}`,
2151
+ level: "error"
2152
+ });
2153
+ }
2154
+ const result = buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2155
+ ctx.logger.info("Analysis complete", {
2156
+ toolId: TOOL_ID,
2157
+ issueCount: result.summary.issueCount,
2158
+ errorCount: result.summary.errorCount,
2159
+ durationMs: Date.now() - startMs
2160
+ });
2161
+ return result;
2162
+ }
2163
+ };
2164
+
2165
+ // src/index.ts
2166
+ var index_default = (0, import_tooling2.defineToolAdapter)(adapter);