Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upWhitelist rustc dependencies #48456
Conversation
rust-highfive
assigned
alexcrichton
Feb 23, 2018
This comment has been minimized.
This comment has been minimized.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
label
Feb 23, 2018
This comment has been minimized.
This comment has been minimized.
|
Hopefully, travis fails because I haven't added any files to the whitelist yet! |
This comment has been minimized.
This comment has been minimized.
|
Hmmm... It seems that it only runs stage0 tidy? How do I get my tidy to work... |
This comment has been minimized.
This comment has been minimized.
|
@mark-i-m travis...isn't failing? |
nikomatsakis
reviewed
Feb 23, 2018
|
Any idea why travis seems happy? |
| saw_dir = true; | ||
| let dir = t!(dir); | ||
|
|
||
| // skip our exceptions | ||
| for exception in EXCEPTIONS { | ||
| if dir.path() | ||
| if EXCEPTIONS.iter().any(|exception| { |
This comment has been minimized.
This comment has been minimized.
| }| { | ||
| WHITELIST | ||
| .iter() | ||
| .all(|&(wname, wversion)| name != wname || version != wversion) |
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Feb 23, 2018
Contributor
seems like it would be nice if we could report what needs to be added to the whitelist
This comment has been minimized.
This comment has been minimized.
|
Ok, it should fail now |
This comment has been minimized.
This comment has been minimized.
Lol, that's what I get for using |
This comment has been minimized.
This comment has been minimized.
|
Hmm... it looks like paths are incorrect... |
This comment has been minimized.
This comment has been minimized.
|
It looks like a spurious failure... I just want to know what path the |
This comment has been minimized.
This comment has been minimized.
|
So currently, I'm having path failures. I'm looking for a
|
kennytm
added
S-waiting-on-author
and removed
S-waiting-on-review
labels
Feb 25, 2018
This comment has been minimized.
This comment has been minimized.
|
@mark-i-m that looks like it's perhaps failing to spawn |
This comment has been minimized.
This comment has been minimized.
|
Ok, it seems to be working There are currently two variables which need to be hardcoded into tidy, though:
So we have a choice:
|
alexcrichton
reviewed
Feb 26, 2018
|
Looking good! I think it's fine to hardcode the crates to check and whitelist in the code itself. For the crates to check you can probably just probe the entire dependency graph for dependencies from crates.io starting from |
| #[allow(dead_code)] manifest_path: String, | ||
| } | ||
|
|
||
| // Not used, but needed to not confuse serde :P |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Feb 26, 2018
Member
Hm if these aren't used, are they needed? I think serde should ignore unused fields by default?
This comment has been minimized.
This comment has been minimized.
mark-i-m
Feb 26, 2018
Author
Contributor
Hmm... When I tried that it was giving me deserialization errors. I will take another look.
|
|
||
| // Whitelist of crates rustc is allowed to depend on. Avoid adding to the list if possible. | ||
| static WHITELIST: &'static [(&'static str, &'static str)] = &[ | ||
| // ("advapi32-sys", "0.2.0"), |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Feb 26, 2018
Member
I think it's probably ok to only check the name of the dependency and not worry about the version for now, upgrading across major versions and such tends to not bring in too large of a change at least!
This comment has been minimized.
This comment has been minimized.
mark-i-m
Feb 26, 2018
Author
Contributor
I argue that it's important for security purposes to whitelist exact versions and to vet those versions before before upgrading in any way.
This comment has been minimized.
This comment has been minimized.
alexcrichton
Feb 27, 2018
Member
Oh sure yeah, but I think we'll want to consider this further down the road. If we were to lock down all the versions of everything it'd cause I think picking up deps from crates.io to be too painful (or otherwise routine updates)
This comment has been minimized.
This comment has been minimized.
mark-i-m
Feb 27, 2018
Author
Contributor
I think this is part of the downside of having a super-awesome dependency system: it becomes easy to have too many dependencies. Argue that that makes code quality, security, and build times all worse.
This comment has been minimized.
This comment has been minimized.
alexcrichton
Feb 27, 2018
Member
Sure but I think it's also best to do this incrementally rather than all at once, can this switch to just verifying the names through a whitelist?
This comment has been minimized.
This comment has been minimized.
mark-i-m
Feb 27, 2018
Author
Contributor
I can if you would like, but I would really like not to. I feel like adding a bit of friction to adding and updating dependencies would be healthy; in this case, you would need to update WHITELIST. We can later have an RFC to potentially add more restrictions to PRs that change WHITELIST... I see that as an incremental approach as well (we add a mechanism, then add policy through an RFC).
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Ok, so I am now only checking the dependencies of |
alexcrichton
reviewed
Feb 27, 2018
| resolve: Resolve, | ||
|
|
||
| // Not used, but needed to not confuse serde :P | ||
| #[allow(dead_code)] packages: Vec<Package>, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
alexcrichton
reviewed
Feb 27, 2018
| unapproved.append(&mut bad); | ||
| } | ||
|
|
||
| // Remove duplicates |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Can this please remove the version checking as well? That happens anyway when |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton done Let me know what you think :) |
This comment has been minimized.
This comment has been minimized.
|
I will uncomment the whitelist itself when the build fails... |
This comment has been minimized.
This comment has been minimized.
|
Ok, I uncommented the whitelist. |
mark-i-m
changed the title
[WIP] Whitelist rustc dependencies
Whitelist rustc dependencies
Feb 27, 2018
This comment has been minimized.
This comment has been minimized.
|
Looks good to me! I think a few more deps may need to be added though? |
This comment has been minimized.
This comment has been minimized.
|
Oh, hmm... I wonder how that happened Fixed |
This comment has been minimized.
This comment has been minimized.
|
Looks like another crate is missing? Although I don't know how core got in there... |
This comment has been minimized.
This comment has been minimized.
|
Hmm... different versions of a crate may have different dependencies... I think this should be fixed now. Once again, I will wait for build failure and then enable the whitelist. |
mark-i-m
force-pushed the
mark-i-m:whitelist
branch
from
878e4d5
to
24e929d
Feb 28, 2018
mark-i-m
added some commits
Feb 23, 2018
mark-i-m
force-pushed the
mark-i-m:whitelist
branch
from
2bc27d3
to
e5d2920
Mar 5, 2018
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Hmm... I tried rebasing on the latest master, but I didn't get any conflicts locally. Do you know what's going on here? |
This comment has been minimized.
This comment has been minimized.
|
Ah yeah sometimes bors is not so good at merges... @bors: r+ |
This comment has been minimized.
This comment has been minimized.
|
|
bors
added
S-waiting-on-bors
and removed
S-waiting-on-author
labels
Mar 5, 2018
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Mar 6, 2018
This comment has been minimized.
This comment has been minimized.
|
|
mark-i-m commentedFeb 23, 2018
As per https://internals.rust-lang.org/t/rustc-dependency-policy/6537/8?u=nikomatsakis
cc @alexcrichton @nikomatsakis