Skip to content

[codex] Preserve custom ports in signed local file URLs - #2167

Open
shuaick wants to merge 1 commit into
OpenSignLabs:stagingfrom
shuaick:fix-custom-port-file-urls
Open

[codex] Preserve custom ports in signed local file URLs#2167
shuaick wants to merge 1 commit into
OpenSignLabs:stagingfrom
shuaick:fix-custom-port-file-urls

Conversation

@shuaick

@shuaick shuaick commented May 8, 2026

Copy link
Copy Markdown

Summary

  • normalize local /files/... URLs against SERVER_URL before signing them
  • preserve the configured host and port for both fresh and already-signed local file URLs
  • add regression coverage for custom-port local file URL signing

Root cause

Local file URLs could be signed using a URL that did not carry the deployment port from SERVER_URL. In self-hosted deployments on a custom port, that caused generated file links to fall back to the default origin and break document flows.

Validation

  • direct Node assertions for normalizeLocalFileUrl
  • direct Node assertions for getSignedLocalUrl
  • direct Node assertions for presignedlocalUrl

Notes

I could not run the full npm test suite in this local Windows environment because the repo's npm/test workflow hit EPERM restrictions during process spawn.

Local file links could be returned without the configured deployment port, which breaks uploads and document flows on self-hosted instances that expose OpenSign on a custom port.

This normalizes local /files URLs against SERVER_URL before signing them, and adds regression coverage for both fresh and already-signed local file URLs.

Constraint: Must preserve existing signed URL flows for non-local storage backends
Rejected: Rebuild file URLs in each frontend caller | too many call sites and it would leave backend-generated links inconsistent
Confidence: medium
Scope-risk: narrow
Reversibility: clean
Directive: Keep local file URL normalization tied to SERVER_URL so deployment origin changes stay centralized
Tested: Direct Node assertions for normalizeLocalFileUrl, getSignedLocalUrl, and presignedlocalUrl with a custom-port SERVER_URL
Not-tested: Full OpenSignServer jasmine suite in this environment (npm test runner hits local Windows EPERM restrictions)
@vercel

vercel Bot commented May 8, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the prafull 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@shuaick
shuaick marked this pull request as ready for review May 8, 2026 12:35

shuaick commented May 8, 2026

Copy link
Copy Markdown
Author

Hi maintainers, this PR fixes #1936.

Root cause: local /files/... URLs could be signed without preserving the configured port from SERVER_URL, which breaks self-hosted deployments running on a custom port.

This change normalizes local file URLs against SERVER_URL before signing them, and adds regression coverage for both fresh and already-signed local file URLs.

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

Labels

None yet

1 participant