Unexpected output: Affected paths: relative - resubmit patch.
⚙ D492 INP-1882 - Rework URL-encoding in Debugger Report file URLs
Page MenuHomeIn-Portal Phabricator

INP-1882 - Rework URL-encoding in Debugger Report file URLs
ClosedPublic

Authored by alex on Oct 26 2024, 8:37 AM.

Details

Summary
IMPORTANT: This is a Differential Revision for In-Portal 5.3.x.
Test Plan
NOTE: The document root is the directory on a web server where the website files for a domain name are stored.

Part 1 - defaults & file:// protocol

  1. in IDE:
    • open the /system/debug.php file for editing
    • comment-out these keys in the $dbg_options array: DBG_LOCAL_BASE_PATH, DBG_EDITOR_URL
    • save changes
  2. in Admin Console
    • stay on the login screen
    • open the Debugger Report
    • use Inspect context menu entry on the 1st file editing link below an SQL query (has application.php:305 text for me)
    • confirm, that shown URL:
      • is encoded (all the / symbols in the w:/path/to/file part of URL are replaced with %2F)
      • URL-decoded version of it looks like file://w:/path/to/file:line_number (/path/to/file - path to a file starting from the Document Root of a Web Server; line_number - line number in that file)

Part 2 - phpstorm:// protocol

  1. in IDE:
    • open the /system/debug.php file for editing
    • comment-out these keys in the $dbg_options array: DBG_LOCAL_BASE_PATH
    • in the DBG_EDITOR_URL key of the $dbg_options array specify 'phpstorm://open?file=%F&line=%L'
    • save changes
  2. in Admin Console
    • stay on the login screen
    • open the Debugger Report
    • use Inspect context menu entry on the 1st file editing link below an SQL query (has application.php:305 text for me)
    • confirm, that shown URL:
      • is encoded (all the / symbols in the w:/path/to/file part of URL are replaced with %2F)
      • URL-decoded version of it looks like phpstorm://open?file=w:/path/to/file&line=line_number (/path/to/file - path to a file starting from the Document Root of a Web Server; line_number - line number in that file)

Part 3 - vscode:// protocol

  1. in IDE:
    • open the /system/debug.php file for editing
    • comment-out these keys in the $dbg_options array: DBG_LOCAL_BASE_PATH
    • in the DBG_EDITOR_URL key of the $dbg_options array specify 'vscode://file/%F:%L'
    • save changes
  2. in Admin Console
    • stay on the login screen
    • open the Debugger Report
    • use Inspect context menu entry on the 1st file editing link below an SQL query (has application.php:305 text for me)
    • confirm, that shown URL:
      • is encoded (all the / symbols in the w:/path/to/file part of URL are replaced with %2F)
      • URL-decoded version of it looks like vscode://file/w:/path/to/file:line_number (/path/to/file - path to a file starting from the Document Root of a Web Server; line_number - line number in that file)

Diff Detail

Repository
rINP In-Portal
Branch
/in-portal/branches/5.3.x
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 1314
Build 1314: arc lint + arc unit

Event Timeline

alex created this revision.Oct 26 2024, 8:37 AM
alex requested review of this revision.Oct 26 2024, 8:37 AM
alex edited the summary of this revision. (Show Details)Oct 26 2024, 8:57 AM
alex edited the test plan for this revision. (Show Details)
erik requested changes to this revision.Oct 28 2024, 7:08 AM

Part 1 - microsoft do not support such links as 'file://' (security issue), so browser does not decode it properly. Result is like "file:///" in the FireFox browser. {F669820}And like 'about:blank#blocked' when trying follow this link in the Chrome browser.

All parts - slashes in the "protocol" parts are not URL-decoded.

This revision now requires changes to proceed.Oct 28 2024, 7:08 AM
alex planned changes to this revision.Oct 28 2024, 9:13 AM
In D492#9995, @erik wrote:

Part 1 - microsoft do not support such links as 'file://' (security issue), so browser does not decode it properly. Result is like "file:///" in the FireFox browser. {F669820}And like 'about:blank#blocked' when trying follow this link in the Chrome browser.

I'm aware of the issue, that prevents file:// links from working. For that reason in D493 the file:// links are replaced with phpstorm:// links.

All parts - slashes in the "protocol" parts are not URL-decoded.

This is a problem with a test plan. I'll correct it.

alex requested review of this revision.Oct 28 2024, 9:15 AM
alex edited the test plan for this revision. (Show Details)

Test plan updated.

erik accepted this revision.Oct 28 2024, 9:17 AM
This revision is now accepted and ready to land.Oct 28 2024, 9:17 AM
This revision was automatically updated to reflect the committed changes.