You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/10/03 16:32:19 UTC
[whimsy] branch master updated: Try again: drop untaint,
but don't reject
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 813561c Try again: drop untaint, but don't reject
813561c is described below
commit 813561c9c4d8024348f8fde69f0d74fb66311c0d
Author: Sebb <se...@apache.org>
AuthorDate: Sat Oct 3 17:32:10 2020 +0100
Try again: drop untaint, but don't reject
It appears the matching was too strict, but was not noticed
as untaint had no effect
---
lib/whimsy/asf/svn.rb | 53 +++++++++++++++++++++++----------------------------
1 file changed, 24 insertions(+), 29 deletions(-)
diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index e0824e0..e9063dd 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -22,7 +22,7 @@ module ASF
else
svn_base = 'https://svn.apache.org/repos/'
end
- @base = URI.parse(svn_base).untaint
+ @base = URI.parse(svn_base)
@mock = 'file:///var/tools/svnrep/'
@semaphore = Mutex.new
@testdata = {}
@@ -38,7 +38,7 @@ module ASF
# subversion paths; values are file paths.
def self.repos
@semaphore.synchronize do
- svn = Array(ASF::Config.get(:svn)).map {|dir| dir.untaint}
+ svn = Array(ASF::Config.get(:svn))
# reload if repository changes
if File.exist?(REPOSITORY) && @@repository_mtime!=File.mtime(REPOSITORY)
@@ -60,7 +60,7 @@ module ASF
end
@repos = Hash[Dir[*svn].map { |name|
- if Dir.exist? name.untaint
+ if Dir.exist? name
out, _ = self.getInfoItem(name, 'url')
if out
[out.sub(/^http:/,'https:'), name]
@@ -76,7 +76,7 @@ module ASF
# set a local directory corresponding to a path in Subversion. Useful
# as a test data override.
def self.[]=(name, path)
- @testdata[name] = File.expand_path(path).untaint
+ @testdata[name] = File.expand_path(path)
end
# find a local directory corresponding to a path in Subversion. Throws
@@ -137,7 +137,7 @@ module ASF
unless url # bad entry
raise Exception.new("Unable to find url attribute for SVN entry #{name}")
end
- return (@base+url).to_s.untaint # to_s makes the var tainted
+ return (@base+url).to_s
end
# fetch a repository URL by name - abort if not found
@@ -179,7 +179,7 @@ module ASF
# recursively try parent directory
if not result and name.include? '/'
- base = File.basename(name).untaint
+ base = File.basename(name)
parent = find(File.dirname(name))
if parent and File.exist?(File.join(parent, base))
result = File.join(parent, base)
@@ -545,13 +545,13 @@ module ASF
# user and password are required because the default URL is private
def self.updateCI(msg, env, options={})
# Allow override for testing
- ciURL = options[:url] || self.svnurl('board').untaint
+ ciURL = options[:url] || self.svnurl('board')
Dir.mktmpdir do |tmpdir|
# use dup to make testing easier
- user = env.user.dup.untaint
- pass = env.password.dup.untaint
+ user = env.user.dup
+ pass = env.password.dup
# checkout committers/board (this does not have many files currently)
- out, err = self.svn('checkout', [ciURL, tmpdir.untaint],
+ out, err = self.svn('checkout', [ciURL, tmpdir],
{quiet: true, depth: 'files',
user: user, password: pass})
@@ -567,7 +567,7 @@ module ASF
File.write(file, info)
# commit the updated file
- out, err = self.svn('commit', [file, tmpdir.untaint],
+ out, err = self.svn('commit', [file, tmpdir],
{quiet: true, msg: msg,
user: user, password: pass})
@@ -600,11 +600,6 @@ module ASF
basename = File.basename(path)
end
- if path.start_with? '/' and not path.include? '..' and File.exist?(path)
- dir.untaint
- basename.untaint
- end
-
rc = 0
Dir.mktmpdir do |tmpdir|
@@ -614,7 +609,7 @@ module ASF
# retrieve the file to be updated (may not exist)
if basename
- tmpfile = File.join(tmpdir, basename).untaint
+ tmpfile = File.join(tmpdir, basename)
self.svn_('update', tmpfile, _, {env: env})
else
tmpfile = nil
@@ -657,7 +652,7 @@ module ASF
# commit the changes
rc = self.svn_('commit', tmpfile || tmpdir, _,
- {msg: msg.untaint, env: env})
+ {msg: msg, env: env})
# fail if there are pending changes
out, _err = self.svn('status', tmpfile || tmpdir) # Need to use svn rather than svn_ here
@@ -702,7 +697,7 @@ module ASF
end
temp = options[:tmpdir]
- tmpdir = temp ? temp : Dir.mktmpdir.untaint
+ tmpdir = temp ? temp : Dir.mktmpdir
begin
cmdfile = Tempfile.new('svnmucc_input', tmpdir)
@@ -719,7 +714,7 @@ module ASF
syscmd = ['svnmucc',
'--non-interactive',
- '--extra-args', cmdfile.path.untaint,
+ '--extra-args', cmdfile.path,
'--message', msg,
'--no-auth-cache',
]
@@ -755,7 +750,7 @@ module ASF
end
end
ensure
- File.delete cmdfile.path.untaint # always drop the command file
+ File.delete cmdfile.path # always drop the command file
FileUtils.rm_rf tmpdir unless temp
end
end
@@ -848,24 +843,24 @@ module ASF
# [out, extra]
# end
def self.multiUpdate_(path, msg, env, _, options = {})
- tmpdir = options[:tmpdir] || Dir.mktmpdir.untaint
+ tmpdir = options[:tmpdir] || Dir.mktmpdir
if File.file? path
- basename = File.basename(path).untaint
- parentdir = File.dirname(path).untaint
+ basename = File.basename(path)
+ parentdir = File.dirname(path)
parenturl = ASF::SVN.getInfoItem(parentdir,'url')
else
uri = URI.parse(path)
# allow file: and svn URIs for local testing
if %w(http https file svn).include? uri.scheme
- basename = File.basename(uri.path).untaint
- parentdir = File.dirname(uri.path).untaint
+ basename = File.basename(uri.path)
+ parentdir = File.dirname(uri.path)
uri.path = parentdir
parenturl = uri.to_s
else
raise ArgumentError.new("Path '#{path}' must be a file or URL")
end
end
- outputfile = File.join(tmpdir, basename).untaint
+ outputfile = File.join(tmpdir, basename)
begin
@@ -1043,8 +1038,8 @@ module ASF
# [listing-name, temporary name]
def self.listingNames(name)
dir = self.svn_parent
- return File.join(dir,"%s.txt" % name).untaint,
- File.join(dir,"%s.tmp" % name).untaint
+ return File.join(dir,"%s.txt" % name),
+ File.join(dir,"%s.tmp" % name)
end
# Get all the SVN entries