-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143572: Run 'python3-libraries' fuzzer in CI using CIFuzz #143749
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
base: main
Are you sure you want to change the base?
Changes from all commits
2623d60
88a5b0a
55ff6a4
2a9672f
3958c5d
e657f59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -641,45 +641,44 @@ jobs: | |||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||
| "$BUILD_DIR/cross-python/bin/python3" -m test test_sysconfig test_site test_embed | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/ | ||||||||||||||||||||||||||||||
| cifuzz: | ||||||||||||||||||||||||||||||
| name: CIFuzz | ||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||
| timeout-minutes: 60 | ||||||||||||||||||||||||||||||
| needs: build-context | ||||||||||||||||||||||||||||||
| if: needs.build-context.outputs.run-ci-fuzz == 'true' | ||||||||||||||||||||||||||||||
| if: >- | ||||||||||||||||||||||||||||||
| ( | ||||||||||||||||||||||||||||||
| needs.build-context.outputs.run-ci-fuzz == 'true' | ||||||||||||||||||||||||||||||
| || needs.build-context.outputs.run-ci-fuzz-stdlib == 'true' | ||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
|
Comment on lines
+648
to
+651
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parens are redundant here:
Suggested change
|
||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||
| security-events: write | ||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||
| fail-fast: false | ||||||||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||||||||
| sanitizer: [address, undefined, memory] | ||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||
| - name: Build fuzzers (${{ matrix.sanitizer }}) | ||||||||||||||||||||||||||||||
| id: build | ||||||||||||||||||||||||||||||
| uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| oss-fuzz-project-name: cpython3 | ||||||||||||||||||||||||||||||
| sanitizer: ${{ matrix.sanitizer }} | ||||||||||||||||||||||||||||||
| - name: Run fuzzers (${{ matrix.sanitizer }}) | ||||||||||||||||||||||||||||||
| uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| fuzz-seconds: 600 | ||||||||||||||||||||||||||||||
| oss-fuzz-project-name: cpython3 | ||||||||||||||||||||||||||||||
| output-sarif: true | ||||||||||||||||||||||||||||||
| sanitizer: ${{ matrix.sanitizer }} | ||||||||||||||||||||||||||||||
| - name: Upload crash | ||||||||||||||||||||||||||||||
| if: failure() && steps.build.outcome == 'success' | ||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v6 | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| name: ${{ matrix.sanitizer }}-artifacts | ||||||||||||||||||||||||||||||
| path: ./out/artifacts | ||||||||||||||||||||||||||||||
| - name: Upload SARIF | ||||||||||||||||||||||||||||||
| if: always() && steps.build.outcome == 'success' | ||||||||||||||||||||||||||||||
| uses: github/codeql-action/upload-sarif@v4 | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| sarif_file: cifuzz-sarif/results.sarif | ||||||||||||||||||||||||||||||
| checkout_path: cifuzz-sarif | ||||||||||||||||||||||||||||||
| sanitizer: | ||||||||||||||||||||||||||||||
| - address | ||||||||||||||||||||||||||||||
| - undefined | ||||||||||||||||||||||||||||||
| - memory | ||||||||||||||||||||||||||||||
| oss-fuzz-project-name: | ||||||||||||||||||||||||||||||
| - cpython3 | ||||||||||||||||||||||||||||||
| - python3-libraries | ||||||||||||||||||||||||||||||
| exclude: | ||||||||||||||||||||||||||||||
| - oss-fuzz-project-name: >- | ||||||||||||||||||||||||||||||
| ${{ | ||||||||||||||||||||||||||||||
| needs.build-context.outputs.run-ci-fuzz == 'true' | ||||||||||||||||||||||||||||||
| && '' | ||||||||||||||||||||||||||||||
| || 'cpython3' | ||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||
| - oss-fuzz-project-name: >- | ||||||||||||||||||||||||||||||
| ${{ | ||||||||||||||||||||||||||||||
| needs.build-context.outputs.run-ci-fuzz-stdlib == 'true' | ||||||||||||||||||||||||||||||
| && '' | ||||||||||||||||||||||||||||||
|
Comment on lines
+668
to
+674
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only thing I can think of is that maybe empty strings mess up exclusions in GHA (is it possible they exclude all the matrix factors?). Let's try my initial suggestion first and go from there...
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another difference is that the original trick uses interpolation in the main matrix definition and here we use it in exclusions. |
||||||||||||||||||||||||||||||
| || 'python3-libraries' | ||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||
| uses: ./.github/workflows/reusable-cifuzz.yml | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| oss-fuzz-project-name: ${{ matrix.oss-fuzz-project-name }} | ||||||||||||||||||||||||||||||
| sanitizer: ${{ matrix.sanitizer }} | ||||||||||||||||||||||||||||||
| timeout-minutes: 60 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| all-required-green: # This job does nothing and is only used for the branch protection | ||||||||||||||||||||||||||||||
| name: All required checks pass | ||||||||||||||||||||||||||||||
|
|
@@ -735,6 +734,7 @@ jobs: | |||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||
| ${{ !fromJSON(needs.build-context.outputs.run-windows-tests) && 'build-windows,' || '' }} | ||||||||||||||||||||||||||||||
| ${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz) && 'cifuzz,' || '' }} | ||||||||||||||||||||||||||||||
| ${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz-stdlib) && 'cifuzz,' || '' }} | ||||||||||||||||||||||||||||||
| ${{ !fromJSON(needs.build-context.outputs.run-macos) && 'build-macos,' || '' }} | ||||||||||||||||||||||||||||||
| ${{ | ||||||||||||||||||||||||||||||
| !fromJSON(needs.build-context.outputs.run-ubuntu) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/ | ||
| name: Reusable CIFuzz | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| oss-fuzz-project-name: | ||
| description: OSS-Fuzz project name | ||
| required: true | ||
| type: string | ||
| sanitizer: | ||
| description: OSS-Fuzz sanitizer | ||
| required: true | ||
| type: string | ||
| timeout-minutes: | ||
| description: Timeout in minutes for the action | ||
| required: false | ||
| default: 60 | ||
| type: number | ||
|
|
||
| jobs: | ||
| cifuzz: | ||
| name: CIFuzz | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: ${{ inputs.timeout-minutes }} | ||
| steps: | ||
| - name: Build fuzzers (${{ inputs.sanitizer }}) | ||
| id: build | ||
| uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master | ||
| with: | ||
| oss-fuzz-project-name: ${{ inputs.oss-fuzz-project-name }} | ||
| sanitizer: ${{ inputs.sanitizer }} | ||
| - name: Run fuzzers (${{ inputs.sanitizer }}) | ||
| uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master | ||
| with: | ||
| fuzz-seconds: 600 | ||
| oss-fuzz-project-name: ${{ inputs.oss-fuzz-project-name }} | ||
| output-sarif: true | ||
| sanitizer: ${{ inputs.sanitizer }} | ||
| - name: Upload crash | ||
| if: failure() && steps.build.outcome == 'success' | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: ${{ inputs.sanitizer }}-artifacts | ||
| path: ./out/artifacts | ||
| - name: Upload SARIF | ||
| if: always() && steps.build.outcome == 'success' | ||
| uses: github/codeql-action/upload-sarif@v4 | ||
| with: | ||
| sarif_file: cifuzz-sarif/results.sarif | ||
| checkout_path: cifuzz-sarif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would need the same treatment as other matrices.