2004-09-25 (Sat)
_ [Ruby] $SAFEと拡張ライブラリ
拡張ライブラリでは、$SAFEが考慮されてないことが多いので、
require "postgres"
require "readline"
$SAFE = 4
conn = PGconn.connect("localhost", 5432, "","","dbname", "username")
Readline.readline(conn.exec("select current_timestamp")[0][0] + "\n")'
出力結果:
2004-09-25 01:44:34.247251+09
なんてことができてしまう。
C API(rb_define_method()とか)で定義したメソッドは、 デフォルトで、$SAFE >= 4では実行不可にしてしまうというのはどうだろう。
[ツッコミを入れる]
[TrackBack URL: http://shugo.net/jit/tb.rb/20040925]
本日のリンク元
- http://28.xoxoya.com/sokonekai/index.html ×6
- http://search.live.com/results.aspx?q=callcc&mrt=e... ×4
- http://mixi.jp/home.pl ×3
- http://blog.drecom.jp/FFF/category_4/ ×2
- http://caojon.seesaa.net/article/419493.html ×2
- http://search.live.com/results.aspx?q=rails&mrt=en... ×2
- http://mput.dip.jp/mput/?date=20040928 ×1
- ただのにっき(2004-08-13) ×1
- http://209.85.173.104/search?q=cache:GUCzjtUoPTEJ:... ×1
- http://aolsearch.aol.com/aol/search?encquery=2B9A1... ×1
- http://sbs.mobile.yahoo.co.jp/union/search?fr=m_to... ×1
- http://209.85.175.104/search?q=cache:GUCzjtUoPTEJ:... ×1
- http://search.live.com/results.aspx?q=search&mrt=e... ×1
- http://www.izu.co.jp/~kawarama/ ×1
- http://namazu.org/~satoru/diary/20030421.html ×1
- http://search.live.com/results.aspx?q=search ×1
- http://sbs.mobile.yahoo.co.jp/p/sbs/mobilesite/sea... ×1
- http://sbs.mobile.yahoo.co.jp/p/sbs/mobilesite/sea... ×1
