Skip to content

Commit afc584e

Browse files
authoredSep 11, 2018
Merge pull request #19 from guardrailsio/fix/lineItemType
Update types
2 parents 67add4e + 4f37a6c commit afc584e

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed
 

‎index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const processSchema = Joi.object().keys({
1818
});
1919

2020
const lineitemSchema = Joi.object().keys({
21-
type: Joi.string().required(),
21+
type: Joi.string()
22+
.required()
23+
.valid("sast", "sca", "secret"),
2224
ruleId: Joi.string().required(),
2325
location: Joi.object().keys({
2426
path: Joi.string()
@@ -120,9 +122,9 @@ reportData.output.forEach(lineItem => {
120122
}
121123
});
122124
let metadataSchema;
123-
if (lineItem.type == "issue" || lineItem.type == "secret") {
125+
if (lineItem.type == "sast" || lineItem.type == "secret") {
124126
metadataSchema = metadataSchemaSAST;
125-
} else if (lineItem.type == "advisory") {
127+
} else if (lineItem.type == "sca") {
126128
metadataSchema = metadataSchemaSCA;
127129
}
128130

‎test/fixtures/brakeman.json

+17-17
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"output": [
1515
{
16-
"type": "issue",
16+
"type": "sast",
1717
"ruleId": "25",
1818
"location": {
1919
"path": "app/controllers/password_resets_controller.rb",
@@ -34,7 +34,7 @@
3434
}
3535
},
3636
{
37-
"type": "issue",
37+
"type": "sast",
3838
"ruleId": "0",
3939
"location": {
4040
"path": "app/models/analytics.rb",
@@ -55,7 +55,7 @@
5555
}
5656
},
5757
{
58-
"type": "issue",
58+
"type": "sast",
5959
"ruleId": "23",
6060
"location": {
6161
"path": "app/controllers/dashboard_controller.rb",
@@ -76,7 +76,7 @@
7676
}
7777
},
7878
{
79-
"type": "issue",
79+
"type": "sast",
8080
"ruleId": "26",
8181
"location": {
8282
"path": "config/initializers/session_store.rb",
@@ -97,7 +97,7 @@
9797
}
9898
},
9999
{
100-
"type": "issue",
100+
"type": "sast",
101101
"ruleId": "7",
102102
"location": {
103103
"path": "app/controllers/application_controller.rb",
@@ -118,7 +118,7 @@
118118
}
119119
},
120120
{
121-
"type": "issue",
121+
"type": "sast",
122122
"ruleId": "29",
123123
"location": {
124124
"path": "config/initializers/secret_token.rb",
@@ -139,7 +139,7 @@
139139
}
140140
},
141141
{
142-
"type": "issue",
142+
"type": "sast",
143143
"ruleId": "29",
144144
"location": {
145145
"path": "config/initializers/secret_token.rb",
@@ -160,7 +160,7 @@
160160
}
161161
},
162162
{
163-
"type": "issue",
163+
"type": "sast",
164164
"ruleId": "24",
165165
"location": {
166166
"path": "app/controllers/api/v1/mobile_controller.rb",
@@ -181,7 +181,7 @@
181181
}
182182
},
183183
{
184-
"type": "issue",
184+
"type": "sast",
185185
"ruleId": "105",
186186
"location": {
187187
"path": "app/controllers/users_controller.rb",
@@ -202,7 +202,7 @@
202202
}
203203
},
204204
{
205-
"type": "issue",
205+
"type": "sast",
206206
"ruleId": "0",
207207
"location": {
208208
"path": "app/controllers/users_controller.rb",
@@ -223,7 +223,7 @@
223223
}
224224
},
225225
{
226-
"type": "issue",
226+
"type": "sast",
227227
"ruleId": "70",
228228
"location": {
229229
"path": "app/controllers/users_controller.rb",
@@ -244,7 +244,7 @@
244244
}
245245
},
246246
{
247-
"type": "issue",
247+
"type": "sast",
248248
"ruleId": "30",
249249
"location": {
250250
"path": "app/models/user.rb",
@@ -265,7 +265,7 @@
265265
}
266266
},
267267
{
268-
"type": "issue",
268+
"type": "sast",
269269
"ruleId": "14",
270270
"location": {
271271
"path": "app/models/benefits.rb",
@@ -286,7 +286,7 @@
286286
}
287287
},
288288
{
289-
"type": "issue",
289+
"type": "sast",
290290
"ruleId": "24",
291291
"location": {
292292
"path": "app/controllers/api/v1/mobile_controller.rb",
@@ -307,7 +307,7 @@
307307
}
308308
},
309309
{
310-
"type": "issue",
310+
"type": "sast",
311311
"ruleId": "16",
312312
"location": {
313313
"path": "app/controllers/benefit_forms_controller.rb",
@@ -328,7 +328,7 @@
328328
}
329329
},
330330
{
331-
"type": "issue",
331+
"type": "sast",
332332
"ruleId": "2",
333333
"location": {
334334
"path": "app/views/layouts/application.html.erb",
@@ -349,7 +349,7 @@
349349
}
350350
},
351351
{
352-
"type": "issue",
352+
"type": "sast",
353353
"ruleId": "24",
354354
"location": {
355355
"path": "app/controllers/benefit_forms_controller.rb",

0 commit comments

Comments
 (0)
Failed to load comments.