Skip to content
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

Private sparse registry false positive #507

Closed
Sculas opened this issue Apr 7, 2023 · 3 comments · Fixed by #511
Closed

Private sparse registry false positive #507

Sculas opened this issue Apr 7, 2023 · 3 comments · Fixed by #511
Labels
bug Something isn't working

Comments

@Sculas
Copy link

Sculas commented Apr 7, 2023

Describe the bug
I have a private Cargo sparse registry. I've added the registry in .cargo/config.toml, and then used it in my Cargo.toml file like this:

# .cargo/config.toml
[registries]
example-internal = { index = "sparse+https://example.com/example/crates/" }

# Cargo.toml
[dependencies]
mylib = { version = "1", registry = "example-internal" }
# ...

I have my sources setup like this:

[sources]
unknown-registry = "deny"
allow-registry = [
    "https://github.com/rust-lang/crates.io-index",
    "sparse+https://example.com/example/crates/",
]

However, when running cargo deny check, I get these errors:

error[source-not-allowed]: detected 'registry' source not explicitly allowed
    ┌─ example\Cargo.lock:257:9

257 │ mylib 1.0.0 sparse+https://example.com/example/crates/
    │             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source

    = mylib v1.0.0
      └── (dev) example v0.1.0

warning[unmatched-source]: allowed source was not encountered
   ┌─ example\deny.toml:23:5

23 │     "sparse+https://example.com/example/crates/",
   │     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no crate source matched these criteria

advisories ok, bans ok, licenses ok, sources FAILED

To Reproduce
The information provided above should be enough, but you'll need to find a sparse registry to reproduce it.

Expected behavior
It should pass without any problems because the sources have been set up correctly.

Device:

  • OS: Windows 11 22H2
  • Version: d37423a
@Sculas Sculas added the bug Something isn't working label Apr 7, 2023
@Jake-Shadle
Copy link
Member

Try removing the sparse+ prefix.

@Sculas
Copy link
Author

Sculas commented Apr 7, 2023

Try removing the sparse+ prefix.

That seems to fix it. Should I keep this issue open?
If this is a wontfix, I think at least it should be documented that the sparse+ prefix must be removed.

@Jake-Shadle
Copy link
Member

I guess I need to, I just didn't think it would be an issue since the regular git registry doesn't have the registry+ prefix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants