]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #52194 - steveklabnik:remove-plugins, r=QuietMisdreavus,GuillaumeGomez
authorbors <bors@rust-lang.org>
Thu, 12 Jul 2018 04:12:19 +0000 (04:12 +0000)
committerbors <bors@rust-lang.org>
Thu, 12 Jul 2018 04:12:19 +0000 (04:12 +0000)
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

1  2 
src/librustdoc/lib.rs

diff --combined src/librustdoc/lib.rs
index 5f4739bd22276ac10247e3871a43664d573ac8fd,817b12158d6b6bee761a75eb8db33a06ab73fc3a..3e26ed2b97c23c893bb05f1f0857076a2e230c7f
@@@ -68,7 -68,6 +68,7 @@@ use rustc::session::search_paths::Searc
  use rustc::session::config::{ErrorOutputType, RustcOptGroup, Externs, CodegenOptions};
  use rustc::session::config::{nightly_options, build_codegen_options};
  use rustc_target::spec::TargetTriple;
 +use rustc::session::config::get_cmd_lint_options;
  
  #[macro_use]
  pub mod externalfiles;
@@@ -165,7 -164,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]")
                         "PASSES")
          }),
          stable("plugins", |o| {
-             o.optmulti("", "plugins", "space separated list of plugins to also load",
+             o.optmulti("", "plugins", "removed",
                         "PLUGINS")
          }),
          stable("no-default", |o| {
                         "disable-minification",
                         "Disable minification applied on JS files")
          }),
 +        unstable("warn", |o| {
 +            o.optmulti("W", "warn", "Set lint warnings", "OPT")
 +        }),
 +        unstable("allow", |o| {
 +            o.optmulti("A", "allow", "Set lint allowed", "OPT")
 +        }),
 +        unstable("deny", |o| {
 +            o.optmulti("D", "deny", "Set lint denied", "OPT")
 +        }),
 +        unstable("forbid", |o| {
 +            o.optmulti("F", "forbid", "Set lint forbidden", "OPT")
 +        }),
 +        unstable("cap-lints", |o| {
 +            o.optmulti(
 +                "",
 +                "cap-lints",
 +                "Set the most restrictive lint level. \
 +                 More restrictive lints are capped at this \
 +                 level. By default, it is at `forbid` level.",
 +                "LEVEL",
 +            )
 +        }),
      ]
  }
  
@@@ -663,8 -640,6 +663,8 @@@ where R: 'static + Send
          *x == "force-unstable-if-unmarked"
      });
  
 +    let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
 +
      let (tx, rx) = channel();
  
      rustc_driver::monitor(move || syntax::with_globals(move || {
          let (mut krate, renderinfo) =
              core::run_core(paths, cfgs, externs, Input::File(cratefile), triple, maybe_sysroot,
                             display_warnings, crate_name.clone(),
 -                           force_unstable_if_unmarked, edition, cg, error_format);
 +                           force_unstable_if_unmarked, edition, cg, error_format,
 +                           lint_opts, lint_cap, describe_lints);
  
          info!("finished with rustc");
  
              }
          }
  
+         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, ..)| {
              };
              pm.add_plugin(plugin);
          }
-         info!("loading plugins...");
-         for pname in plugins {
-             pm.load_plugin(pname);
-         }
  
          // Run everything!
          info!("Executing passes/plugins");
@@@ -776,8 -753,6 +779,6 @@@ fn check_deprecated_options(matches: &g
      let deprecated_flags = [
         "input-format",
         "output-format",
-        "plugin-path",
-        "plugins",
         "no-defaults",
         "passes",
      ];