You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Posted by hone and zzak on 29 Mar 2014 There is an overflow in URI escape parsing of YAML in Ruby. This vulnerability has been assigned the CVE identifier CVE-2014-2525. Details Any time a string in YAML with tags is parsed, a specially crafted string can cause a heap overflow which can lead to arbitrary code execution. For example: YAML.load <code_from_unknown_source> Affected Versions Ruby 1.9.3
I'm working with the YamlDotNet library and I'm getting this error when loading a YAML file: While parsing a tag, did not find expected tag URI. The YAML file is supposed to be well-formed because it comes right from RoR. The error seems to be triggered by this code: formats: default: ! '%d-%m-%Y' long: ! '%d %B, %Y' short: ! '%d %b' I'm not an expert, but I see from the YAML spec that you can use
標準添付のcsvライブラリの使い方をいつも忘れるのでメモっておく。 require "csv" require "yaml" hash = {} csv = CSV.read(path_to_csv, headers: :first_row) csv.each do |row| id = row["id"] hash["foo_#{id}"] = { "id" => id, "name" => row["name"], "value" => row["value"] } end File.open(path_to_yaml, "w") { |f| f.write(hash.to_yaml) } :headersオプション便利。
Railsで開発してる時、config/database.ymlの内容をまとめて書きたいな、と思う事がたまにあります。あまりYAMLについてきちんと知らなかったので、勉強がてらアンカーとエイリアスについて調べてみました。 ぐだぐだ文章で書くよりも、実際のYAMLを見てもらった方が早いと思うので、まずは下記を見て下さい。 development: database: hoge_test adapter: mysql host: localhost socket: /var/lib/mysql/mysql.sock username: fuga password: encoding: utf8 test: database: hoge_test adapter: mysql host: localhost socket: /var/lib/mysql/mysql.s
RubyのYAMLRuby(1.8以上)ではYAMLライブラリが標準添付ライブラリです。 そのため、YAMLを扱うには「require 'yaml'」とするだけです。 これでYAML.load(YAML形式から読み込み)、YAML.dump(YAML形式への出力)、 さらに様々なオブジェクトで to_yaml メソッドが使えるようになります。 日本語を含むYAMLを出力しかしこのままでは、日本語文字列を含んだオブジェクトを YAMLドキュメントとして出力すると、日本語部分がバイナリ文字列になってしまいます。 これでは人間にも読みやすいというYAMLの特徴が台なしです。 # -*- coding: utf-8 -*- require 'yaml' puts YAML.dump({'あ' => 'い'}) # 【出力結果】 # --- # "\xE3\x81\x82": "\xE3\x81\x
普段考えている事やら、何やら特定のトピックは設定せずに、将来読み返す自分に向けて何か書いてゆくためのスペースです。 とはいえ書くからには再利用しやすいものを目指します。 コメントは各記事への投稿か、Google Groups "Yasundial/Yadiary Forum"へどうぞ 作成しているアプリケーションの中で設定を変更するために、YAMLデータ形式を経由してsave/restore機能を付けています。 便利に使っていたのですが、やや本気で使ってみたところ、UTF-8な日本語文字列をファイルに書き出したタイミングでエスケープされた形式になってしまう事に気がつきました。 YAML形式でファイルを書き出すsave_yamlモジュールメソッド def save_yaml(file, hash) require 'syck/encoding' open(file, "w") do |f|
Kwalify News (2010-07-18) 0.7.2 released (for Ruby) (2008-01-27) 0.7.1 released (for Ruby) (2008-01-27) 0.7.0 released (for Ruby) (2006-05-30) 0.6.0 released (for Ruby) (2005-12-20) 0.5.1 released (for Ruby and Java). (2005-12-17) 0.5.0 released. (2005-12-17) Kwalify for Java released. Introduction Kwalify is a parser, schema validator, and data binding tool for YAML and JSON. YAML and JSON are si
おはようございます、chihiroです。 弊社で開発している某ソーシャルゲームで、YAMLで書かれたゲームのマスターデータ(fixture)をExcelに出力するというタスクが生じました。 Excelにするならば、YAMLからCSVに変換して取り込むとか、あるいはExcelファイルを直接扱えるライブラリを使うといった方法が考えられます。しかし、今後プログラマではない他の社員にデータを編集してもらい、かつ編集したデータとfixtureの同期をとれるようにしておきたいところです。 そこで、以前どこかの勉強会で「管理ツールなんて自作する必要ない。Google Spreadsheet上で編集させて、必要に応じてAPIでアクセスすればいい」という話を聞いたことがあるのを思い出し、Google Spreadsheet APIを使ってGoogle Spreadsheetにデータを書き出すという方法を試し
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く