fix(pia): hide escaped url query values
This commit is contained in:
@@ -243,8 +243,8 @@ func fetchToken(ctx context.Context, client *http.Client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
errSubstitutions := map[string]string{
|
errSubstitutions := map[string]string{
|
||||||
username: "<username>",
|
url.QueryEscape(username): "<username>",
|
||||||
password: "<password>",
|
url.QueryEscape(password): "<password>",
|
||||||
}
|
}
|
||||||
|
|
||||||
url := url.URL{
|
url := url.URL{
|
||||||
@@ -315,7 +315,7 @@ func getOpenvpnCredentials(authFilePath string) (
|
|||||||
|
|
||||||
func fetchPortForwardData(ctx context.Context, client *http.Client, gateway net.IP, token string) (
|
func fetchPortForwardData(ctx context.Context, client *http.Client, gateway net.IP, token string) (
|
||||||
port uint16, signature string, expiration time.Time, err error) {
|
port uint16, signature string, expiration time.Time, err error) {
|
||||||
errSubstitutions := map[string]string{token: "<token>"}
|
errSubstitutions := map[string]string{url.QueryEscape(token): "<token>"}
|
||||||
|
|
||||||
queryParams := make(url.Values)
|
queryParams := make(url.Values)
|
||||||
queryParams.Add("token", token)
|
queryParams.Add("token", token)
|
||||||
@@ -376,7 +376,7 @@ func bindPort(ctx context.Context, client *http.Client, gateway net.IP, data pia
|
|||||||
queryParams := make(url.Values)
|
queryParams := make(url.Values)
|
||||||
queryParams.Add("payload", payload)
|
queryParams.Add("payload", payload)
|
||||||
queryParams.Add("signature", data.Signature)
|
queryParams.Add("signature", data.Signature)
|
||||||
url := url.URL{
|
bindPortURL := url.URL{
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Host: net.JoinHostPort(gateway.String(), "19999"),
|
Host: net.JoinHostPort(gateway.String(), "19999"),
|
||||||
Path: "/bindPort",
|
Path: "/bindPort",
|
||||||
@@ -384,11 +384,11 @@ func bindPort(ctx context.Context, client *http.Client, gateway net.IP, data pia
|
|||||||
}
|
}
|
||||||
|
|
||||||
errSubstitutions := map[string]string{
|
errSubstitutions := map[string]string{
|
||||||
payload: "<payload>",
|
url.QueryEscape(payload): "<payload>",
|
||||||
data.Signature: "<signature>",
|
url.QueryEscape(data.Signature): "<signature>",
|
||||||
}
|
}
|
||||||
|
|
||||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, url.String(), nil)
|
request, err := http.NewRequestWithContext(ctx, http.MethodGet, bindPortURL.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return replaceInErr(err, errSubstitutions)
|
return replaceInErr(err, errSubstitutions)
|
||||||
}
|
}
|
||||||
@@ -409,7 +409,7 @@ func bindPort(ctx context.Context, client *http.Client, gateway net.IP, data pia
|
|||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
}
|
}
|
||||||
if err := decoder.Decode(&responseData); err != nil {
|
if err := decoder.Decode(&responseData); err != nil {
|
||||||
return fmt.Errorf("cannot unmarshal response: from %s: %w", url.String(), err)
|
return fmt.Errorf("cannot unmarshal response: from %s: %w", bindPortURL.String(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if responseData.Status != "OK" {
|
if responseData.Status != "OK" {
|
||||||
|
|||||||
Reference in New Issue
Block a user