14

添加 vcr gem 后运行 rspec 时出现以下错误。简单地gem install psych -- --enable-bundled-libyaml按照建议运行并不能解决问题。我正在使用 rbenv 和 ruby​​-build,我使用的是 ruby​​ 2.1.1。我该怎么做才能解决这个问题?

SafeYAML Warning
  ----------------

  You appear to have an outdated version of libyaml (0.1.4) installed on your system.

  Prior to 0.1.6, libyaml is vulnerable to a heap overflow exploit from malicious YAML payloads.

  For more info, see:
  https://www.ruby-lang.org/en/news/2014/03/29/heap-overflow-in-yaml-uri-escape-parsing-cve-2014-2525/

  The easiest thing to do right now is probably to update Psych to the latest version and enable
  the 'bundled-libyaml' option, which will install a vendored libyaml with the vulnerability patched:

  gem install psych -- --enable-bundled-libyaml
4

5 回答 5

9

首先,你必须更新Ruby-build,他们最近已经修复了这个安全问题。现在,它安装libyaml 0.1.6以编译 Ruby。

$ rm -rf ~/.rbenv/plugins/ruby-build
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

重新编译,重新安装Ruby您正在使用的版本,2.0.0-p451在我的情况下:

$ rbenv install 2.0.0-p451
rbenv: /home/ubuntu/.rbenv/versions/2.0.0-p451 already exists
continue with installation? (y/N) y
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
...

它在我的情况下有效。

于 2014-04-08T22:15:41.290 回答
4

我只是按照此回复https://stackoverflow.com/a/9510209/816002中的说明进行操作,它似乎已经成功了。然而,我做的略有不同:

rvm pkg install libyaml
rvm get stable
rvm reinstall all --force

如果您使用的是系统 Ruby,这可能无济于事,并且显然与rbenv.

于 2014-04-07T19:14:14.673 回答
3

作为 rvm 的用户,我设法通过构建libyaml的 0.1.6 版本,然后(重新)安装 Ruby,传递以下配置标志来设置玩球

rvm install 1.9.3 -- --with-libyaml-dir=/usr/local

希望这在短期内对人们有所帮助,直到尘埃落定。

于 2014-04-11T13:17:47.740 回答
0

如果您使用的是 Mac OS X / Mavericks,那么您可能正在系统安装的 Ruby 上运行。Thoughbot 鼓励您不要这样做。我也遇到了这个问题,所以我按照他们的建议安装了brewrbenv问题就消失了。

于 2014-04-20T04:00:49.503 回答
0

对于 rvm 这对我有用:

rvm pkg install libyaml
$LIBYAML_PATH will be the path where RVM installs the upated yaml
rvm get stable
rvm reinstall all --force --with-libyaml-dir=$LIBYAML_PATH

http://synaptian.com/2014/04/fixing-the-safeyaml-warning-on-ubuntu-12-04-with-rvm/

于 2015-10-15T11:33:08.600 回答