summaryrefslogtreecommitdiff
path: root/test/win32ole/test_win32ole.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/win32ole/test_win32ole.rb')
-rw-r--r--test/win32ole/test_win32ole.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb
index 71026d48c6..b41fd591fe 100644
--- a/test/win32ole/test_win32ole.rb
+++ b/test/win32ole/test_win32ole.rb
@@ -169,6 +169,33 @@ if defined?(WIN32OLE)
}
end
+ def test_s_new_exc_svr_tainted
+ th = Thread.start {
+ $SAFE = 1
+ svr = "Scripting.Dictionary"
+ svr.taint
+ WIN32OLE.new(svr)
+ }
+ exc = assert_raise(SecurityError) {
+ th.join
+ }
+ assert_match(/insecure object creation - `Scripting.Dictionary'/, exc.message)
+ end
+
+ def test_s_new_exc_host_tainted
+ th = Thread.start {
+ $SAFE = 1
+ svr = "Scripting.Dictionary"
+ host = "localhost"
+ host.taint
+ WIN32OLE.new(svr, host)
+ }
+ exc = assert_raise(SecurityError) {
+ th.join
+ }
+ assert_match(/insecure object creation - `localhost'/, exc.message)
+ end
+
def test_s_new_DCOM
rshell = WIN32OLE.new("Shell.Application")
assert_instance_of(WIN32OLE, rshell)
@@ -194,6 +221,19 @@ if defined?(WIN32OLE)
}
end
+ def test_s_coonect_exc_tainted
+ th = Thread.start {
+ $SAFE = 1
+ svr = "winmgmts:"
+ svr.taint
+ WIN32OLE.connect(svr)
+ }
+ exc = assert_raise(SecurityError) {
+ th.join
+ }
+ assert_match(/insecure connection - `winmgmts:'/, exc.message)
+ end
+
def test_invoke_accept_symbol_hash_key
fso = WIN32OLE.new('Scripting.FileSystemObject')
afolder = fso.getFolder(".")