mirror of
https://github.com/hohn/sarif-cli.git
synced 2025-12-16 17:23:03 +01:00
sarif-extract-multi: extract combined tables from multiple sarif files
This command introduces a new tree structure that pulls in a collection
of sarif files. In yaml format, an example is
- creation_date: '2021-12-09' # Repository creation date
primary_language: javascript # By lines of code
project_name: treeio/treeio # Repo name-short name
query_commit_id: fa9571646c # Commit id for custom (non-library) queries
sarif_content: {} # The sarif content will be attached here
sarif_file_name: 2021-12-09/results.sarif # Path to sarif file
scan_start_date: '2021-12-09' # Beginning date/time of scan
scan_stop_date: '2021-12-10' # End date/time of scan
tool_name: codeql
tool_version: v1.27
- creation_date: '2022-02-25'
primary_language: javascript
...
At run time,
cd ~/local/sarif-cli/data/treeio
sarif-extract-multi multi-sarif-01.json test-multi-table
will load the specified sarif files and put them in place of
`sarif_content`, then build tables against the new signature found in
sarif_cli/signature_multi.py, and merge those into 6 larger tables. The
exported tables are
artifacts.csv path-problem.csv project.csv
codeflows.csv problem.csv related-locations.csv
and they have join keys for further operations.
The new typegraph is rendered in
notes/typegraph-multi.pdf
using the instructions in
sarif_cli/signature_multi.py
This commit is contained in:
committed by
=Michael Hohn
parent
9c151e295b
commit
0f070a6ae4
@@ -11,124 +11,6 @@ from dataclasses import dataclass
|
||||
from typing import *
|
||||
import pandas as pd
|
||||
|
||||
#
|
||||
# Structure graph from ../../bin/sarif-to-dot -u -t -f results.sarif
|
||||
#
|
||||
struct_graph_2022_02_01 = (
|
||||
[ ('String', 'string'),
|
||||
('Int', 'int'),
|
||||
('Bool', 'bool'),
|
||||
( 'Struct2685',
|
||||
( 'struct',
|
||||
('index', 'Int'),
|
||||
('uri', 'String'),
|
||||
('uriBaseId', 'String'))),
|
||||
('Struct5277', ('struct', ('location', 'Struct2685'))),
|
||||
('Array4640', ('array', (0, 'Struct5277'))),
|
||||
('Array7069', ('array', (0, 'String'))),
|
||||
( 'Struct9543',
|
||||
( 'struct',
|
||||
('semmle.formatSpecifier', 'String'),
|
||||
('semmle.sourceLanguage', 'String'))),
|
||||
('Struct2774', ('struct', ('text', 'String'))),
|
||||
( 'Struct6299',
|
||||
( 'struct',
|
||||
('endColumn', 'Int'),
|
||||
('endLine', 'Int'),
|
||||
('startColumn', 'Int'),
|
||||
('startLine', 'Int'))),
|
||||
( 'Struct4963',
|
||||
( 'struct',
|
||||
('artifactLocation', 'Struct2685'),
|
||||
('region', 'Struct6299'))),
|
||||
( 'Struct2683',
|
||||
( 'struct',
|
||||
('id', 'Int'),
|
||||
('message', 'Struct2774'),
|
||||
('physicalLocation', 'Struct4963'))),
|
||||
('Array0350', ('array', (0, 'Struct2683'))),
|
||||
( 'Struct4199',
|
||||
( 'struct',
|
||||
('primaryLocationLineHash', 'String'),
|
||||
('primaryLocationStartColumnFingerprint', 'String'))),
|
||||
('Struct3942', ('struct', ('id', 'String'), ('index', 'Int'))),
|
||||
( 'Struct4055',
|
||||
( 'struct',
|
||||
('locations', 'Array0350'),
|
||||
('message', 'Struct2774'),
|
||||
('partialFingerprints', 'Struct4199'),
|
||||
('relatedLocations', 'Array0350'),
|
||||
('rule', 'Struct3942'),
|
||||
('ruleId', 'String'),
|
||||
('ruleIndex', 'Int'))),
|
||||
('Struct0987', ('struct', ('location', 'Struct2683'))),
|
||||
('Array1075', ('array', (0, 'Struct0987'))),
|
||||
('Struct4194', ('struct', ('locations', 'Array1075'))),
|
||||
('Array1597', ('array', (0, 'Struct4194'))),
|
||||
('Struct7122', ('struct', ('threadFlows', 'Array1597'))),
|
||||
('Array9799', ('array', (0, 'Struct7122'))),
|
||||
( 'Struct9699',
|
||||
( 'struct',
|
||||
('codeFlows', 'Array9799'),
|
||||
('locations', 'Array0350'),
|
||||
('message', 'Struct2774'),
|
||||
('partialFingerprints', 'Struct4199'),
|
||||
('relatedLocations', 'Array0350'),
|
||||
('rule', 'Struct3942'),
|
||||
('ruleId', 'String'),
|
||||
('ruleIndex', 'Int'))),
|
||||
('Array6343', ('array', (1, 'Struct9699'), (0, 'Struct4055'))), # MANUALLY SORTED
|
||||
('Struct8581', ('struct', ('enabled', 'Bool'), ('level', 'String'))),
|
||||
( 'Struct7849',
|
||||
( 'struct',
|
||||
('kind', 'String'),
|
||||
('precision', 'String'),
|
||||
('security-severity', 'String'),
|
||||
('severity', 'String'),
|
||||
('sub-severity', 'String'),
|
||||
('tags', 'Array7069'))),
|
||||
( 'Struct6818',
|
||||
( 'struct',
|
||||
('defaultConfiguration', 'Struct8581'),
|
||||
('fullDescription', 'Struct2774'),
|
||||
('id', 'String'),
|
||||
('name', 'String'),
|
||||
('properties', 'Struct7849'),
|
||||
('shortDescription', 'Struct2774'))),
|
||||
('Array8754', ('array', (0, 'Struct6818'))),
|
||||
( 'Struct7820',
|
||||
( 'struct',
|
||||
('name', 'String'),
|
||||
('organization', 'String'),
|
||||
('rules', 'Array8754'),
|
||||
('version', 'String'))),
|
||||
('Struct8972', ('struct', ('driver', 'Struct7820'))),
|
||||
( 'Struct3081',
|
||||
('struct', ('repositoryUri', 'String'), ('revisionId', 'String'))),
|
||||
('Array5511', ('array', (0, 'Struct3081'))),
|
||||
( 'Struct3388',
|
||||
( 'struct',
|
||||
('artifacts', 'Array4640'),
|
||||
('columnKind', 'String'),
|
||||
('newlineSequences', 'Array7069'),
|
||||
('properties', 'Struct9543'),
|
||||
('results', 'Array6343'),
|
||||
('tool', 'Struct8972'),
|
||||
('versionControlProvenance', 'Array5511'))),
|
||||
('Array0177', ('array', (0, 'Struct3388'))),
|
||||
( 'Struct6787',
|
||||
( 'struct',
|
||||
('$schema', 'String'),
|
||||
('runs', 'Array0177'),
|
||||
('version', 'String')))]
|
||||
)
|
||||
|
||||
#
|
||||
# The starting node is the typedef with '$schema' in the struct, also the leftmost
|
||||
# node in ../notes/sarif-structure-from-sarif-to-dot.pdf
|
||||
#
|
||||
start_node_2022_02_01 = 'Struct6787'
|
||||
|
||||
#
|
||||
# Utility classes
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user