-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from advanced-security/jsinglet/repo-library-i…
…ssue adding new option for default codescanning config
- Loading branch information
Showing
20 changed files
with
511 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: ⚙️ Integration Test Bundle (cpp) | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
integration-test: | ||
name: Run Bundle Integration Test | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'cpp' ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
|
||
- name: Install QLT | ||
id: install-qlt | ||
uses: ./.github/actions/install-qlt-local | ||
with: | ||
qlt-version: 'latest' | ||
add-to-path: true | ||
|
||
|
||
- name: Validate QLT Installation | ||
shell: bash | ||
run: | | ||
echo -e "Checking QLT Version:" | ||
echo "QLT Home: ${{ steps.install-qlt.outputs.qlt-home }}" | ||
qlt version | ||
- name: Create Bundle (compiled) | ||
shell: bash | ||
run: | | ||
if ! qlt codeql run install --custom-bundle --base example/ ; then | ||
echo "Failed to generate bundle." | ||
exit 1 | ||
fi | ||
# ensure bundle runs | ||
if ! qlt query run install-packs --use-bundle --base example/ ; then | ||
echo "Failed to install query packs with tool." | ||
exit 1 | ||
fi | ||
- name: Validate Bundle Existence | ||
shell: bash | ||
run: | | ||
echo "Checking Bundle Existence" | ||
ls -l ${{ env.QLT_CODEQL_HOME }}/../out/ | ||
- name: Upload Bundle Used | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: codeql-bundle.tar.gz | ||
path: | | ||
${{ env.QLT_CODEQL_BUNDLE_PATH }} | ||
if-no-files-found: error | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
tools: ${{ env.QLT_CODEQL_BUNDLE_PATH }} | ||
|
||
|
||
|
||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
with: | ||
working-directory: example/integration-tests/${{ matrix.language }}/src/ # Path containing the example application | ||
|
||
|
||
|
||
- name: Perform CodeQL Analysis | ||
id: analysis | ||
uses: github/codeql-action/analyze@v2 | ||
|
||
- name: Validate SARIF Location | ||
shell: bash | ||
run: | | ||
# validate we have the actual sarif results | ||
echo "Checking SARIF file location at: ${{ steps.analysis.outputs.sarif-output }}" | ||
ls -l ${{ steps.analysis.outputs.sarif-output }} | ||
- name: Upload SARIF Results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: actual.sarif | ||
path: | | ||
${{ steps.analysis.outputs.sarif-output }}/*.sarif | ||
if-no-files-found: error | ||
|
||
- name: Validate SARIF Existence | ||
shell: bash | ||
run: | | ||
ls -l ${{ steps.analysis.outputs.sarif-output }}/*.sarif | ||
- name: Validate SARIF Results | ||
shell: bash | ||
run: | | ||
# Compare the expected vs the actual | ||
qlt bundle run validate-integration-tests --expected example/integration-tests/${{ matrix.language }}/expected.sarif --actual ${{ steps.analysis.outputs.sarif-output }}/${{ matrix.language }}.sarif | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.17 | ||
0.0.23 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/CodeQLToolkit.Features/Bundle/Lifecycle/Targets/Actions/InitLifecycleTarget.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace CodeQLToolkit.Features.Bundle.Lifecycle.Targets.Actions | ||
{ | ||
[AutomationType(AutomationType.ACTIONS)] | ||
public class InitLifecycleTarget : BaseLifecycleTarget | ||
{ | ||
|
||
public InitLifecycleTarget() | ||
{ | ||
AutomationType = AutomationType.ACTIONS; | ||
} | ||
|
||
public override void Run() | ||
{ | ||
Log<InitLifecycleTarget>.G().LogInformation("Running init command..."); | ||
|
||
// temporarily disable the language resolution | ||
var tmpLanguage = Language; | ||
Language = null; | ||
|
||
WriteTemplateIfOverwriteOrNotExists("install-qlt", Path.Combine(Base, ".github", "actions", "install-qlt", "action.yml"), "install-qlt action"); | ||
WriteTemplateIfOverwriteOrNotExists("run-bundle-integration-tests", Path.Combine(Base, ".github", "workflows", $"run-bundle-integration-tests-{tmpLanguage}.yml"), $"Run CodeQL Unit Tests ({Language})", new | ||
{ | ||
useRunner = UseRunner, | ||
language = tmpLanguage, | ||
devMode = DevMode, | ||
}); | ||
|
||
Language = tmpLanguage; | ||
|
||
var message = @"------------------------------------------ | ||
Your repository now has the Bundle Creation and Integration Test Runner installed in `.github/workflows/`. Additionally, | ||
QLT has installed necessary actions for keeping your version of QLT and CodeQL current in `.github/actions/install-qlt`. | ||
Note that for integration testing to work, you MUST create a directory `integration-test` in the root of your repository. Please | ||
consult the QLT documentation for details on how to structure this directory. | ||
In addition to using QLT to generate your files you can also directly edit this file to fine tune its settings. | ||
(Hint: If you'd like to regenerate your files, you can use the `--overwrite-existing` option to overwrite the files that are in place now.)"; | ||
|
||
Log<InitLifecycleTarget>.G().LogInformation(message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.