Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
sethmlarson wants to merge 6 commits into python:main
base: main
Choose a base branch
Loading
from sethmlarson:detect-library-fuzzers-for-prs

Conversation

@sethmlarson
Copy link
Contributor

@sethmlarson sethmlarson commented Jan 12, 2026
edited by bedevere-app bot
Loading

Created a list of files and directories that should trigger a re-run of the python3-libraries fuzzers. Now that the Python repository is the home for this fuzzer it should be easier for Python core developers to fix issues with the fuzzer in case there are issues.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could also rename most of the "library"/"libraries"/"LIBRARY" to "stdlib"/"STDLIB" and it'd be clearer this is running on the standard library and not any third-party library code.

Copy link
Contributor Author

I think we could also rename most of the "library"/"libraries"/"LIBRARY" to "stdlib"/"STDLIB" and it'd be clearer this is running on the standard library and not any third-party library code.

I agree with this, we can change most of our uses to "stdlib" within this PR except for oss-fuzz-project-name. I can handle that in a separate PR since we'll have to wait for OSS-Fuzz maintainers to rename the project.

Copy link
Contributor Author

Thanks @StanFromIreland and @hugovk for the reviews! I've moved to a reusable workflows approach. I'll try pushing a commit modifying one of the libraries to check that the workflow fires correctly.

Comment on lines 12 to 14
permissions:
contents: read
security-events: write
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 99% sure this is required in the calling jobs in build.yml too. But maybe there's an exception for in-tree workflows. I haven't tested this in a while, though.

If jobs.<job_id>.permissions is not specified in the calling job, the called workflow will have the default permissions for the GITHUB_TOKEN.

(https://docs.github.com/en/actions/reference/workflows-and-actions/reusing-workflow-configurations#supported-keywords-for-jobs-that-call-a-reusable-workflow)

GITHUB_TOKEN permissions can only be the same or more restrictive in nested workflows. For example, in the workflow chain A > B > C, if workflow A has package: read token permission, then B and C cannot have package: write permission.

(https://docs.github.com/en/actions/reference/workflows-and-actions/reusing-workflow-configurations#access-and-permissions-for-nested-workflows)


I think, the above implies that the calling workflow should at least allow the minimum privileges needed here.

Comment on lines 642 to 647
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
permissions:
security-events: write
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
permissions:
security-events: write

(https://github.com/python/cpython/pull/143749/files#r2686916751)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, looks like it is needed the calling jobs in build.yml, because the CI didn't start:

The workflow is not valid. .github/workflows/build.yml (Line: 639, Col: 3): Error calling workflow 'python/cpython/.github/workflows/reusable-cifuzz.yml@98b701b'. The workflow is requesting 'security-events: write', but is only allowed 'security-events: none'.

https://github.com/python/cpython/actions/runs/20936855037?pr=143749

Maybe we try this smaller change to validate the permissions, before refactoring the matrix?

Copy link
Contributor Author

@sethmlarson sethmlarson Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm attempting the large matrix approach here: 3958c5d

Comment on lines 642 to 650
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: python3-libraries
Copy link
Contributor

@webknjaz webknjaz Jan 13, 2026
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though, it's probably nicer to try collapsing these into a single matrix:

Suggested change
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: cpython3
cifuzz-stdlib:
needs: build-context
if: needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: python3-libraries
if: >-
contains(
[
needs.build-context.outputs.run-ci-fuzz,
needs.build-context.outputs.run-ci-fuzz-stdlib
],
'true'
)
permissions:
security-events: write
strategy:
fail-fast: false
matrix:
sanitizer:
- address
- undefined
- memory
oss-fuzz-project-name:
- cpython3
- python3-libraries
exclude:
- oss-fuzz-project-name: >-
${{
needs.build-context.outputs.run-ci-fuzz == 'true'
&& 'dummy sentinel 🤪'
|| 'cpython3'
}}
- oss-fuzz-project-name: >-
${{
needs.build-context.outputs.run-ci-fuzz-stdlib == 'true'
&& 'dummy sentinel 🤪'
|| 'python3-libraries'
}}
uses: ./.github/workflows/reusable-cifuzz.yml
with:
oss-fuzz-project-name: ${{ matrix.oss-fuzz-project-name }}
sanitizer: ${{ matrix.sanitizer }}
timeout-minutes: 60

(an untested idea borrowed from

is-fork: # only used for the exclusion trick
- ${{ github.repository_owner != 'python' }}
free-threading:
- false
- true
exclude:
- os: ghcr.io/cirruslabs/macos-runner:sonoma
is-fork: true
- os: macos-14
is-fork: false
- os: macos-13
free-threading: true
)

Copy link
Member

hugovk commented Jan 13, 2026

(I resolved the conflict)

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <578543+webknjaz@users.noreply.github.com>
Copy link
Contributor Author

@webknjaz I'm not sure why actionlint is refusing the contains([...], 'true') syntax used, checking on the allowed function definitions it seemed like this would be allowed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hugovk hugovk hugovk left review comments

@picnixz picnixz picnixz left review comments

@StanFromIreland StanFromIreland StanFromIreland left review comments

@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

@ezio-melotti ezio-melotti Awaiting requested review from ezio-melotti ezio-melotti is a code owner

+1 more reviewer

@webknjaz webknjaz webknjaz left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /