Skip to content

[FIX] Update provided scripts to use sarifv2.1.0 format as sarifv2 is deprecated and errors #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/unix/analyze_security.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ else
fi

print_yellow "\nRunning the Quality and Security rules on the project"
docker run --rm --name codeql-container -v ${inputfile}:/opt/src -v ${outputfile}:/opt/results -e CODEQL_CLI_ARGS=database\ analyze\ /opt/results/source_db\ --format=sarifv2\ --output=/opt/results/issues.sarif\ ${language}-security-and-quality.qls mcr.microsoft.com/cstsectools/codeql-container
docker run --rm --name codeql-container -v ${inputfile}:/opt/src -v ${outputfile}:/opt/results -e CODEQL_CLI_ARGS=database\ analyze\ /opt/results/source_db\ --format=sarifv2.1.0\ --output=/opt/results/issues.sarif\ ${language}-security-and-quality.qls mcr.microsoft.com/cstsectools/codeql-container
if [ $? -eq 0 ]
then
print_green "\nQuery execution successful"
Expand All @@ -67,4 +67,4 @@ else
exit 3
fi

[ $? -eq 0 ] && print_yellow "The results are saved at ${2}/issues.sarif"
[ $? -eq 0 ] && print_yellow "The results are saved at ${2}/issues.sarif"
4 changes: 2 additions & 2 deletions scripts/unix/run_ql_suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ else
fi

print_yellow "\nRunning the ${qlpack} ql pack rules on the project"
docker run --rm --name codeql-container -v ${inputfile}:/opt/src -v ${outputfile}:/opt/results -e CODEQL_CLI_ARGS=database\ analyze\ /opt/results/source_db\ --format=sarifv2\ --output=/opt/results/issues.sarif\ ${language}-${qlpack}.qls mcr.microsoft.com/cstsectools/codeql-container
docker run --rm --name codeql-container -v ${inputfile}:/opt/src -v ${outputfile}:/opt/results -e CODEQL_CLI_ARGS=database\ analyze\ /opt/results/source_db\ --format=sarifv2.1.0\ --output=/opt/results/issues.sarif\ ${language}-${qlpack}.qls mcr.microsoft.com/cstsectools/codeql-container
if [ $? -eq 0 ]
then
print_green "\nQuery execution successful"
Expand All @@ -69,4 +69,4 @@ else
exit 3
fi

[ $? -eq 0 ] && print_yellow "The results are saved at ${2}/issues.sarif"
[ $? -eq 0 ] && print_yellow "The results are saved at ${2}/issues.sarif"
2 changes: 1 addition & 1 deletion scripts/windows/analyze_security.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if %errorlevel% GTR 0 (
)

call :print_yellow "Running the Quality and Security rules on the project"
start /W /B docker run --rm --name codeql-container -v "%inputfile%:/opt/src" -v "%outputfile%:/opt/results" -e CODEQL_CLI_ARGS="database analyze /opt/results/source_db --format=sarifv2 --output=/opt/results/issues.sarif %language%-security-and-quality.qls" mcr.microsoft.com/cstsectools/codeql-container
start /W /B docker run --rm --name codeql-container -v "%inputfile%:/opt/src" -v "%outputfile%:/opt/results" -e CODEQL_CLI_ARGS="database analyze /opt/results/source_db --format=sarifv2.1.0 --output=/opt/results/issues.sarif %language%-security-and-quality.qls" mcr.microsoft.com/cstsectools/codeql-container
if %errorlevel% GTR 0 (
call :print_red "Failed to run the query on the database"
exit /b %errorlevel%
Expand Down
2 changes: 1 addition & 1 deletion scripts/windows/run_ql_suite.bat
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if %errorlevel% GTR 0 (
)

call :print_yellow "Running the %qlpack% ql pack rules on the project"
start /W /B docker run --rm --name codeql-container -v "%inputfile%:/opt/src" -v "%outputfile%:/opt/results" -e CODEQL_CLI_ARGS="database analyze /opt/results/source_db --format=sarifv2 --output=/opt/results/issues.sarif %language%-%qlpack%.qls" mcr.microsoft.com/cstsectools/codeql-container
start /W /B docker run --rm --name codeql-container -v "%inputfile%:/opt/src" -v "%outputfile%:/opt/results" -e CODEQL_CLI_ARGS="database analyze /opt/results/source_db --format=sarifv2.1.0 --output=/opt/results/issues.sarif %language%-%qlpack%.qls" mcr.microsoft.com/cstsectools/codeql-container
if %errorlevel% GTR 0 (
call :print_red "Failed to run the query on the database"
exit /b %errorlevel%
Expand Down