Skip to content

build: replace poetry with uv, enforce 30-day package age limit, fix vulnerable deps#54

Open
Copilot wants to merge 4 commits into
mainfrom
copilot/replace-poetry-with-uv
Open

build: replace poetry with uv, enforce 30-day package age limit, fix vulnerable deps#54
Copilot wants to merge 4 commits into
mainfrom
copilot/replace-poetry-with-uv

Conversation

Copy link
Copy Markdown

Copilot AI commented May 13, 2026

Migrates the Python dependency manager from poetry to uv and adds a supply-chain safeguard that prevents installing packages released within the last 30 days. Also fixes two vulnerable dependencies discovered as a result.

Dependency manager migration

  • Replace poetry.lock + [tool.poetry] with uv.lock + standard PEP 621 [project] table
  • Remove [build-system] section entirely — with package = false this is a scripts-only project and no build backend is ever invoked by uv
  • Set package = false (scripts-only project)

Supply chain protection

  • Add exclude-newer = "30 days" in [tool.uv] — uv refuses to resolve packages uploaded less than 30 days ago
  • The generated uv.lock records this as exclude-newer-span = "P30D"
  • Security-relevant packages can be individually exempted via exclude-newer-package

Security fixes

Package Before After Issue
cryptography 42.0.8 46.0.7 Subgroup attack on SECT curves (affects ≤46.0.4)
urllib3 2.6.3 2.7.0 Decompression-bomb bypass + sensitive header forwarding in proxied redirects (affects ≥1.23,<2.7.0)

urllib3 2.7.0 was released 2026-05-07 (within the 30-day window), so it is whitelisted as a security exception with the exemption date set to one day after the actual release to minimise the window:

[tool.uv]
exclude-newer = "30 days"
exclude-newer-package = { urllib3 = "2026-05-08" }

requires-python bumped to >=3.10 since urllib3 2.7.0 dropped Python 3.9 (EOL October 2025).

Copilot AI linked an issue May 13, 2026 that may be closed by this pull request
2 tasks
Copilot AI changed the title [WIP] Replace poetry with uv and set package age restriction build: replace poetry with uv, enforce 30-day package age limit, fix vulnerable deps May 13, 2026
Copilot AI requested a review from obrusvit May 13, 2026 13:41
@obrusvit obrusvit force-pushed the copilot/replace-poetry-with-uv branch from e6e21ed to b62171f Compare May 14, 2026 10:58
Copilot AI and others added 3 commits May 14, 2026 12:58
- cryptography: 42.0.8 → 46.0.7 (fixes subgroup attack on SECT curves,
  CVE patched in 46.0.5; 46.0.7 is >30 days old, no exclusion needed)
- urllib3: 2.6.3 → 2.7.0 (fixes decompression-bomb bypass and sensitive
  header forwarding; 2.7.0 released 2026-05-07, added exclude-newer-package
  exception as security fix whitelist)
- requires-python: >=3.9 → >=3.10 (urllib3 2.7.0 requires Python >=3.10;
  Python 3.9 reached EOL October 2025)

Agent-Logs-Url: https://github.com/trezor/definitions/sessions/4804d083-6f1f-48d6-9909-79d47760d34f

Co-authored-by: obrusvit <[email protected]>
@obrusvit obrusvit force-pushed the copilot/replace-poetry-with-uv branch from b62171f to 04f2dfd Compare May 14, 2026 10:59
@obrusvit
Copy link
Copy Markdown
Collaborator

I tried to run the ./do_update.sh command and it run correctly.

We should review 04f2dfd

@obrusvit obrusvit marked this pull request as ready for review May 14, 2026 11:00
Copilot AI review requested due to automatic review settings May 14, 2026 11:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates the Python dependency tooling from Poetry to uv, introduces a 30-day supply-chain freshness policy via exclude-newer, and upgrades two vulnerable transitive deps (cryptography 42.0.8 → 46.0.7 and urllib3 to 2.7.0, the latter whitelisted as an exception to the 30-day rule). requires-python is also bumped to >=3.10 because urllib3 2.7.0 drops Python 3.9.

Changes:

  • Replace poetry.lock / [tool.poetry] with uv.lock and a standard PEP 621 [project] table; mark package = false.
  • Add [tool.uv] exclude-newer = "30 days" with an exclude-newer-package exemption for urllib3.
  • Bump cryptography>=46.0.5,<47 and urllib3>=2.7.0,<3 to fix known CVEs; raise requires-python to >=3.10.

Reviewed changes

Copilot reviewed 1 out of 3 changed files in this pull request and generated 2 comments.

File Description
pyproject.toml Rewrites project metadata for PEP 621 / uv; adds supply-chain freshness policy and bumped security-relevant deps.
uv.lock New uv-generated lockfile recording the resolved dependency tree under the 30-day rule and the urllib3 exemption.
poetry.lock Deleted now that uv is the source of truth for resolution.

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

Comment thread pyproject.toml Outdated
Comment on lines +21 to +26
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["flit_core>=3.11,<5"]
build-backend = "flit_core.buildapi"

[tool.uv]
package = false
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done in 76a6580. Removed the [build-system] section entirely — with package = false, uv never invokes the build backend so it was dead configuration. Also tightened the urllib3 exclude-newer-package exception from 2026-05-13 to 2026-05-08 (one day after the actual 2.7.0 release date) to minimise the exemption window.

Comment thread pyproject.toml Outdated
[tool.uv]
package = false
exclude-newer = "30 days"
exclude-newer-package = { urllib3 = "2026-05-13" }
…date

- Remove [build-system] table: package=false means uv never invokes the
  build backend, making flit_core a dead dependency that would break
  non-uv tools attempting to build this scripts-only project
- Narrow urllib3 exclude-newer-package exception from 2026-05-13 to
  2026-05-08 (one day after the actual 2026-05-07 release date),
  minimising the whitelist window

Agent-Logs-Url: https://github.com/trezor/definitions/sessions/e686abb6-7faf-48a2-a71f-cdf8f2799f47

Co-authored-by: obrusvit <[email protected]>
Copilot AI requested a review from obrusvit May 14, 2026 13:47
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.

Replace poetry by uv

3 participants