Project

General

Profile

Actions

Bug #2223

closed

lib/delegate: security model?

Added by marcandre (Marc-Andre Lafortune) about 15 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-10-17 trunk 25379) [x86_64-darwin10.0.0]
Backport:
[ruby-core:26138]

Description

=begin
Take the following code:

require 'delegate'
cat = "cat"
dog = SimpleDelegator.new("dog")

cat.untrust
dog.untrust

lambda {$SAFE = 4; cat.upcase!}.call # ==> "CAT"
lambda {$SAFE = 4; dog.upcase!}.call # ==> Security Error

Is that expected?

Maybe #trust, #untrust, #taint and #untaint should both call 'super' and forward the call to getobj?

I'm even less sure as to what to do with #tainted? and #untrusted? for mixed cases (i.e. when self and getobj have different taintedness/trust). Disallow these cases? return "super || getobj.tainted?" ?
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0