ProxymanApp / ProxymanApp/Proxyman

[BUG] Scripting Tool cannot handle URL querystring parameters containing square brackets

Open
#812 4 comments 0 reactions 1 assignee View on GitHub

@NghiaTranUIT is already working on this.

Since Mar 7, 2021.

✅ Done bug
Dominant language
No language data
Stars
7k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

Proxyman version? (Ex. Proxyman 1.4.3)

2.19.0 (21900)

macOS Version? (Ex. mac 10.14)

10.14.3

Steps to reproduce
  1. Enable SSL proxying for domain deliver.kenticocloud.com:
    1. Tools menu > SSL Proxying List.
    2. Check the Enabled SSL Proxying Tool checkbox.
    3. Add the domain deliver.kenticocloud.com to the Include List.
  2. Create a script for deliver.kenticocloud.com:
    1. Scripting menu > Script List
    2. Create a new rule, and configure it with:
      • URL = *deliver.kenticocloud.com*
      • Method = GET
      • Pattern matching = Use Wildcard
      • Leave the Include all subpaths of this URL checkbox unchecked
      • Run Script on = Response only
      • Script:
        function onResponse(context, url, request, response) {
          console.log('response.statusCode = ' + response.statusCode);
          return response;
        }
        
    3. Click the Save & Activate button.
  3. Click the Console button to open the Scripting Console.
  4. In your browser (eg: Chrome), load this URL:
    https://deliver.kenticocloud.com/5ac93d1e-567d-01e6-e3b7-ac435f77b907/items?system.id[eq]=a5f68d0f-6c6c-4845-b4d4-6bda702f0c1c
    
  5. In the Scripting Console, the following error is displayed:
    ----------------------------------
    01:23:48.444: [onResponse] with Request ID=15
    ❌Error: Couldn not build JSObject with URL=https://deliver.kenticocloud.com/5ac93d1e-567d-01e6-e3b7-ac435f77b907/items?system.id[eq]=a5f68d0f-6c6c-4845-b4d4-6bda702f0c1c
    
Expected behavior

The Scripting Console should display:

----------------------------------
01:23:48.444: [onResponse] with Request ID=15
response.statusCode = 200
01:23:48.446 onResponse() is executed!
Screenshot

image

Further details

If I remove [eq] from the URL:

- https://deliver.kenticocloud.com/5ac93d1e-567d-01e6-e3b7-ac435f77b907/items?system.id[eq]=a5f68d0f-6c6c-4845-b4d4-6bda702f0c1c
+ https://deliver.kenticocloud.com/5ac93d1e-567d-01e6-e3b7-ac435f77b907/items?system.id=a5f68d0f-6c6c-4845-b4d4-6bda702f0c1c

and then load this modified URL in Chrome, the Scripting Console displays the expected output:

----------------------------------
01:26:07.738: [onResponse] with Request ID=20
response.statusCode = 200
01:26:07.740 onResponse() is executed!

So it seems to be the [eq] querystring parameter in square brackets which is causing the Couldn not build JSObject with URL error ❌

There is some discussion online about whether square brackets should be percent-encoded ([] encoded as %5B%5D) to make a valid URL:

As an example, the Kentico Kontent Delivery API expects unencoded square brackets:

So I think Proxyman's Scripting Tool needs to be able to support unencoded square brackets in querystring parameters, without crashing with the Couldn not build JSObject with URL error.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.