advanced-security / dart-analyzer-sarif Goto Github PK
View Code? Open in Web Editor NEWConvert `dart analyze` CLI output into SARIF
License: MIT License
Convert `dart analyze` CLI output into SARIF
License: MIT License
Consider converting severity info
to note
?
Sample app secDevLabs
dart analyze
output contains both error
and info
(no warning
in my sample - but also a supported level)
error - lib/views/auth_screen.dart:59:7 - The named parameter 'resizeToAvoidBottomPadding' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'resizeToAvoidBottomPadding'. - undefined_named_parameter
info - lib/models/session_token.dart:2:10 - Name non-constant identifiers using lowerCamelCase. - non_constant_identifier_names
...
Converted Sarif: cool_games.zip
{
"level": "info",
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "lib/models/session_token.dart",
"uriBaseId": "SRCROOT"
},
"region": {
"startLine": 2,
"startColumn": 10
}
}
}
],
"message": {
"text": "Name non-constant identifiers using lowerCamelCase."
},
"ruleId": "non_constant_identifier_names"
},
Code Scanning error:
Error: Unable to upload "owasp-top10-2016-mobile/m2/cool_games/mobile/dart_analyze.sarif" as it is not valid SARIF:
- instance.runs[0].results[1].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[2].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[3].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[4].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[5].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[6].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[7].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[8].level is not one of enum values: none,note,warning,error
Error: Unable to upload "owasp-top10-2016-mobile/m2/cool_games/mobile/dart_analyze.sarif" as it is not valid SARIF:
- instance.runs[0].results[1].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[2].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[3].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[4].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[5].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[6].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[7].level is not one of enum values: none,note,warning,error
- instance.runs[0].results[8].level is not one of enum values: none,note,warning,error
at validateSarifFileSchema (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-lib.js:201:15)
at uploadFiles (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-lib.js:251:9)
at Object.uploadFromActions (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-lib.js:137:18)
at async run (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-sarif-action.js:48:30)
at async runWrapper (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-sarif-action.js:70:9)
when running dart analyze on a sub directory: the path used in the output relative to the directory working directory being scanned... ex: dart analyze path/to/app
run with files in directory path/to/app/lib/...
will have output:
error - lib/views/auth_screen.dart:59:7 - The named parameter 'resizeToAvoidBottomPadding' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'resizeToAvoidBottomPadding'. - undefined_named_parameter
info - lib/models/session_token.dart:2:10 - Name non-constant identifiers using lowerCamelCase. - non_constant_identifier_names
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- name: Dart Analyze
run: dart analyze path/to/app > dart_analyze.txt || true
- name: Dart Analyze to SARIF
uses: advanced-security/dart-analyzer-sarif@main
with:
input: dart_analyze.txt
output: dart_analyze.sarif
# This tools allows users to update broken SARIF files that have relative paths that aren't based on the root GitHub Repository folder.
- uses: advanced-security/sarif-toolkit/relativepaths@main
with:
# SARIF File / Directory location
sarif: "./dart_analyze.sarif"
# Working Directory (sub folder of the working directory)
working: "path/to/app"
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: dart_analyze.sarif
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.