[Hiki-dev:00525] history プラグインが $SAFE=1 で動作しない

Back to archive index

Kouhei Sutou kou****@cozmi*****
2004年 4月 7日 (水) 11:47:49 JST


須藤です.

historyプラグインがDir.chdirと,svn/cvsを起動するKernel#`の
ところでInsecure operationになります.

Kernel#`の引数は,どこでuntaintするのがよいのかわかりません
が,こんな感じでいかがでしょうか?
-------------- next part --------------
Index: misc/plugin/history.rb
===================================================================
RCS file: /cvsroot/hiki/hiki/misc/plugin/history.rb,v
retrieving revision 1.2
diff -u -p -r1.2 history.rb
--- misc/plugin/history.rb	1 Mar 2004 09:50:45 -0000	1.2
+++ misc/plugin/history.rb	7 Apr 2004 02:31:50 -0000
@@ -123,7 +123,7 @@ module Hiki
     # Subroutine to invoke external command using `` sequence.
     def history_exec_command (cmd_string)
       cmdlog = ''
-      oldpwd = Dir.pwd
+      oldpwd = Dir.pwd.untaint
       begin
 	Dir.chdir( "#{$pages_path}" )
 	# うーん... まあとりあえず。
@@ -164,9 +164,9 @@ module Hiki
       # make command string
       case history_repos_type
       when 'cvs'
-	hstcmd = "cvs -Q -d #{history_repos_root} log #{@p.escape}"
+	hstcmd = "cvs -Q -d #{history_repos_root} log #{@p.escape.untaint}"
       when 'svn'
-	hstcmd = "svn log #{@p.escape}"
+	hstcmd = "svn log #{@p.escape.untaint}"
       else
 	return history_output(history_not_supported_label)
       end


Hiki-dev メーリングリストの案内
Back to archive index