1
Fork 0

Auto merge of #52194 - steveklabnik:remove-plugins, r=QuietMisdreavus,GuillaumeGomez

Remove rustdoc's plugins feature

This fixes CVE-2018-1000622.

https://cve.mitre.org/cgi-bin/cvename.cgi?name=%20CVE-2018-1000622

r? @QuietMisdreavus @GuillaumeGomez
This commit is contained in:
bors 2018-07-12 04:12:19 +00:00
commit c946c2539e
2 changed files with 12 additions and 58 deletions

View file

@ -165,7 +165,7 @@ pub fn opts() -> Vec<RustcOptGroup> {
o.optmulti("", "extern", "pass an --extern to rustc", "NAME=PATH")
}),
stable("plugin-path", |o| {
o.optmulti("", "plugin-path", "directory to load plugins from", "DIR")
o.optmulti("", "plugin-path", "removed", "DIR")
}),
stable("C", |o| {
o.optmulti("C", "codegen", "pass a codegen option to rustc", "OPT[=VALUE]")
@ -178,7 +178,7 @@ pub fn opts() -> Vec<RustcOptGroup> {
"PASSES")
}),
stable("plugins", |o| {
o.optmulti("", "plugins", "space separated list of plugins to also load",
o.optmulti("", "plugins", "removed",
"PLUGINS")
}),
stable("no-default", |o| {
@ -741,9 +741,16 @@ where R: 'static + Send,
}
}
if !plugins.is_empty() {
eprintln!("WARNING: --plugins no longer functions; see CVE-2018-1000622");
}
if !plugin_path.is_none() {
eprintln!("WARNING: --plugin-path no longer functions; see CVE-2018-1000622");
}
// Load all plugins/passes into a PluginManager
let path = plugin_path.unwrap_or("/tmp/rustdoc/plugins".to_string());
let mut pm = plugins::PluginManager::new(PathBuf::from(path));
let mut pm = plugins::PluginManager::new();
for pass in &passes {
let plugin = match passes::PASSES.iter()
.position(|&(p, ..)| {
@ -757,10 +764,6 @@ where R: 'static + Send,
};
pm.add_plugin(plugin);
}
info!("loading plugins...");
for pname in plugins {
pm.load_plugin(pname);
}
// Run everything!
info!("Executing passes/plugins");
@ -776,8 +779,6 @@ fn check_deprecated_options(matches: &getopts::Matches, diag: &errors::Handler)
let deprecated_flags = [
"input-format",
"output-format",
"plugin-path",
"plugins",
"no-defaults",
"passes",
];