This repository was archived by the owner on Apr 7, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
jWebUnit/fitplugin/rubywiki Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212LINK = "[A-Z][a-z0-9]+([A-Z][a-z0-9]+)+"
1313
14- datedpages = Dir . entries ( 'pages' ) . select { |e | e =~ /#{ LINK } / }
14+ datedpages = Dir . entries ( 'pages' ) . select { |e | e . untaint =~ /#{ LINK } / }
1515datedpages . map! { |e | [ File . mtime ( "pages/#{ e } " ) , e ] }
1616datedpages . sort! { |a , b | b [ 0 ] <=> a [ 0 ] }
1717
Original file line number Diff line number Diff line change 1313LINK = "[A-Z][a-z0-9]+([A-Z][a-z0-9]+)+" ;
1414MARK = "\263 " ;
1515page = ENV [ 'QUERY_STRING' ] =~ /^(#{ LINK } )$/ ? $1 : "WelcomeVisitors" # $& is the last match
16+ page . untaint
1617mode = $_ =~ /append/ ##??????
1718puts "<!-- #{ mode . inspect } -->"
1819
Original file line number Diff line number Diff line change 1313
1414LINK = "([A-Z][a-z0-9]+([A-Z][a-z0-9]+)+)" ;
1515
16- files = Dir . entries ( 'pages' ) . select { |e | e =~ /#{ LINK } / } . sort!
16+ files = Dir . entries ( 'pages' ) . select { |e | e . untaint =~ /#{ LINK } / } . sort!
1717
1818refs = { }
1919all_targets = [ ]
Original file line number Diff line number Diff line change 1212LINK = "[A-Z][a-z0-9]+([A-Z][a-z0-9]+)+" ;
1313
1414page = ENV [ 'QUERY_STRING' ] =~ /^(#{ LINK } )$/ ? $1 : "WelcomeVisitors" # $& is the last match
15-
15+ page . untaint
1616params = CGI . new . params
1717bodyHash = { }
1818params . each { |k , v |
4444
4545File . open ( "pages/#{ page } " , mode ) { |f | f . print s }
4646
47- require 'wiki.rb' # maybe work?
47+
48+ require './wiki.rb' # maybe work?
4849
4950#my %par;
5051#$par{title} = "Thank You";
Original file line number Diff line number Diff line change 1414LINK = "[A-Z][a-z0-9]+([A-Z][a-z0-9]+)+"
1515
1616ENV [ 'QUERY_STRING' ] =~ /search=([^\& ]*)/
17- target = $1
17+ target = $1. untaint
1818target . gsub! ( /\+ / , ' ' )
1919target . gsub! ( /\% (..)/ ) { [ $1. hex ] . pack ( 'C' ) }
2020
3030 </form>
3131EOF
3232
33- files = Dir . entries ( 'pages' ) . select { |e | e =~ /#{ LINK } / } . sort!
33+ files = Dir . entries ( 'pages' ) . select { |e | e . untaint =~ /#{ LINK } / } . sort!
3434
3535hits = 0
3636files . each do |file |
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ def inPlaceUrl(origRef)
145145print "Content-type: text/html\n \n "
146146
147147page = ENV [ 'QUERY_STRING' ] =~ /^(#{ LINK } )$/ ? $1 : "WelcomeVisitors" # $& is the last match
148-
148+ page . untaint
149149par = { }
150150par [ 'page' ] = page
151151par [ 'title' ] = page . gsub ( /(.)([A-Z])/ , '\1 \2' )
@@ -166,7 +166,7 @@ def inPlaceUrl(origRef)
166166end
167167
168168par [ 'summary' ] = " -- Last edited #{ date } " if date
169- par [ 'body' ] = formatBody ( body )
169+ par [ 'body' ] = formatBody ( body . untaint )
170170par [ 'action' ] = <<-BLAH
171171<form method=post action="edit.rb?#{ page } ">
172172<input type=submit value=" Edit ">
You can’t perform that action at this time.
0 commit comments