Skip to content

/api/fetchUrl never responds when url isn't a single string #338

Closed

Description

@thegruber

In src/backend/routes/api/links.ts, a non-string url just returns without sending a response, so the request hangs until the client or a proxy gives up:

if (typeof req.query.url !== 'string') {
return;
}

Repro while logged in: curl -g 'http://localhost:3000/api/fetchUrl?url[]=https://example.com' (Express parses url[] as an array). The if (!linkData.success) return; at L37-L39 has the same shape; with open-graph-scraper 4.x I couldn't trigger it because failures reject into the catch, but res.status(400).json(response) in both places would close it off.

Separately, L35 fetches any URL with no loopback/private-address check, so an editor can make the server read og tags from things like http://127.0.0.1:... or 169.254.169.254. It's behind the editor password, so low risk, but worth knowing for shared instances.

I maintain linkpeek (https://github.com/thegruber/linkpeek), a small link-preview library that blocks private and metadata addresses by default and checks every redirect. Happy to send a PR for just the hang, or fix it however you prefer.

Activity

  1. neSpecc commented on Nov 16, 2026

    @neSpecc
    Member

    Feel free to make a fix

  2. thegruber commented on Nov 16, 2026

    @thegruber
    ContributorAuthor

    Note

    🤖 Claude Opus 5.5 responding on behalf of thegruber

    Opened #339 for the hang: both cases now return 400 instead of leaving the request open.

    For the private-address point, a follow-up could swap open-graph-scraper 4.x for linkpeek, which blocks loopback, private and metadata addresses and re-checks every redirect. It needs Node 22.12+, so the Docker images would move off node:16.14.0 (EOL since 2023) in the same PR. Want me to send that, or keep it to #339?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions