Skip to content

build: declare the setuptools build backend floor (F-5426) - #138

Merged
ejohnstown merged 1 commit into
wolfSSL:masterfrom
MarkAtwood:fix/pin-setuptools-build-backend
Aug 3, 2026
Merged

build: declare the setuptools build backend floor (F-5426)#138
ejohnstown merged 1 commit into
wolfSSL:masterfrom
MarkAtwood:fix/pin-setuptools-build-backend

Conversation

@MarkAtwood

@MarkAtwood MarkAtwood commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problem

pyproject.toml declares setuptools as a PEP 517 build requirement with no version bound:

requires = ["setuptools", "cffi>=1.17"]

In an isolated build (the PEP 517 default), the frontend resolves whatever setuptools the index currently serves before running the backend. This repo has no uv.lock, so CI's uv build --wheel re-resolves the backend on every run.

Nothing is broken today: an unpinned resolver always picks a recent backend, so the build works. This is about declaring what the project actually requires.

Fix

requires = ["setuptools>=77", "cffi>=1.17"]

The floor is measured, not chosen. The PEP 639 license = "GPL-3.0-or-later OR LicenseRef-WolfSSL" expression and the license-files key already in this file each require setuptools >= 77 independently — 76.1.0 rejects either one on its own, while the older license = {file = ...} table form passes. So the project already had an undeclared >= 77 requirement that stayed invisible precisely because the version floated. Without this, a build environment that pins below 77 for unrelated reasons fails mid-build on an opaque project.license must be valid exactly by one definition error, with no hint that the fix is a setuptools upgrade.

No upper bound, which is a change from the first version of this PR. Reasons:

  • A ceiling does not address the reported risk. A malicious point release satisfies any range; only hash-pinned build requirements help there.
  • setuptools has shipped 7 majors since 2025-03 (81 and 82 two days apart). A ceiling needs bumping several times a year, and a stale one silently excludes working versions instead of protecting anything — this PR's original <81 already excluded the current 83.
  • Every other bound in this file is floor-only (cffi>=1.17, typing-extensions>=4.4.0).

Hash-pinning the build environment for release builds is the real mitigation for index compromise; that is out of scope here and tracked separately.

Verification

  • Builds at both 77.0.3 and 83.0.0
  • 76.1.0 correctly refused at resolve time: No solution found when resolving: setuptools>=77
  • License-Expression: GPL-3.0-or-later OR LicenseRef-WolfSSL intact in wheel METADATA
  • ruff check clean; pytest tests 196 passed, 7 skipped

Reported by static analysis (Fenrir finding F-5426).

[fenrir-sweep:released]

Copilot AI review requested due to automatic review settings July 10, 2026 00:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Pins the setuptools PEP 517 build requirement in pyproject.toml to reduce exposure to unvetted upstream changes during isolated builds.

Changes:

  • Add an explicit version range for setuptools in [build-system].requires

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml Outdated
@MarkAtwood MarkAtwood assigned MarkAtwood and unassigned wolfSSL-Bot Jul 10, 2026
@MarkAtwood
MarkAtwood marked this pull request as draft July 10, 2026 16:47
@MarkAtwood
MarkAtwood force-pushed the fix/pin-setuptools-build-backend branch from f31964d to 5ad0d0a Compare July 23, 2026 16:48
@MarkAtwood
MarkAtwood marked this pull request as ready for review July 23, 2026 16:48
[build-system] declared bare `setuptools`, so isolated builds resolved
whatever version the index served at build time. This repo has no uv.lock,
so CI's `uv build --wheel` re-resolves the backend on every run.

Declare `setuptools>=77`. Nothing was broken before this: an unpinned
resolver always fetched a recent backend, so the build worked. The floor is
measured, not chosen. The PEP 639 `license` expression and `license-files`
key already in this file each require setuptools >= 77 independently (76 and
older reject either one alone, while the older `license = {file = ...}`
table form passes), so the project had an undeclared >= 77 requirement that
stayed invisible precisely because the version floated. Declaring it keeps a
build environment pinned below 77 from failing mid-build on an opaque
`project.license` config error with no hint that the fix is an upgrade.

No upper bound, matching the floor-only convention of every other bound in
this file (`cffi>=1.17`, `typing-extensions>=4.4.0`). A ceiling would not
address the reported risk anyway -- a malicious point release satisfies any
range, so only hash-pinned build requirements help there -- and setuptools
ships majors often enough (7 since 2025-03, with 81 and 82 two days apart)
that a stale ceiling silently excludes working versions instead of
protecting anything.

Verified: builds at 77.0.3 and 83.0.0, 76.1.0 refused at resolve time,
License-Expression intact in wheel METADATA, ruff clean, 196 passed.
@MarkAtwood
MarkAtwood force-pushed the fix/pin-setuptools-build-backend branch from 5ad0d0a to ef980e4 Compare July 31, 2026 22:05
@MarkAtwood MarkAtwood changed the title build: pin setuptools build backend version build: declare the setuptools build backend floor (F-5426) Jul 31, 2026
@ejohnstown
ejohnstown merged commit e1bdcab into wolfSSL:master Aug 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants