[PR #2833] [MERGED] fix(javascript): exclude HTML URL suffixes from path admission #5424

Closed
opened 2026-10-31 01:06:31 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2833
Author: @shoyann
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @morluto

Base: main ← Head: fix/html-script-url-suffixes


📝 Commits (1)

  • 6b3d132 fix(javascript): exclude HTML URL suffixes from path admission

📊 Changes

2 files changed (+146 additions, -9 deletions)

View changed files

📝 src/application/javascript/JavaScriptArtifactPathResolution.ts (+10 -9)
➕ tests/acceptance/applications/javascriptHtmlUrlSuffixesCli.test.ts (+136 -0)

📄 Description

Summary

Fixes #2827. HTML script URLs such as ./app.js?redirect=%2Ffoo now resolve the existing app.js artifact instead of rejecting the query as pathname syntax. The complete original URL remains in relationship evidence.

Problem and expected behavior

Generic admission examined the full HTML declaration before HTML URL normalization removed its query and fragment. Encoded separator, dot, NUL, invalid UTF-8, or backslash bytes in suffix data could therefore suppress a valid loads relationship. Only the normalized pathname should undergo path admission; actual unsafe pathname syntax must still fail closed.

Change and scope

Delegate HTML references to their existing semantic owner before generic admission. Admit the normalized, suffix-free pathname there once, allowing an empty pathname for nonempty references and reusing the existing rejection rules. Remove the superseded second admission check. Module, Worker URL, base-path selection, and exact-resource lookup behavior remain unchanged. This is an ordinary correction within existing static reconstruction; no maintainer scope decision is required.

Contract and boundary impact

  • Semantic owner and earliest changed stage: htmlCandidate in JavaScriptArtifactPathResolution, before path admission and artifact lookup.
  • Contribution scope fit and linked maintainer decision: existing local static HTML reconstruction; separate decision not applicable.
  • CLI and MCP/tool-catalog contract: unchanged schemas; both adapters expose the corrected shared loads relationship.
  • Provider, bridge, target-format, or platform compatibility: provider-neutral HTML URL parsing; no bridge changes.
  • Evidence, artifact, provenance, or reconstruction contract: full script_path, base_href, and source location retained; only pathname bytes govern resolution.
  • Target selection, authority, upstream behavior, and cleanup details: selected local files only; target scripts are not executed; existing fixture cleanup is retained.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Only the existing local analysis reads are involved; this change adds no target execution, mutation, or networking.

Evidence and regression coverage

  • Tests added: compiled CLI and public stdio MCP journeys covering query/fragment data, URL whitespace normalization, empty path self references, local bases, preserved provenance, and unsafe actual path/base syntax.

  • Base reproduction: both new public-adapter tests fail on 9680da76c84a6833635dc7a5df607806d899f804 because the ./app.js?redirect=%2Ffoo relationship is absent.

  • User-visible output: {script_path:"./app.js?redirect=%2Ffoo", resolution_status:"rejected", resolved_path:null} becomes a loads edge with the same script declaration, resolution_status:"resolved", and resolved_path:"app.js".

  • Remaining proof gaps: no live browser execution or native provider was exercised; neither is involved in this local static path-resolution correction.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Executed on Ubuntu/WSL x64 with Node 24.18.0 and npm 11.16.0 after syncing main at c580ba9:

  • npm run test:focused on the HTML suffix CLI/MCP tests, artifact path resolver, HTML reference/resource/entrypoint tests, Worker URL tests, and CommonJS directory lookup tests — 180 tests passed across 7 files.
  • npm run test:local -- src/application/javascript/JavaScriptHtmlBaseResolution.test.ts — 36 tests passed.
  • npm run test:focused -- tests/boundary/cli/clientProfileLifecycle.test.ts tests/boundary/mcp/ghidraInventoryMcp.test.ts — 11 tests passed.
  • npm run check:ci — passed: typecheck, lint/module boundaries, formatting, knip, metadata, duplication/TODO scans, and architecture guards. Runtime compilation and the focused-test build also passed.
  • The normal pre-commit checks for the CI repair and pre-push check:fast gate passed. No push-hook bypass was needed.
  • GitHub CI for the updated head is separate from these local results.

The main sync includes the upstream Android type and Java fixture format repairs that caused the previous CI failures. A separate CI-only commit removes an inherited duplicate test import, preserves tuple inference in a client lifecycle test, and applies the pinned formatter to two upstream lines. These small gate repairs do not alter the HTML resolution behavior.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: compiled local CLI and stdio MCP on Ubuntu/WSL; native providers and a live browser are not involved.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: encoded separators/dots, NUL, and backslashes in actual pathnames remain rejected; suffix data is preserved, not decoded into a path. No new execution authority or side effects.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2833 **Author:** [@shoyann](https://github.com/shoyann) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/html-script-url-suffixes` --- ### 📝 Commits (1) - [`6b3d132`](https://github.com/morluto/rea/commit/6b3d1325ad0387f73b470d4552ad95d841eb9360) fix(javascript): exclude HTML URL suffixes from path admission ### 📊 Changes **2 files changed** (+146 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/application/javascript/JavaScriptArtifactPathResolution.ts` (+10 -9) ➕ `tests/acceptance/applications/javascriptHtmlUrlSuffixesCli.test.ts` (+136 -0) </details> ### 📄 Description ## Summary Fixes #2827. HTML script URLs such as `./app.js?redirect=%2Ffoo` now resolve the existing `app.js` artifact instead of rejecting the query as pathname syntax. The complete original URL remains in relationship evidence. ## Problem and expected behavior Generic admission examined the full HTML declaration before HTML URL normalization removed its query and fragment. Encoded separator, dot, NUL, invalid UTF-8, or backslash bytes in suffix data could therefore suppress a valid `loads` relationship. Only the normalized pathname should undergo path admission; actual unsafe pathname syntax must still fail closed. ## Change and scope Delegate HTML references to their existing semantic owner before generic admission. Admit the normalized, suffix-free pathname there once, allowing an empty pathname for nonempty references and reusing the existing rejection rules. Remove the superseded second admission check. Module, Worker URL, base-path selection, and exact-resource lookup behavior remain unchanged. This is an ordinary correction within existing static reconstruction; no maintainer scope decision is required. ## Contract and boundary impact - Semantic owner and earliest changed stage: `htmlCandidate` in `JavaScriptArtifactPathResolution`, before path admission and artifact lookup. - Contribution scope fit and linked maintainer decision: existing local static HTML reconstruction; separate decision not applicable. - CLI and MCP/tool-catalog contract: unchanged schemas; both adapters expose the corrected shared `loads` relationship. - Provider, bridge, target-format, or platform compatibility: provider-neutral HTML URL parsing; no bridge changes. - Evidence, artifact, provenance, or reconstruction contract: full `script_path`, `base_href`, and source location retained; only pathname bytes govern resolution. - Target selection, authority, upstream behavior, and cleanup details: selected local files only; target scripts are not executed; existing fixture cleanup is retained. - Generated metadata, package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. Only the existing local analysis reads are involved; this change adds no target execution, mutation, or networking. ## Evidence and regression coverage - Tests added: compiled CLI and public stdio MCP journeys covering query/fragment data, URL whitespace normalization, empty path self references, local bases, preserved provenance, and unsafe actual path/base syntax. - Base reproduction: both new public-adapter tests fail on `9680da76c84a6833635dc7a5df607806d899f804` because the `./app.js?redirect=%2Ffoo` relationship is absent. - User-visible output: `{script_path:"./app.js?redirect=%2Ffoo", resolution_status:"rejected", resolved_path:null}` becomes a `loads` edge with the same script declaration, `resolution_status:"resolved"`, and `resolved_path:"app.js"`. - Remaining proof gaps: no live browser execution or native provider was exercised; neither is involved in this local static path-resolution correction. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed Executed on Ubuntu/WSL x64 with Node 24.18.0 and npm 11.16.0 after syncing main at `c580ba9`: - `npm run test:focused` on the HTML suffix CLI/MCP tests, artifact path resolver, HTML reference/resource/entrypoint tests, Worker URL tests, and CommonJS directory lookup tests — 180 tests passed across 7 files. - `npm run test:local -- src/application/javascript/JavaScriptHtmlBaseResolution.test.ts` — 36 tests passed. - `npm run test:focused -- tests/boundary/cli/clientProfileLifecycle.test.ts tests/boundary/mcp/ghidraInventoryMcp.test.ts` — 11 tests passed. - `npm run check:ci` — passed: typecheck, lint/module boundaries, formatting, knip, metadata, duplication/TODO scans, and architecture guards. Runtime compilation and the focused-test build also passed. - The normal pre-commit checks for the CI repair and pre-push `check:fast` gate passed. No push-hook bypass was needed. - GitHub CI for the updated head is separate from these local results. The main sync includes the upstream Android type and Java fixture format repairs that caused the previous CI failures. A separate CI-only commit removes an inherited duplicate test import, preserves tuple inference in a client lifecycle test, and applies the pinned formatter to two upstream lines. These small gate repairs do not alter the HTML resolution behavior. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: compiled local CLI and stdio MCP on Ubuntu/WSL; native providers and a live browser are not involved. - Package or release metadata impact: none. - Security, privacy, process, or containment review: encoded separators/dots, NUL, and backslashes in actual pathnames remain rejected; suffix data is preserved, not decoded into a path. No new execution authority or side effects. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:06:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5424
No description provided.