-
Notifications
You must be signed in to change notification settings - Fork 335
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
Compilation error with url 2.5.3 / idna 1.0.3 with Rust < 1.81 and edition 2021 (resolver 2) when sqlx-core is in the dependency graph #992
Comments
@TotalKrill |
We are depending on url, not idna directly |
@valenting seems i was wrong about 1.81.0, seems to work there... |
Are you depending on I tried to repro on 1.80.1, and the following compiles: rustup default 1.80
cargo new --bin testurl
cd testurl
cargo add url
cargo build |
we have a workspace, but we only depend on url like this: |
running this is what our tree ends up including, with two different versions of URL included, probably by one of our other deps.
Edit: I meant version 2.5.3, 2.5.0 is the version that compiles |
The introduction of Do you somehow have |
Oh sorry, I am currently forcing our software to take 2.5.0, since 2.5.3 does not compile. Updated the previous comment to show that the cargo tree command showed 2.5.3 |
So if you have Aside: This isn't specific to idna. If I use Rust 1.80.1 with: [dependencies]
url = { version = "2.5.3", default-features = false }
idna = "1" ... |
Might fix CI failures caused by this: servo/rust-url#992. Slack thread: https://posthog.slack.com/archives/C0113360FFV/p1730722228558389
Fixes CI failures caused by this: servo/rust-url#992. Slack thread: https://posthog.slack.com/archives/C0113360FFV/p1730722228558389
yep, my edited comment stands. But with what you say, something else might be changing to |
As long as something in your dependency graph depends on @Twixes, GitHub autolinks a couple of your changesets referencing this issue. Do you have minimized steps to reproduce? |
I think |
Just felt this through my direct dependency to minimal verifiable example:
And I get the same compilation error as @TotalKrill The latest version of SQLx is (for the benefit of solution-seekers pinning to cargo --version --verbose
rustc --version --verbose
|
Interestingly, this turns out not to be true. rustup default 1.80
cargo new idna-992-repro
cd idna-992-repro/
cargo add sqlx
cargo add url
cargo check Still fails. (Note the added @domenukk why does |
We are also using sqlx, so might be through that |
|
@hsivonen I pinned |
Do you mean PostHog/posthog@5f6e5d1 fixed it for you? That's really weird. By what mechanism should that help? |
Actually you are right, the For us, the issue was with this command: By appending |
The sqlx change that added |
### Description Updated `sea-orm` and `sea-orm-migration` to `1.1.1` (latest as of opening this PR) and resolved any issues that occurred due to the version bump. ### Drive-by changes - Removed `sea-orm` from `rust/sealevel` - Updated `sea-orm-migration` data types - Bumped up the `rust-toolchain` to `1.81.0` due to `sea-orm-cli` issue: servo/rust-url#992 ### Related issues - Resolves #4793 ### Backward compatibility Yes ### Testing Manual, as described in #4793
``` error[vulnerability]: `idna` accepts Punycode labels that do not produce any non-ASCII when decoded ┌─ /home/runner/work/openrr/openrr/Cargo.lock:260:1 │ 260 │ idna 0.1.5 registry+https://github.com/rust-lang/crates.io-index │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected │ ├ ID: RUSTSEC-2024-0421 ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2024-0421 ├ `idna` 0.5.0 and earlier accepts Punycode labels that do not produce any non-ASCII output, which means that either ASCII labels or the empty root label can be masked such that they appear unequal without IDNA processing or when processed with a different implementation and equal when processed with `idna` 0.5.0 or earlier. Concretely, `example.org` and `xn--example-.org` become equal after processing by `idna` 0.5.0 or earlier. Also, `example.org.xn--` and `example.org.` become equal after processing by `idna` 0.5.0 or earlier. In applications using `idna` (but not in `idna` itself) this may be able to lead to privilege escalation when host name comparison is part of a privilege check and the behavior is combined with a client that resolves domains with such labels instead of treating them as errors that preclude DNS resolution / URL fetching and with the attacker managing to introduce a DNS entry (and TLS certificate) for an `xn--`-masked name that turns into the name of the target when processed by `idna` 0.5.0 or earlier. ## Remedy Upgrade to `idna` 1.0.3 or later, if depending on `idna` directly, or to `url` 2.5.4 or later, if depending on `idna` via `url`. (This issue was fixed in `idna` 1.0.0, but versions earlier than 1.0.3 are not recommended for other reasons.) When upgrading, please take a moment to read about [alternative Unicode back ends for `idna`](https://docs.rs/crate/idna_adapter/latest). If you are using Rust earlier than 1.81 in combination with SQLx 0.8.2 or earlier, please also read an [issue](servo/rust-url#992) about combining them with `url` 2.5.4 and `idna` 1.0.3. ## Additional information This issue resulted from `idna` 0.5.0 and earlier implementing the UTS 46 specification literally on this point and the specification having this bug. The specification bug has been fixed in [revision 33 of UTS 46](https://www.unicode.org/reports/tr46/tr46-33.html#Modifications). ## Acknowledgements Thanks to kageshiron for recognizing the security implications of this behavior. ├ Announcement: https://bugzilla.mozilla.org/show_bug.cgi?id=1887898 ├ Solution: Upgrade to >=1.0.0 (try `cargo update -p idna`) ├ idna v0.1.5 └── url v1.7.2 └── hyper v0.10.16 └── xml-rpc v0.0.12 └── rosrust v0.9.11 ├── arci-ros v0.1.0 │ ├── arci-ros-hygiene-test v0.0.0 │ └── openrr-apps v0.1.0 │ └── openrr v0.1.0 └── tf_rosrust v0.1.0 └── arci-ros v0.1.0 (*) ```
``` error[vulnerability]: `idna` accepts Punycode labels that do not produce any non-ASCII when decoded ┌─ /home/runner/work/openrr/openrr/Cargo.lock:260:1 │ 260 │ idna 0.1.5 registry+https://github.com/rust-lang/crates.io-index │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected │ ├ ID: RUSTSEC-2024-0421 ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2024-0421 ├ `idna` 0.5.0 and earlier accepts Punycode labels that do not produce any non-ASCII output, which means that either ASCII labels or the empty root label can be masked such that they appear unequal without IDNA processing or when processed with a different implementation and equal when processed with `idna` 0.5.0 or earlier. Concretely, `example.org` and `xn--example-.org` become equal after processing by `idna` 0.5.0 or earlier. Also, `example.org.xn--` and `example.org.` become equal after processing by `idna` 0.5.0 or earlier. In applications using `idna` (but not in `idna` itself) this may be able to lead to privilege escalation when host name comparison is part of a privilege check and the behavior is combined with a client that resolves domains with such labels instead of treating them as errors that preclude DNS resolution / URL fetching and with the attacker managing to introduce a DNS entry (and TLS certificate) for an `xn--`-masked name that turns into the name of the target when processed by `idna` 0.5.0 or earlier. ## Remedy Upgrade to `idna` 1.0.3 or later, if depending on `idna` directly, or to `url` 2.5.4 or later, if depending on `idna` via `url`. (This issue was fixed in `idna` 1.0.0, but versions earlier than 1.0.3 are not recommended for other reasons.) When upgrading, please take a moment to read about [alternative Unicode back ends for `idna`](https://docs.rs/crate/idna_adapter/latest). If you are using Rust earlier than 1.81 in combination with SQLx 0.8.2 or earlier, please also read an [issue](servo/rust-url#992) about combining them with `url` 2.5.4 and `idna` 1.0.3. ## Additional information This issue resulted from `idna` 0.5.0 and earlier implementing the UTS 46 specification literally on this point and the specification having this bug. The specification bug has been fixed in [revision 33 of UTS 46](https://www.unicode.org/reports/tr46/tr46-33.html#Modifications). ## Acknowledgements Thanks to kageshiron for recognizing the security implications of this behavior. ├ Announcement: https://bugzilla.mozilla.org/show_bug.cgi?id=1887898 ├ Solution: Upgrade to >=1.0.0 (try `cargo update -p idna`) ├ idna v0.1.5 └── url v1.7.2 └── hyper v0.10.16 └── xml-rpc v0.0.12 └── rosrust v0.9.11 ├── arci-ros v0.1.0 │ ├── arci-ros-hygiene-test v0.0.0 │ └── openrr-apps v0.1.0 │ └── openrr v0.1.0 └── tf_rosrust v0.1.0 └── arci-ros v0.1.0 (*) ```
``` error[vulnerability]: `idna` accepts Punycode labels that do not produce any non-ASCII when decoded ┌─ /home/runner/work/openrr/openrr/Cargo.lock:260:1 │ 260 │ idna 0.1.5 registry+https://github.com/rust-lang/crates.io-index │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected │ ├ ID: RUSTSEC-2024-0421 ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2024-0421 ├ `idna` 0.5.0 and earlier accepts Punycode labels that do not produce any non-ASCII output, which means that either ASCII labels or the empty root label can be masked such that they appear unequal without IDNA processing or when processed with a different implementation and equal when processed with `idna` 0.5.0 or earlier. Concretely, `example.org` and `xn--example-.org` become equal after processing by `idna` 0.5.0 or earlier. Also, `example.org.xn--` and `example.org.` become equal after processing by `idna` 0.5.0 or earlier. In applications using `idna` (but not in `idna` itself) this may be able to lead to privilege escalation when host name comparison is part of a privilege check and the behavior is combined with a client that resolves domains with such labels instead of treating them as errors that preclude DNS resolution / URL fetching and with the attacker managing to introduce a DNS entry (and TLS certificate) for an `xn--`-masked name that turns into the name of the target when processed by `idna` 0.5.0 or earlier. ## Remedy Upgrade to `idna` 1.0.3 or later, if depending on `idna` directly, or to `url` 2.5.4 or later, if depending on `idna` via `url`. (This issue was fixed in `idna` 1.0.0, but versions earlier than 1.0.3 are not recommended for other reasons.) When upgrading, please take a moment to read about [alternative Unicode back ends for `idna`](https://docs.rs/crate/idna_adapter/latest). If you are using Rust earlier than 1.81 in combination with SQLx 0.8.2 or earlier, please also read an [issue](servo/rust-url#992) about combining them with `url` 2.5.4 and `idna` 1.0.3. ## Additional information This issue resulted from `idna` 0.5.0 and earlier implementing the UTS 46 specification literally on this point and the specification having this bug. The specification bug has been fixed in [revision 33 of UTS 46](https://www.unicode.org/reports/tr46/tr46-33.html#Modifications). ## Acknowledgements Thanks to kageshiron for recognizing the security implications of this behavior. ├ Announcement: https://bugzilla.mozilla.org/show_bug.cgi?id=1887898 ├ Solution: Upgrade to >=1.0.0 (try `cargo update -p idna`) ├ idna v0.1.5 └── url v1.7.2 └── hyper v0.10.16 └── xml-rpc v0.0.12 └── rosrust v0.9.11 ├── arci-ros v0.1.0 │ ├── arci-ros-hygiene-test v0.0.0 │ └── openrr-apps v0.1.0 │ └── openrr v0.1.0 └── tf_rosrust v0.1.0 └── arci-ros v0.1.0 (*) ```
Edited by @hsivonen to put resolution options at the top for folks who come here:
This compilation error is due to a combination of:
url
, and from a proc macro context specifically. (Request for SQLx not to do that: Please do not turn off default features for url launchbadge/sqlx#3589)url
2.5.3 (andidna
1.0.3) conditionally raising MSRV to 1.81 when default features are off. (Fromno_std
support for theurl
crate #831)resolver = "2"
, which is implied byedition = "2021"
performing feature resolution for proc macro dependencies separately from normal dependencies, so a normal dependency onurl
with default features enabled does not cause default features to be enabled for the proc macro case.The most obvious way to resolve this compilation error is to upgrade Rust to 1.81 or later. (If you are using SQLx 0.8.x, your Rust version has to already be 1.79 or later, so it's not a big jump.)
Alternative resolution without upgrading Rust:
resolver = "1"
in the[workspace]
section of your top-levelCargo.toml
. If there's no such section yet, create a[workspace]
section at the top of your top-levelCargo.toml
.url
with default features enabled somewhere in your dependency graph, addurl = "2.5.3"
to the[dependencies]
section of one of your crates (the top-level is the most obvious place, but it does not have to be on the top level).(Conditionally raising MSRV to 1.81 is not a semver break, because raising MSRV isn't a semver break.)
Original report follows:
Describe the bug
After update to v1.0.3 wich is picked up automatically since its a patch upgrade, our code no longer compiles the same.
rust versions tested:
The text was updated successfully, but these errors were encountered: