Skip to content

Commit b2eae0a

Browse files
committed
writer-json-sarif: unconditionally set the region property
... for each `physicalLocation` object. Although the property is optional according to the specification of SARIF Version 2.1.0, DefectDojo fails to import the data if the property is missing. Reported-by: Mert Bugra Bicak Closes: #123
1 parent 0f475ee commit b2eae0a

File tree

3 files changed

+342
-8
lines changed

3 files changed

+342
-8
lines changed

src/lib/writer-json-sarif.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,14 @@ static void sarifEncodeLoc(object *pLoc, const Defect &def, unsigned idx)
212212
};
213213

214214
// line/col
215-
if (evt.line) {
216-
object reg = {
217-
{ "startLine", evt.line }
218-
};
215+
object reg = {
216+
{ "startLine", evt.line }
217+
};
219218

220-
if (evt.column)
221-
reg["startColumn"] = evt.column;
219+
if (evt.column)
220+
reg["startColumn"] = evt.column;
222221

223-
locPhy["region"] = std::move(reg);
224-
}
222+
locPhy["region"] = std::move(reg);
225223

226224
// location
227225
pLoc->emplace("physicalLocation", std::move(locPhy));

0 commit comments

Comments
 (0)