Skip to content

Commit

Permalink
Cleanse the password from command line output.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew J. Erickson authored and tomlea committed Mar 22, 2011
1 parent 5e3813d commit 9190bb7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion geminabox.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'geminabox'
s.version = '0.2.11'
s.version = '0.2.12'
s.summary = 'Really simple rubygem hosting'
s.description = 'A sinatra based gem hosting app, with client side gem push style functionality.'
s.author = 'Tom Lea'
Expand Down
11 changes: 8 additions & 3 deletions lib/rubygems/commands/inabox_command.rb
@@ -1,3 +1,4 @@
require 'uri'
require 'yaml'

class Gem::Commands::InaboxCommand < Gem::Command
Expand Down Expand Up @@ -50,10 +51,14 @@ def find_gem
end

def send_gem
say "Pushing #{File.split(@gemfile).last} to #{geminabox_host}..."
# sanitize printed URL if a password is present
url = URI.parse(geminabox_host)
url_for_presentation = url.clone
url_for_presentation.password = '***' if url_for_presentation.password

say "Pushing #{File.split(@gemfile).last} to #{url_for_presentation}..."

File.open(@gemfile, "rb") do |file|
url = URI.parse(geminabox_host)
request_body, request_headers = Multipart::MultipartPost.new.prepare_query("file" => file)

proxy.start(url.host, url.port) {|con|
Expand Down Expand Up @@ -151,6 +156,6 @@ def prepare_query(params)
query = fp.collect {|p| "--" + BOUNDARY + "\r\n" + p.to_multipart }.join("") + "--" + BOUNDARY + "--"
return query, HEADER
end
end
end
end
end

0 comments on commit 9190bb7

Please sign in to comment.