forked from Sladey01/GitHubPipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sarif.json
3209 lines (3208 loc) · 132 KB
/
sarif.json
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/NoRateLimitingForExpensiveWebOperation",
"name": "NoRateLimitingForExpensiveWebOperation",
"shortDescription": {
"text": "Allocation of Resources Without Limits or Throttling"
},
"defaultConfiguration": {
"level": "warning"
},
"help": {
"markdown": "",
"text": ""
},
"properties": {
"tags": [
"javascript",
"maintenance",
"server",
"file",
"page"
],
"categories": [
"Security"
],
"exampleCommitFixes": [
{
"commitURL": "https://github.com/odota/core/commit/7d60d51f777de4c338fc3716a7fe553d08c7e6e1?diff=split#diff-09461573a85e2d94f056dd6814769042L26",
"lines": [
{
"line": "});",
"lineNumber": 23,
"lineChange": "none"
},
{
"line": "app.get('/', function(req, res, next) {",
"lineNumber": 25,
"lineChange": "none"
},
{
"line": " var fileName = req.query.fileName;",
"lineNumber": 26,
"lineChange": "none"
},
{
"line": " var url = req.query.url;",
"lineNumber": 27,
"lineChange": "none"
},
{
"line": " var inStream;",
"lineNumber": 28,
"lineChange": "none"
},
{
"line": " var bz;",
"lineNumber": 29,
"lineChange": "none"
},
{
"line": " });",
"lineNumber": 34,
"lineChange": "removed"
},
{
"line": "}",
"lineNumber": 35,
"lineChange": "removed"
},
{
"line": "var parser = spawn(\"java\", [\"-jar\",",
"lineNumber": 36,
"lineChange": "removed"
},
{
"line": " });",
"lineNumber": 37,
"lineChange": "added"
},
{
"line": "}",
"lineNumber": 38,
"lineChange": "added"
},
{
"line": "parser = spawn(\"java\", [\"-jar\",",
"lineNumber": 39,
"lineChange": "added"
},
{
"line": "\"-Xmx64m\",",
"lineNumber": 40,
"lineChange": "none"
},
{
"line": "\"parser/target/stats-0.1.0.jar\"",
"lineNumber": 41,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/jfrux/workbench/commit/8d8eedf48b26a8e86d2bf0b4c722fdcd8e634934?diff=split#diff-f53e59f241bb62f0261e245350683e07L9",
"lines": [
{
"line": "const express = require('express');",
"lineNumber": 25,
"lineChange": "none"
},
{
"line": "const app = express();",
"lineNumber": 26,
"lineChange": "none"
},
{
"line": "// console.log(pty);",
"lineNumber": 27,
"lineChange": "added"
},
{
"line": "const pty = require('node-pty');",
"lineNumber": 28,
"lineChange": "none"
},
{
"line": "const argv = require('yargs').argv;",
"lineNumber": 29,
"lineChange": "none"
},
{
"line": "require('express-ws')(app);",
"lineNumber": 60,
"lineChange": "none"
},
{
"line": "app.post('/terminals', function (req, res) {",
"lineNumber": 62,
"lineChange": "none"
},
{
"line": " let shell = argv.shell && argv.shell !== '' ? argv.shell : process.platform === 'win32' ? 'cmd.exe' : 'bash';",
"lineNumber": 63,
"lineChange": "none"
},
{
"line": " let cols = parseInt(req.query.cols, 10);",
"lineNumber": 64,
"lineChange": "none"
},
{
"line": " let rows = parseInt(req.query.rows, 10);",
"lineNumber": 65,
"lineChange": "none"
},
{
"line": " let term = pty.spawn(shell, [], {",
"lineNumber": 46,
"lineChange": "removed"
},
{
"line": " let term = pty.fork(shell, [], {",
"lineNumber": 66,
"lineChange": "added"
},
{
"line": " name: 'xterm-color',",
"lineNumber": 67,
"lineChange": "none"
},
{
"line": " cols: cols || 80,",
"lineNumber": 68,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/soomtong/blititor/commit/6627d47e769eaa3308445105f924a514f9e750bd?diff=split#diff-832a2c38c4705ad5036bd453a0a9390bL7",
"lines": [
{
"line": "var winston = require('winston');",
"lineNumber": 4,
"lineChange": "none"
},
{
"line": "var childProcess = require('child_process');",
"lineNumber": 6,
"lineChange": "none"
},
{
"line": "var common = require('../../../core/lib/common');",
"lineNumber": 8,
"lineChange": "none"
},
{
"line": "}",
"lineNumber": 55,
"lineChange": "none"
},
{
"line": "function viewGateway(req, res) {",
"lineNumber": 57,
"lineChange": "none"
},
{
"line": " var params = {",
"lineNumber": 58,
"lineChange": "none"
},
{
"line": " title: '넷 앱 컨트롤러 허브',",
"lineNumber": 59,
"lineChange": "none"
},
{
"line": "};",
"lineNumber": 71,
"lineChange": "removed"
},
{
"line": "childProcess.execFile(cmd.list, { env: gatewayConnectionInfo }, function (error, stdout, stderr) {",
"lineNumber": 73,
"lineChange": "removed"
},
{
"line": " var result = stdout.toString().replace(/\\\\n/g, '\\n');",
"lineNumber": 74,
"lineChange": "removed"
},
{
"line": "console.log(result);",
"lineNumber": 76,
"lineChange": "removed"
},
{
"line": "};",
"lineNumber": 80,
"lineChange": "added"
},
{
"line": "childProcess.execFile(consoleCommand.list, gatewayConnectionInfo, function (error, stdout, stderr) {",
"lineNumber": 82,
"lineChange": "added"
},
{
"line": " var result = stdout.toString().replace(/\\\\n/g, '\\n');",
"lineNumber": 83,
"lineChange": "added"
},
{
"line": "console.log(result);",
"lineNumber": 85,
"lineChange": "added"
}
]
}
],
"exampleCommitDescriptions": [
"WIP Fix server tests.",
"* Fixed tests failing due to a renamed file.",
"* The end-to-end test now works up to the your-claims page."
],
"precision": "very-high",
"repoDatasetSize": 1163,
"cwe": [
"CWE-770"
]
}
},
{
"id": "javascript/XSS",
"name": "XSS",
"shortDescription": {
"text": "Cross-site Scripting (XSS)"
},
"defaultConfiguration": {
"level": "error"
},
"help": {
"markdown": "## Details\n\nA cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.\n\nThis is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser's Same Origin Policy.\n\nInjecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.\n\nEscaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, `<` can be coded as `<`; and `>` can be coded as `>`; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses `<` and `>` as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they've been correctly escaped in the application code and in this way the attempted attack is diverted.\n\nThe most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.\n\n### Types of attacks\nThere are a few methods by which XSS can be manipulated:\n\n|Type|Origin|Description|\n|--|--|--|\n|**Stored**|Server|The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.|\n|**Reflected**|Server|The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user's browser.|\n|**DOM-based**|Client|The attacker forces the user's browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.|\n|**Mutated**| |The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.|\n\n### Affected environments\nThe following environments are susceptible to an XSS attack:\n\n* Web servers\n* Application servers\n* Web application environments\n\n### How to prevent\nThis section describes the top best practices designed to specifically protect your code:\n\n* Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.\n* Convert special characters such as `?`, `&`, `/`, `<`, `>` and spaces to their respective HTML or URL encoded equivalents.\n* Give users the option to disable client-side scripts.\n* Redirect invalid requests.\n* Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.\n* Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.\n* Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.",
"text": ""
},
"properties": {
"tags": [
"javascript",
"maintenance",
"API",
"server",
"error"
],
"categories": [
"Security"
],
"exampleCommitFixes": [
{
"commitURL": "https://github.com/scriptoLLC/take-five/commit/2afebbd008b056355ef7a32d3047e49abcd40363?diff=split#diff-3e18a4ee36b162703e52321c242f6960L285",
"lines": [
{
"line": "const server = five({maxPost: 100})",
"lineNumber": 282,
"lineChange": "removed"
},
{
"line": "const server = new TF(opts)",
"lineNumber": 446,
"lineChange": "added"
},
{
"line": "server.listen(3000)",
"lineNumber": 447,
"lineChange": "none"
},
{
"line": "server.post('/', (req, res) => res.send(req.body))",
"lineNumber": 284,
"lineChange": "removed"
},
{
"line": "// can't seem to override content-length to report a false value in either",
"lineNumber": 286,
"lineChange": "removed"
},
{
"line": "server.post('/', (req, res, ctx) => ctx.send(req.body))",
"lineNumber": 448,
"lineChange": "added"
},
{
"line": "t.test('invalid json', (t) => {",
"lineNumber": 450,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/rowanmanning/joblint/commit/7a7b3b3ee515a6756d1476e839ad95aedd310987?diff=split#diff-f14ed86984d5e672043bf2effee59011L9",
"lines": [
{
"line": "function defineController (app) {",
"lineNumber": 7,
"lineChange": "none"
},
{
"line": " app.post('/ws', requireUrlEncodedPostBody, requireUnemptyJobSpec, function (req, res) {",
"lineNumber": 8,
"lineChange": "none"
},
{
"line": " res.send(joblint(req.body.spec));",
"lineNumber": 9,
"lineChange": "removed"
},
{
"line": " res.jsonp(joblint(req.body.spec));",
"lineNumber": 9,
"lineChange": "added"
},
{
"line": " });",
"lineNumber": 10,
"lineChange": "none"
},
{
"line": " app.all('/ws', function (req, res) {",
"lineNumber": 11,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/justsml/escape-from-callback-mountain/commit/9dd1fe21cb54fcfc83294a2114a5ed6b62383b2e?diff=split#diff-166589e929a882bbe77d71545a5969a7L6",
"lines": [
{
"line": "const {TimeoutError, QueueEmpty, NotFound} = require('../util/errors')",
"lineNumber": 3,
"lineChange": "none"
},
{
"line": "const enqueueHandler = (req, res, next) => {",
"lineNumber": 7,
"lineChange": "none"
},
{
"line": " enqueueAsync(req.body)",
"lineNumber": 8,
"lineChange": "none"
},
{
"line": " .then(result => res.send(result))",
"lineNumber": 7,
"lineChange": "removed"
},
{
"line": " .then(result => res.send({result}))",
"lineNumber": 9,
"lineChange": "added"
},
{
"line": " .catch(next)",
"lineNumber": 10,
"lineChange": "none"
},
{
"line": "}",
"lineNumber": 11,
"lineChange": "none"
}
]
}
],
"exampleCommitDescriptions": [
"Adding api tests for consumer",
"Refactored to ensure the server is running before the test runs",
"* fixing linting error"
],
"precision": "very-high",
"repoDatasetSize": 1046,
"cwe": [
"CWE-79"
]
}
},
{
"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 hackers 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/Sqli",
"name": "Sqli",
"shortDescription": {
"text": "SQL Injection"
},
"defaultConfiguration": {
"level": "error"
},
"help": {
"markdown": "## Details\n\nIn an SQL injection attack, the user can submit an SQL query directly to the database, gaining access without providing appropriate credentials. Hackers 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.\n\n### Best practices for prevention\n- Avoid passing user-entered parameters directly to the SQL server.\n- When coding, define SQL code first, then pass in parameters. Use prepared statements with parameterized queries. Examples include `SqlCommand()` in .NET and `bindParam()` in PHP.\n- Use strong typing for all parameters so unexpected user data will be rejected.\n- Where direct user input cannot be avoided for performance reasons, validate input against a very strict allowlist of permitted characters, avoiding special characters such as `? & / < > ; -` and spaces. Use a vendor-supplied escaping routine if possible.\n- Develop your application in an environment and/or using libraries that provide protection against SQL injection.\n- Harden your entire environment around a least-privilege model, ideally with isolated accounts with privileges only for particular tasks.",
"text": ""
},
"properties": {
"tags": [
"javascript",
"maintenance",
"tests",
"database",
"adapter"
],
"categories": [
"Security"
],
"exampleCommitFixes": [
{
"commitURL": "https://github.com/ecaron/smart-nightlight-manager/commit/6b477d9209244c0b15c63207f4867777683cb48c?diff=split#diff-9ccf639a80fa742c5209118e795b96afL64",
"lines": [
{
"line": "});",
"lineNumber": 61,
"lineChange": "none"
},
{
"line": "router.post('/', function (req, res, next) {",
"lineNumber": 63,
"lineChange": "none"
},
{
"line": " if (!req.body.cmd) {",
"lineNumber": 64,
"lineChange": "none"
},
{
"line": " return next(new Error('POST without a cmd'));",
"lineNumber": 65,
"lineChange": "none"
},
{
"line": " }",
"lineNumber": 66,
"lineChange": "none"
},
{
"line": " var button;",
"lineNumber": 67,
"lineChange": "none"
},
{
"line": " var light;",
"lineNumber": 68,
"lineChange": "none"
},
{
"line": " switch (req.body.cmd) {",
"lineNumber": 69,
"lineChange": "none"
},
{
"line": " case 'associate-button':",
"lineNumber": 70,
"lineChange": "none"
},
{
"line": " button = db('buttons').find({mac: req.body.button});",
"lineNumber": 71,
"lineChange": "removed"
},
{
"line": " button = db.get('buttons').find({mac: req.body.button}).value();",
"lineNumber": 71,
"lineChange": "added"
},
{
"line": " if (button) {",
"lineNumber": 72,
"lineChange": "none"
},
{
"line": " button.light = req.body.light;",
"lineNumber": 73,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/CloudTask/cloudtask-web/commit/41230f587b03e7f3a10bdfb8d8fcb656afec80a5?diff=split#diff-d17537c36c16616befe463458f310e74L197",
"lines": [
{
"line": "}",
"lineNumber": 194,
"lineChange": "none"
},
{
"line": "exports.updateJob = (req, res, next) => {",
"lineNumber": 196,
"lineChange": "none"
},
{
"line": " let db = req.db;",
"lineNumber": 197,
"lineChange": "removed"
},
{
"line": " let envConfig = req.envConfig;",
"lineNumber": 198,
"lineChange": "none"
},
{
"line": " let postJob = req.body;",
"lineNumber": 199,
"lineChange": "none"
},
{
"line": " let groupId = postJob.groupid;",
"lineNumber": 200,
"lineChange": "none"
},
{
"line": " let jobId = postJob.jobid;",
"lineNumber": 201,
"lineChange": "none"
},
{
"line": " let job = {};",
"lineNumber": 202,
"lineChange": "none"
},
{
"line": " let jobLocation = '';",
"lineNumber": 203,
"lineChange": "none"
},
{
"line": " let collectionLocation = db.collection('sys_jobs');",
"lineNumber": 205,
"lineChange": "removed"
},
{
"line": " collectionLocation.find({ 'groupid': groupId }).toArray((err, resultJob) => {",
"lineNumber": 206,
"lineChange": "removed"
},
{
"line": " dbFactory.getCollection(collectionName).find({ 'groupid': groupId }).toArray((err, resultJob) => {",
"lineNumber": 199,
"lineChange": "added"
},
{
"line": " if (err) {",
"lineNumber": 207,
"lineChange": "none"
},
{
"line": " console.log('Error:' + err);",
"lineNumber": 208,
"lineChange": "none"
}
]
},
{
"commitURL": "https://github.com/Cezerin2/cezerin2/commit/8acc87adae90bed93be5d819ea65d8fd56b11980?diff=split#diff-0071f220f9a824f927625640c7065422L9",
"lines": [
{
"line": "import handlebars from 'handlebars';",
"lineNumber": 6,
"lineChange": "none"
},
{
"line": "import lruCache from 'lru-cache';",
"lineNumber": 7,
"lineChange": "none"
},
{
"line": "import { db } from '../../lib/mongo';",
"lineNumber": 8,
"lineChange": "none"
},
{
"line": "import parse from '../../lib/parse';",
"lineNumber": 9,
"lineChange": "none"
},
{
"line": "import settings from '../../lib/settings';",
"lineNumber": 10,
"lineChange": "none"
},
{
"line": "class SecurityTokensService {",
"lineNumber": 21,
"lineChange": "none"
},
{
"line": " getTokens(params = {}) {",
"lineNumber": 22,
"lineChange": "none"
},
{
"line": " let filter = {",
"lineNumber": 23,
"lineChange": "removed"
},
{
"line": " const filter = {",
"lineNumber": 23,
"lineChange": "added"
},
{
"line": " is_revoked: false",
"lineNumber": 24,
"lineChange": "none"
},
{
"line": " };",
"lineNumber": 25,
"lineChange": "none"
},
{
"line": " const id = parse.getObjectIDIfValid(params.id);",
"lineNumber": 26,
"lineChange": "none"
},
{
"line": " if (id) {",
"lineNumber": 27,
"lineChange": "none"
},
{
"line": " filter._id = new ObjectID(id);",
"lineNumber": 28,
"lineChange": "none"
},
{
"line": " }",
"lineNumber": 29,
"lineChange": "none"
},
{
"line": " const email = parse.getString(params.email).toLowerCase();",
"lineNumber": 31,
"lineChange": "none"
},
{
"line": " if (email && email.length > 0) {",
"lineNumber": 32,
"lineChange": "none"
},
{
"line": " filter.email = email;",
"lineNumber": 33,
"lineChange": "none"
},
{
"line": " }",
"lineNumber": 34,
"lineChange": "none"
},
{
"line": " return db",
"lineNumber": 36,
"lineChange": "none"
},
{
"line": " .collection('tokens')",
"lineNumber": 37,
"lineChange": "none"
},
{
"line": " .find(filter)",
"lineNumber": 38,
"lineChange": "none"
},
{
"line": " .toArray()",
"lineNumber": 39,
"lineChange": "none"
},
{
"line": " .then(items => items.map(item => this.changeProperties(item)));",
"lineNumber": 40,
"lineChange": "none"
},
{
"line": "}",
"lineNumber": 73,
"lineChange": "none"
},
{
"line": "getSingleTokenByEmail(email) {",
"lineNumber": 75,
"lineChange": "none"
},
{
"line": " return this.getTokens({ email }).then(items => {",
"lineNumber": 76,
"lineChange": "removed"
},
{
"line": " return items.length > 0 ? items[0] : null;",
"lineNumber": 77,
"lineChange": "removed"
},
{
"line": " });",
"lineNumber": 78,
"lineChange": "removed"
},
{
"line": " return this.getTokens({ email }).then(items =>",
"lineNumber": 75,
"lineChange": "added"
},
{
"line": " items.length > 0 ? items[0] : null",
"lineNumber": 76,
"lineChange": "added"
},
{
"line": " );",
"lineNumber": 77,
"lineChange": "added"
},
{
"line": "}",
"lineNumber": 79,
"lineChange": "none"
},
{
"line": "}",
"lineNumber": 222,
"lineChange": "none"
},
{
"line": "getDashboardSigninUrl(email) {",
"lineNumber": 224,
"lineChange": "none"
},
{
"line": " return SettingsService.getSettings().then(generalSettings =>",
"lineNumber": 225,
"lineChange": "none"
},
{
"line": " this.getSingleTokenByEmail(email).then(token => {",
"lineNumber": 226,
"lineChange": "none"
},
{
"line": " if (token) {",
"lineNumber": 227,
"lineChange": "none"
},
{
"line": " return this.getSignedToken(token).then(signedToken => {",
"lineNumber": 228,
"lineChange": "none"
},
{
"line": "}",
"lineNumber": 278,
"lineChange": "none"
},
{
"line": "async sendDashboardSigninUrl(req) {",
"lineNumber": 280,
"lineChange": "none"
},
{
"line": " const email = req.body.email;",
"lineNumber": 281,
"lineChange": "removed"
},
{
"line": " const { email } = req.body;",
"lineNumber": 278,
"lineChange": "added"
},
{
"line": " const userAgent = uaParser(req.get('user-agent'));",
"lineNumber": 282,
"lineChange": "none"
},
{
"line": " const country = req.get('cf-ipcountry') || '';",
"lineNumber": 283,
"lineChange": "none"
},
{
"line": " const ip = this.getIP(req);",
"lineNumber": 284,
"lineChange": "none"
},
{
"line": " const date = moment(new Date()).format('dddd, MMMM DD, YYYY h:mm A');",
"lineNumber": 285,
"lineChange": "none"
},
{
"line": " const link = await this.getDashboardSigninUrl(email);",
"lineNumber": 286,
"lineChange": "none"
},
{
"line": " if (link) {",
"lineNumber": 288,
"lineChange": "none"
}
]
}
],
"exampleCommitDescriptions": [
"* Additional tests",
"* Added more indepth error handling to connections on all database adapters.",
"* Adapt deletion + fix dependencies errors from yarn control"
],
"precision": "very-high",
"repoDatasetSize": 255,
"cwe": [
"CWE-89"
]
}
},
{
"id": "javascript/NoHardcodedPasswords",