Skip to content

question: file:// URLs are only half-supported by open/load — support or document as unsupported #575

Description

@platonai

Summary

file:///abs/path.html URLs are only half-supported by PulsarSession.open/load: they pass normalize, but they are not treated as local files by the driver, and support is effectively accidental.

Current behavior (verified)

  • normalize("file:///...") succeeds: AbstractPulsarContext.normalize passes strings containing :// through, and URLUtils.normalize (URIBuilder -> URI.toURL) can produce a file: URL.
  • URLUtils.isStandard("file:///...") is false because getURLOrNull2 uses OkHttp HttpUrl.parse, which only accepts http/https. Consequences:
    • CombinedUrlNormalizer drops the href for file URLs (href is only kept when isStandard).
    • Various standard-URL filters / isAllowed treat file URLs as non-standard.
  • The driver's local-file branch (PulsarWebDriver.navigateInvaded -> openLocalFile) only triggers for http://localfile.internal (URLUtils.isLocalFile is a prefix check against that host), so file:// is handed straight to PageHandler.navigate(file://...):
    • no DOM-integrity / timeout bypass that BrowserEmulatorImplBase applies to local files;
    • works for simple HTML only "by accident".
  • Note: ActionValidator.validateNavigate currently allows only http/https schemes and would block file:// if wired into the MCP dispatch (it has no callers in the current code path).

Question / proposed scope

Decide whether file:// should be officially supported:

  • If yes: make the driver's local-file detection also recognize the file:// scheme (or convert file:// to the pseudo-URL at normalize time), apply the same DOM-integrity bypass, and add unit + e2e tests.
  • If no: document file:// as unsupported and fail early at normalize with a clear error instead of half-working, and make the MCP layer's validation consistent with that decision.

References

  • AbstractPulsarContext.normalize: browser4-core/browser4-skeleton/src/main/kotlin/ai/platon/pulsar/skeleton/context/support/AbstractPulsarContext.kt
  • URLUtils.isStandard/getURLOrNull2: pulsar-common dependency
  • Driver local-file branch: pulsar-browser dependency (PulsarWebDriver.navigateInvaded -> openLocalFile)
  • BrowserEmulatorImplBase local-file handling: browser4-core/browser4-protocol/src/main/kotlin/ai/platon/pulsar/protocol/browser/emulator/impl/BrowserEmulatorImplBase.kt
  • ActionValidator: browser4-agentic/src/main/kotlin/ai/platon/pulsar/agentic/tools/util/ActionValidator.kt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions