Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with custom Public Gateway URL http://ip:port #2313

Open
2 tasks done
waseemjaved755 opened this issue Jan 12, 2025 · 6 comments · May be fixed by #2318
Open
2 tasks done

error with custom Public Gateway URL http://ip:port #2313

waseemjaved755 opened this issue Jan 12, 2025 · 6 comments · May be fixed by #2318
Assignees
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@waseemjaved755
Copy link

Checklist

Location

No response

Description

356790404-fe3cf2ef-30ed-4c8f-ba73-ee9f2f6d4e07

@waseemjaved755 waseemjaved755 added the need/triage Needs initial labeling and prioritization label Jan 12, 2025
@lidel lidel transferred this issue from ipfs/kubo Jan 14, 2025
@lidel lidel added the kind/bug A bug in existing code (including security flaws) label Jan 14, 2025
@ipfs ipfs deleted a comment from welcome bot Jan 14, 2025
@lidel
Copy link
Member

lidel commented Jan 14, 2025

@SgtPooki thoughts? looks likecustomizing gateway via Settings Screen input loses port info?

@SgtPooki
Copy link
Member

it does look like port is being dropped @lidel I can look into this

@SgtPooki SgtPooki self-assigned this Jan 17, 2025
@SgtPooki
Copy link
Member

definitely dropping the port, error is here:

imgSubdomainUrl = new URL(`${gwUrl.protocol}//${IMG_HASH_1PX}.ipfs.${gwUrl.hostname}/?now=${Date.now()}&filename=1x1.png#x-ipfs-companion-no-redirect`)
imgRedirectedPathUrl = new URL(`${gwUrl.protocol}//${gwUrl.hostname}/ipfs/${IMG_HASH_1PX}?now=${Date.now()}&filename=1x1.png#x-ipfs-companion-no-redirect`)

@SgtPooki
Copy link
Member

SgtPooki commented Jan 17, 2025

A few things:

  1. We are currently checking that both a subdomain url will work, so IP:port from OP won't work, that's an invalid URL. see
    return await checkViaImgUrl(imgSubdomainUrl)
  2. We also check that path URLs redirect to subdomains see
    .then(async () => expectSubdomainRedirect(imgRedirectedPathUrl))

potential fixes here:

  • display an error to users if they enter an ip address with port, it is invalid
  • don't check for subdomains (wouldn't this invalidate the whole change of fix(files): prefer subdomain gw in copied share links #2255)
  • display more information in the description for this input that ip:port URLs will not work, and that the URL must support the format {protocol}://{cid}.ipfs.{host}

@lidel lidel changed the title Connection Error Refused, Specific Error error with custom Public Gateway URL http://ip:port Jan 17, 2025
@lidel
Copy link
Member

lidel commented Jan 17, 2025

Thank you for looking into this.

@waseemjaved755 seem to be using older version which had a single setting. since then we've split it into two.

I think we should:

  1. add input validation and refuse setting IP-based URL as Subdomain gateway.
  2. make sure IP-only URLs are allowed for Path gateway, but also make sure that port is respected

Image

@SgtPooki

This comment has been minimized.

@SgtPooki SgtPooki linked a pull request Jan 20, 2025 that will close this issue
@SgtPooki SgtPooki linked a pull request Jan 20, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants