forked from snyk-labs/nodejs-goof
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathresults.sarif
4231 lines (4231 loc) · 170 KB
/
results.sarif
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "SnykCode",
"semanticVersion": "1.0.0",
"version": "1.0.0",
"rules": [
{
"id": "javascript/CommandInjection",
"name": "CommandInjection",
"shortDescription": {
"text": "Command Injection"
},
"defaultConfiguration": {
"level": "error"
},
"help": {
"markdown": "## Details\n\nWith an OS command injection attack a web application user can pass commands directly to the system shell, attached to a legitimate request. These commands can then be executed on the application server, potentially leading to harmful consequences, including data exposure or deletion. Like code injection attacks, command injection attacks are essentially a failure of data validation. Unlike code injection attacks, which introduce new code, command injection attacks use existing system functions, often taking advantage of the application's unnecessarily high privilege level, increasing the risk of serious harm and reputational damage.\n\n### Best practices for prevention\n- Never trust user input. Assume any input may transmit harmful values.\n- Adopt the principle of least privilege: No application should have a greater access level than needed to run its required tasks.\n- Control user access policies on a task-by-task basis.\n- Don't pass user input directly to the system; use libraries or APIs that lack system access.\n- Where shell commands must be passed, escape values using functions like shlex for Python, or escapeshellarg() for PHP.\n- Sanitize user input with regular expressions to define permitted characters along with maximum string length.\n- Convert special characters such as `& | ; $ > < \\ !` before passing to the server.\n- Whitelist permitted commands and validate user responses against these expectations.\n- Remember that code injection can take place on multiple fronts: GET and POST requests, but also cookies and HTTP headers.\n- Ensure up-to-date patching across all systems to remediate known vulnerabilities.\n- Educate all team members on safer data handling procedures to prevent attacks.",
"text": ""
},
"properties": {
"tags": [
"javascript",
"maintenance",
"synclet",
"spawn",
"command"
],
"categories": [
"Security"
],
"exampleCommitFixes": [
{
"commitURL": "https://github.com/chaitin/passionfruit/commit/40dd558be3ead073bcc97a0ee4ae864a29f832ba?diff=split#diff-0364f57fbff2fabbe941ed20c328ef1aL212",
"lines": [
{
"line": "})",
"lineNumber": 210,
"lineChange": "none"
},
{
"line": ".post('/spawn', async ctx => {",
"lineNumber": 211,
"lineChange": "none"
},
{
"line": " let pid = await state.device.spawn([ctx.request.body.bundle])",
"lineNumber": 212,
"lineChange": "removed"
},
{
"line": " let { device, bundle } = ctx.request.body",
"lineNumber": 122,
"lineChange": "added"
},
{
"line": " let dev = await FridaUtil.getDevice(ctx.params.device)",
"lineNumber": 124,
"lineChange": "added"
},
{
"line": " let pid = await dev.spawn([ctx.request.body.bundle])",
"lineNumber": 125,
"lineChange": "added"
},
{
"line": " // todo: attach",
"lineNumber": 213,
"lineChange": "none"
},
{
"line": " ctx.body = { status: 'ok'}",
"lineNumber": 214,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/raphael-group/magi/commit/c3a8ce20a9b6137beacd605bd3d0074fdfab8340?diff=split#diff-79ebb237c38dc62bd81e097e4fb92c61L12",
"lines": [
{
"line": "// Compute enrichment given a JSON object. Expected to be called from AJAX",
"lineNumber": 9,
"lineChange": "none"
},
{
"line": "// as it returns a JSON object.",
"lineNumber": 10,
"lineChange": "none"
},
{
"line": "exports.stats = function stats(req, res){",
"lineNumber": 11,
"lineChange": "none"
},
{
"line": " console.log('/enrichments/stats');",
"lineNumber": 12,
"lineChange": "none"
},
{
"line": " // Parse the given data",
"lineNumber": 14,
"lineChange": "none"
},
{
"line": " var pathToScript = 'stats/computeEnrichments.py'",
"lineNumber": 15,
"lineChange": "none"
},
{
"line": " var command = pathToScript + \" -r '\" + JSON.stringify(req.body) + \"'\";",
"lineNumber": 16,
"lineChange": "removed"
},
{
"line": " var command = pathToScript;// + \" -r '\" + JSON.stringify(req.body) + \"'\";",
"lineNumber": 16,
"lineChange": "added"
},
{
"line": " // Spawn the child process to compute the enrichments. The only output",
"lineNumber": 18,
"lineChange": "none"
},
{
"line": " // to stdout is a JSON dump of the response",
"lineNumber": 19,
"lineChange": "none"
},
{
"line": " require('child_process').exec(command, function(err, stdout, stderr){",
"lineNumber": 20,
"lineChange": "removed"
},
{
"line": " var child = require('child_process').execFile(command, function(err, stdout, stderr){",
"lineNumber": 20,
"lineChange": "added"
},
{
"line": " if (err){",
"lineNumber": 21,
"lineChange": "none"
},
{
"line": " error = 'return code: ' + err.code + ', signal: ' + err.signal;",
"lineNumber": 22,
"lineChange": "none"
},
{
"line": "\t\t}",
"lineNumber": 30,
"lineChange": "none"
},
{
"line": "\t});",
"lineNumber": 31,
"lineChange": "none"
},
{
"line": " child.stdin.write(JSON.stringify(req.body) + '\\n');",
"lineNumber": 32,
"lineChange": "added"
},
{
"line": " child.stdin.end();",
"lineNumber": 33,
"lineChange": "added"
},
{
"line": "}",
"lineNumber": 34,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/jupitex/sisyphe/commit/e20429a0dace6de8ce88a48aebb3548f0df16d21?diff=split#diff-78c12f5adc1848d13b1c6f07055d996eL2",
"lines": [
{
"line": "const cp = require('child_process');",
"lineNumber": 1,
"lineChange": "none"
},
{
"line": "var express = require('express');",
"lineNumber": 2,
"lineChange": "none"
},
{
"line": "var serveStatic = require('serve-static');",
"lineNumber": 3,
"lineChange": "none"
},
{
"line": "const { spawn } = require('child_process');",
"lineNumber": 8,
"lineChange": "none"
},
{
"line": "let sisyphe = null;",
"lineNumber": 9,
"lineChange": "none"
},
{
"line": "var app = express();",
"lineNumber": 10,
"lineChange": "none"
},
{
"line": "app.use(serveStatic(path.join(__dirname, 'out')));",
"lineNumber": 11,
"lineChange": "none"
},
{
"line": "app.use(bodyParser.json());",
"lineNumber": 12,
"lineChange": "none"
},
{
"line": " res.send('stop');",
"lineNumber": 34,
"lineChange": "none"
},
{
"line": "});",
"lineNumber": 35,
"lineChange": "none"
},
{
"line": "app.post('/launch', async function (req, res) {",
"lineNumber": 36,
"lineChange": "none"
},
{
"line": " if (!sisyphe) {",
"lineNumber": 37,
"lineChange": "none"
},
{
"line": " console.log(`launch: ${req.body.command}`);",
"lineNumber": 38,
"lineChange": "none"
},
{
"line": " res.send(true);",
"lineNumber": 39,
"lineChange": "none"
},
{
"line": " sisyphe = cp.exec(`./app ${req.body.command}`, (error, stdout, stderr) => (sisyphe = null));",
"lineNumber": 40,
"lineChange": "removed"
},
{
"line": " sisyphe = cp.spawn(`./app`, req.body.command.split(' '));",
"lineNumber": 40,
"lineChange": "added"
},
{
"line": " sisyphe.stdout.pipe(process.stdout);",
"lineNumber": 41,
"lineChange": "added"
},
{
"line": " sisyphe.on('exit', _=>{",
"lineNumber": 42,
"lineChange": "added"
},
{
"line": "} else {",
"lineNumber": 45,
"lineChange": "none"
},
{
"line": " console.log('Already launch');",
"lineNumber": 46,
"lineChange": "none"
}
]
}
],
"exampleCommitDescriptions": [
"Support multiple synclets for a provider.",
"Handle errors in spawn",
"Refactoring log command."
],
"precision": "very-high",
"repoDatasetSize": 54,
"cwe": [
"CWE-78"
]
}
},
{
"id": "javascript/OR",
"name": "OR",
"shortDescription": {
"text": "Open Redirect"
},
"defaultConfiguration": {
"level": "warning"
},
"help": {
"markdown": "\n## Details\nAn open redirect attack takes place when a web application redirects the user to an unauthorized and untrusted site. In general, URL redirection refers to the ability of a website or application to redirect users to another site. This is often a benign and useful feature. For example, if a resource has moved to a new location, URL redirection can transfer the user to that location rather than displaying an error message.\nHowever, this ability can be exploited through social engineering, tricking the user into believing they are accessing one site when, in reality, they are being redirected to a dangerous site, such as a phishing site. Once there, the user may be further tricked into entering credentials or personally identifiable information (PII), believing they are still within the original, trusted domain. Attackers can then use these credentials to gain unauthorized access or leverage the user's PII for sale or ransom.\n\n### Best practices for prevention\n* When developing a site or web app, consider implementing a disclaimer page to remind users that they are leaving a secure site.\n* Adopt a zero-trust approach in which all input is treated with suspicion.\n* Validate all input against deny-lists to ensure it does not contain code to redirect the user. This method is good but inherently incomplete.\n* Be aware of all sources of untrusted input being sent to the server that could be used to redirect the user, such as cookies, URL components, filenames, query results, request headers, and more.\n* In particular, be aware of potential API calls that could send input indirectly to redirect the user.\n* To protect end users, use a firewall to block known malicious sites, train users to recognize basic signs of a phishing attack, and ensure that all network endpoints are patched with the most current updates.",
"text": ""
},
"properties": {
"tags": [
"javascript",
"maintenance",
"bug",
"news",
"redirect",
"pro"
],
"categories": [
"Security"
],
"exampleCommitFixes": [
{
"commitURL": "https://github.com/mobify/mobifyjs/commit/5ff57cb91175b64acfc11dc47ff6a3dd2632f15e?diff=split#diff-c522f931e200edb387e8e8ea6d630a80R6",
"lines": [
{
"line": "Mobify.points = [Date.now()];",
"lineNumber": 3,
"lineChange": "added"
},
{
"line": "Mobify.userAgent = window.navigator.userAgent;",
"lineNumber": 5,
"lineChange": "added"
},
{
"line": "Mobify.debug = function(line) {",
"lineNumber": 7,
"lineChange": "added"
},
{
"line": " // Reload the page (location.reload has problems in FF)",
"lineNumber": 60,
"lineChange": "none"
},
{
"line": " window.location = window.location.href;",
"lineNumber": 61,
"lineChange": "none"
},
{
"line": "};",
"lineNumber": 62,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/mayeaux/nodetube/commit/a10415070dea30826a673fbff4de0d9e87d49d54?diff=split#diff-a9a8d893a8463ac387317e02eec99c96L115",
"lines": [
{
"line": " // app.get(/\\/user\\/(.+)\\/live/, livestreamController.getLive);",
"lineNumber": 111,
"lineChange": "none"
},
{
"line": "/** redirect all routes to the pewtube.com equivalent **/",
"lineNumber": 113,
"lineChange": "removed"
},
{
"line": "app.get('*', function(req, res, next){",
"lineNumber": 114,
"lineChange": "none"
},
{
"line": " return res.redirect(frontendAppUrl + req.path);",
"lineNumber": 118,
"lineChange": "none"
},
{
"line": " });",
"lineNumber": 119,
"lineChange": "none"
},
{
"line": "}",
"lineNumber": 120,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/bluemir/node-wikinote/commit/12378ee06830db457a9eac45399a18d3e721af5d?diff=split#diff-d199589ae6d729b34c26ac4aa837922dL32",
"lines": [
{
"line": " })",
"lineNumber": 29,
"lineChange": "none"
},
{
"line": "}",
"lineNumber": 30,
"lineChange": "none"
},
{
"line": "wikiApp.save = function(req, res){",
"lineNumber": 31,
"lineChange": "none"
},
{
"line": " var data = req.body.data;",
"lineNumber": 32,
"lineChange": "none"
},
{
"line": " wikiFS.writeWiki(req.wikipath, data, req.user).then(function(){",
"lineNumber": 34,
"lineChange": "none"
},
{
"line": " res.redirect(req.path);",
"lineNumber": 35,
"lineChange": "removed"
},
{
"line": " res.redirect(303, req.path);",
"lineNumber": 35,
"lineChange": "added"
},
{
"line": " }).fail(function(err){",
"lineNumber": 36,
"lineChange": "none"
},
{
"line": " console.log(err);",
"lineNumber": 37,
"lineChange": "none"
}
]
}
],
"exampleCommitDescriptions": [
"added news files / cpagination chevron in own file",
"support absolute path redirection + adjustment of server-side redirection",
"added pro page folder"
],
"precision": "very-high",
"repoDatasetSize": 230,
"cwe": [
"CWE-601"
]
}
},
{
"id": "javascript/NoSqli",
"name": "NoSqli",
"shortDescription": {
"text": "NoSQL Injection"
},
"defaultConfiguration": {
"level": "error"
},
"help": {
"markdown": "## Details\n\nIn an NoSQL injection attack, the user can submit an NoSQL query directly to the database, gaining access without providing appropriate credentials. Attackers can then view, export, modify, and delete confidential information; change passwords and other authentication information; and possibly gain access to other systems within the network. This is one of the most commonly exploited categories of vulnerability, but can largely be avoided through good coding practices.",
"text": ""
},
"properties": {
"tags": [
"javascript"
],
"categories": [
"Security"
],
"exampleCommitFixes": [],
"exampleCommitDescriptions": [],
"precision": "very-high",
"repoDatasetSize": 0,
"cwe": [
"CWE-89"
]
}
},
{
"id": "javascript/DisablePoweredBy",
"name": "DisablePoweredBy",
"shortDescription": {
"text": "Information Exposure"
},
"defaultConfiguration": {
"level": "warning"
},
"help": {
"markdown": "## Details\n\nSensitive data includes: personally identifiable information (PII) of employees, customers, users, or other third parties; financial information; code; intellectual property; or protected network information such as passwords. Exposure of sensitive information to an unauthorized actor occurs when any party who does not require this information for business purposes can remove this information from the secure network.\nConsequences of exposure can include holding it for ransom payment, identity theft, or access to other internal network resources-along with financial loss due to regulatory fines, court settlements, or cost to restore compromised systems. As most attackers aim to extract sensitive information, this CWE only describes exploits that take advantage of vulnerabilities related to how data is handled: the management, storage, transfer, or removal of sensitive information.\n\n### Best practices for prevention\n- Encrypt data at all times, whether in transit or at rest.\n- When transporting data, always use a secure protocol such as TLS.\n- Before collecting PII or financial information, consider whether there is a true business need for this information; similarly, before storing the data, ensure that there is an ongoing business need.\n- Classify all incoming data according to privacy and security guidelines to improve awareness of sensitive data.\n- Ensure that caching is disabled for all transactions involving sensitive information.\n- Store passwords with secure, salted hashing functions.\n- Apply a network-wide least-privilege policy so sensitive data is provided only to users with business need to know.",
"text": ""
},
"properties": {
"tags": [
"javascript",
"maintenance",
"express",
"helmet",
"security"
],
"categories": [
"Security"
],
"exampleCommitFixes": [
{
"commitURL": "https://github.com/eclipse/orion.client/commit/ad8f3bce33a1ea9d1e2144e6c42f075ad25829d6?diff=split#diff-16594450dc1f06f7d9cf4a47859cfa52L175",
"lines": [
{
"line": "}",
"lineNumber": 172,
"lineChange": "none"
},
{
"line": "return express()",
"lineNumber": 174,
"lineChange": "removed"
},
{
"line": "return express.Router()",
"lineNumber": 174,
"lineChange": "added"
},
{
"line": ".use(bodyParser.json())",
"lineNumber": 175,
"lineChange": "none"
},
{
"line": ".use(resource(workspaceRoot, {",
"lineNumber": 176,
"lineChange": "removed"
},
{
"line": ".use(apiPath(root))",
"lineNumber": 176,
"lineChange": "added"
}
]
},
{
"commitURL": "https://github.com/flowgrammable/flowsim/commit/1681245625230c6d71e1e74b0ada6551cbf2d935?diff=split#diff-4cb60403ef79ea471c0c046e9873a1e2L6",
"lines": [
{
"line": "var cookieSession = require('cookie-session');",
"lineNumber": 3,
"lineChange": "none"
},
{
"line": "express()",
"lineNumber": 5,
"lineChange": "removed"
},
{
"line": "connect()",
"lineNumber": 5,
"lineChange": "added"
},
{
"line": " .use(cookieParser())",
"lineNumber": 6,
"lineChange": "none"
},
{
"line": " .use(cookieSession({ secret: 'testsecret' }))",
"lineNumber": 7,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/ajmueller/express-auth-session/commit/74209d7901e8b3cf4cf0e6f532d03f8e54e97381?diff=split#diff-0364f57fbff2fabbe941ed20c328ef1aL22",
"lines": [
{
"line": "var authentication = require('./authentication');",
"lineNumber": 20,
"lineChange": "none"
},
{
"line": "var app = express();",
"lineNumber": 22,
"lineChange": "none"
},
{
"line": "app.use(sslRedirect());",
"lineNumber": 24,
"lineChange": "none"
},
{
"line": "app.use(helmet());",
"lineNumber": 25,
"lineChange": "added"
},
{
"line": "mongoose.connect(config.db.uri);",
"lineNumber": 27,
"lineChange": "none"
}
]
}
],
"exampleCommitDescriptions": [
"Test without express",
"secure the api with helmet",
"Fix some security vulnerabilities, refactor the error constants a little"
],
"precision": "very-high",
"repoDatasetSize": 835,
"cwe": [
"CWE-200"
]
}
},
{
"id": "javascript/NoHardcodedPasswords/test",
"name": "NoHardcodedPasswords/test",
"shortDescription": {
"text": "Use of Hardcoded Credentials"
},
"defaultConfiguration": {
"level": "note"
},
"help": {
"markdown": "\n## Details\n\nDevelopers may use hardcoded credentials for convenience when coding in order to simplify their workflow. While they are responsible for removing these before production, occasionally this task may fall through the cracks. This also becomes a maintenance challenge when credentials are re-used across multiple applications.\n\nOnce attackers gain access, they may take advantage of privilege level to remove or alter data, take down a site or app, or hold any of the above for ransom. The risk across multiple similar projects is even greater. If code containing the credentials is reused across multiple projects, they will all be compromised.\n\n### Best practices for prevention\n* Plan software architecture such that keys and passwords are always stored outside the code, wherever possible.\n* Plan encryption into software architecture for all credential information and ensure proper handling of keys, credentials, and passwords.\n* Prompt for a secure password on first login rather than hard-code a default password.\n* If a hardcoded password or credential must be used, limit its use, for example, to system console users rather than via the network.\n* Use strong hashes for inbound password authentication, ideally with randomly assigned salts to increase the difficulty level in case of brute-force attack.",
"text": ""
},
"properties": {
"tags": [
"javascript",
"maintenance",
"usability",
"room",
"mock"
],
"categories": [
"Security",
"InTest"
],
"exampleCommitFixes": [
{
"commitURL": "https://github.com/kbrsh/snip/commit/67f9fb8e117583da57af1bbac7ad31e02e360b08?diff=split#diff-783b3c178e66001d7fc3799c08ec6a30L107",
"lines": [
{
"line": "// Users",
"lineNumber": 104,
"lineChange": "none"
},
{
"line": "User.create({",
"lineNumber": 106,
"lineChange": "none"
},
{
"line": " username: \"test\",",
"lineNumber": 107,
"lineChange": "none"
},
{
"line": " password: \"123\",",
"lineNumber": 108,
"lineChange": "removed"
},
{
"line": " salt: \"WquZ012C\",",
"lineNumber": 108,
"lineChange": "added"
},
{
"line": " hash: \"c5e635ec235a51e89f6ed7d4857afe58663d54f5\",",
"lineNumber": 109,
"lineChange": "added"
},
{
"line": " links: \"\"",
"lineNumber": 110,
"lineChange": "none"
},
{
"line": "});",
"lineNumber": 111,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/spmjs/spm/commit/68f545853f7234f829f17e4e807a26c39721c747?diff=split#diff-ee71e8c29e7bc68ca4bd61bf722a5c56L10",
"lines": [
{
"line": " var service = yuan();",
"lineNumber": 7,
"lineChange": "none"
},
{
"line": " var stub = sinon.stub(service, 'request');",
"lineNumber": 8,
"lineChange": "none"
},
{
"line": " service.login({username: 'spm', password: 'spm'}, function() {});",
"lineNumber": 9,
"lineChange": "removed"
},
{
"line": " service.login({username: 'spm', token: 'spm'}, function() {});",
"lineNumber": 9,
"lineChange": "added"
},
{
"line": " stub.callCount.should.eql(1);",
"lineNumber": 10,
"lineChange": "none"
},
{
"line": "});",
"lineNumber": 11,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/codefordenver/Comrad/commit/a0485e6701869c0f0b558fefa946c6eca2d54022?diff=split#diff-aee85098e751c8ecb7298387b9364bd7L12",
"lines": [
{
"line": "},",
"lineNumber": 9,
"lineChange": "none"
},
{
"line": "create: (req, res) => {",
"lineNumber": 11,
"lineChange": "none"
},
{
"line": " const { username, password } = req.body;",
"lineNumber": 12,
"lineChange": "added"
},
{
"line": " db.User",
"lineNumber": 14,
"lineChange": "none"
},
{
"line": " .create({ username: 'UserOne', password: 'password' })",
"lineNumber": 12,
"lineChange": "removed"
},
{
"line": " .create({ username, password })",
"lineNumber": 15,
"lineChange": "added"
},
{
"line": " .then(dbNote => res.json(dbNote))",
"lineNumber": 16,
"lineChange": "none"
},
{
"line": " .catch(err => res.json(err));",
"lineNumber": 17,
"lineChange": "none"
}
]
}
],
"exampleCommitDescriptions": [
"- Join room e2e tests added",
"Mock api() tests"
],
"precision": "very-high",
"repoDatasetSize": 189,
"cwe": [
"CWE-798",
"CWE-259"
]
}
},
{
"id": "javascript/NoHardcodedCredentials",
"name": "NoHardcodedCredentials",
"shortDescription": {
"text": "Use of Hardcoded Credentials"
},
"defaultConfiguration": {
"level": "warning"
},
"help": {
"markdown": "\n## Details\n\nDevelopers may use hardcoded credentials for convenience when coding in order to simplify their workflow. While they are responsible for removing these before production, occasionally this task may fall through the cracks. This also becomes a maintenance challenge when credentials are re-used across multiple applications.\n\nOnce attackers gain access, they may take advantage of privilege level to remove or alter data, take down a site or app, or hold any of the above for ransom. The risk across multiple similar projects is even greater. If code containing the credentials is reused across multiple projects, they will all be compromised.\n\n### Best practices for prevention\n* Plan software architecture such that keys and passwords are always stored outside the code, wherever possible.\n* Plan encryption into software architecture for all credential information and ensure proper handling of keys, credentials, and passwords.\n* Prompt for a secure password on first login rather than hard-code a default password.\n* If a hardcoded password or credential must be used, limit its use, for example, to system console users rather than via the network.\n* Use strong hashes for inbound password authentication, ideally with randomly assigned salts to increase the difficulty level in case of brute-force attack.",
"text": ""
},
"properties": {
"tags": [
"javascript",
"maintenance",
"tests",
"user",
"login"
],
"categories": [
"Security"
],
"exampleCommitFixes": [
{
"commitURL": "https://github.com/dfoderick/fullcyclereact/commit/a6abd97bd776ce56da8ac321ad0e1b500f67721d?diff=split#diff-ca64812ac15b141271f726a5a95a3402L9",
"lines": [
{
"line": "const SSE = require('sse');",
"lineNumber": 6,
"lineChange": "none"
},
{
"line": "const bodyParser = require('body-parser');",
"lineNumber": 7,
"lineChange": "none"
},
{
"line": "const redis = require('redis');",
"lineNumber": 8,
"lineChange": "none"
},
{
"line": "const amqp = require('amqplib/callback_api');",
"lineNumber": 9,
"lineChange": "none"
},
{
"line": "const redis_port = 6379",
"lineNumber": 19,
"lineChange": "removed"
},
{
"line": "const redis_host = serverhost",
"lineNumber": 20,
"lineChange": "removed"
},
{
"line": "const redis_password = ''",
"lineNumber": 21,
"lineChange": "removed"
},
{
"line": "//Message envelope for putting messages on the bus",
"lineNumber": 23,
"lineChange": "removed"
},
{
"line": "function redisclient(){",
"lineNumber": 98,
"lineChange": "none"
},
{
"line": " var client = redis.createClient(redis_port, redis_host, {no_ready_check: true});",
"lineNumber": 99,
"lineChange": "removed"
},
{
"line": " client.auth(redis_password, function (err) {",
"lineNumber": 100,
"lineChange": "removed"
},
{
"line": " var client = redis.createClient(services.redis.port, services.redis.host, {no_ready_check: true});",
"lineNumber": 54,
"lineChange": "added"
},
{
"line": " client.auth(services.redis.password, function (err) {",
"lineNumber": 55,
"lineChange": "added"
},
{
"line": " if (err) throw err;",
"lineNumber": 101,
"lineChange": "none"
},
{
"line": " });",
"lineNumber": 102,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/foxhound87/mobx-react-form/commit/3120097eb35365742aaa55914461f3702c4c0b9e?diff=split#diff-4cd745890a2a3a4ed716894e77383749L38",
"lines": [
{
"line": " ",
"lineNumber": 35,
"lineChange": "none"
},
{
"line": " onInit(form) {",
"lineNumber": 36,
"lineChange": "none"
},
{
"line": " // form.update({ user: { email: 'notAnEmail' } }); // TO FIX",
"lineNumber": 36,
"lineChange": "removed"
},
{
"line": " form.$('user').update({ email: 'notAnEmail' });",
"lineNumber": 37,
"lineChange": "removed"
},
{
"line": " form.update({ user: { email: 'notAnEmail' } });",
"lineNumber": 37,
"lineChange": "added"
},
{
"line": " }",
"lineNumber": 38,
"lineChange": "none"
},
{
"line": "}",
"lineNumber": 39,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/DAVFoundation/community/commit/22bfd8d1c7bdad79421868ace378731ccc76c6f3?diff=split#diff-ffbabba1d71222fff38a087e3cb7d372L13",
"lines": [
{
"line": "// restrict.canPostDavUpdates();",
"lineNumber": 10,
"lineChange": "removed"
},
{
"line": "restrict.canPostDavUpdates();",
"lineNumber": 10,
"lineChange": "added"
},
{
"line": "let person = await Person.findOne({email:\"[email protected]\"}).exec();",
"lineNumber": 12,
"lineChange": "removed"
},
{
"line": "let person = await Person.findOne({email:config.dav.email}).exec();",
"lineNumber": 12,
"lineChange": "added"
},
{
"line": "let account = await DavAccount.findById(person.account.id).exec();",
"lineNumber": 14,
"lineChange": "none"
}
]
}
],
"exampleCommitDescriptions": [
"get users test",
"updated login unit test"
],
"precision": "very-high",
"repoDatasetSize": 256,
"cwe": [
"CWE-798"
]
}
},
{
"id": "javascript/HttpToHttps",
"name": "HttpToHttps",
"shortDescription": {
"text": "Cleartext Transmission of Sensitive Information"
},
"defaultConfiguration": {
"level": "warning"
},
"help": {
"markdown": "\n## Details\nThis weakness occurs when software transmits sensitive information, such as passwords or credit card numbers, in unencrypted form. This information may then be intercepted by threat actors using sniffer tools or interception techniques such as man-in-the-middle (MITM) attacks (often involving social engineering). Attackers can then use information gleaned to perform a variety of actions, depending on the information type. Possible actions include gaining unauthorized access, impersonating a user, moving laterally within the organization's network, or retrieving and potentially modifying files. This weakness is almost completely avoidable through intelligent architecture and design.\n\n### Best practices for prevention\n* Build web applications around a security mindset and the awareness that sniffers may be present at any time.\n* Ensure that all sensitive data transmission uses reliable encryption.\n* Implement security measures so that sensitive results are never returned in plain text.\n* Implement multiple-factor authentication methods to validate remote instances.\n* Use SSL not only at logon but throughout communications.",
"text": ""
},
"properties": {
"tags": [
"javascript",
"maintenance",
"http"
],
"categories": [
"Security"
],
"exampleCommitFixes": [
{
"commitURL": "https://github.com/Rocket1184/qq-bot-rebown/commit/5255a8398cf1d80f60e182c53e8532c7562e76c2?diff=split#diff-62a4be7247c4abe75f2cc11746422b86L12",
"lines": [
{
"line": "'use strict';",
"lineNumber": 9,