Skip to content

Commit

Permalink
Fixes #32192 - Handle special characters in HTTP proxy credentials
Browse files Browse the repository at this point in the history
Originally we tried to using user provided credentials verbatim, leading to
errors when they contained special characters. This is resolved by escaping them
first.
  • Loading branch information
adamruzicka committed Mar 24, 2021
1 parent 47163de commit 2b8d7ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/models/http_proxy.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'cgi'

class HttpProxy < ApplicationRecord
audited
include Authorizable
Expand Down Expand Up @@ -31,8 +33,10 @@ class HttpProxy < ApplicationRecord

def full_url
uri = URI(url)
uri.user = username if username.present?
uri.password = password if username.present?
if username.present?
uri.user = CGI.escape(username)
uri.password = CGI.escape(password)
end
uri.to_s
end

Expand Down

0 comments on commit 2b8d7ae

Please sign in to comment.