Skip to content

Allowed localhost when making requests - #878

Open
EvanHahn wants to merge 1 commit into
mainfrom
allow-localhost-when-making-http-requests
Open

Allowed localhost when making requests#878
EvanHahn wants to merge 1 commit into
mainfrom
allow-localhost-when-making-http-requests

Conversation

@EvanHahn

@EvanHahn EvanHahn commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

ref TryGhost/Ghost#28978 (review)

Post scheduling is broken in development because we use a localhost URL. @tryghost/request doesn't consider localhost URLs valid, so scheduling is broken.

This fixes that by allowing localhost URLs.

I was a little nervous about loosening the validation, but it's code could make requests to localhost before this change.

(I considered an alternative where Ghost development used 127.0.0.1 instead, which also fixes the problem, but that's too disruptive to development IMO.)

ref TryGhost/Ghost#28978 (review)

Post scheduling is broken in development because we use a `localhost`
URL. `@tryghost/request` doesn't consider `localhost` URLs valid, so
scheduling is broken.

This fixes that by allowing `localhost` URLs.

I was a little nervous about loosening the validation, but it's code
could make requests to `localhost` before this change.

(I considered an alternative where Ghost development used `127.0.0.1`
instead, which also fixes the problem, but that's too disruptive to
development IMO.)
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c58ddf46-8b16-49d1-8f3c-e9febe1f5d23

📥 Commits

Reviewing files that changed from the base of the PR and between b100bc6 and 8b2fca4.

📒 Files selected for processing (2)
  • packages/request/lib/request.js
  • packages/request/test/request.test.js

Walkthrough

The request URL validation now requires a string and accepts URLs supported by the default validator or localhost hosts. Tests cover overlong URLs, URLs with spaces or angle brackets, and successful requests to localhost:2368.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely states the main change: allowing localhost URLs in requests.
Description check ✅ Passed The description explains the localhost validation change and its effect on development post scheduling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch allow-localhost-when-making-http-requests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.80%. Comparing base (b100bc6) to head (8b2fca4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #878      +/-   ##
==========================================
- Coverage   97.79%   96.80%   -0.99%     
==========================================
  Files         105       14      -91     
  Lines        3405      658    -2747     
  Branches      604      116     -488     
==========================================
- Hits         3330      637    -2693     
+ Misses         24        8      -16     
+ Partials       51       13      -38     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cmraible

cmraible commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Just a heads up that I likely won't have time to review this today. Happy to take a look tomorrow/Thursday. I don't think it's urgent, but let me know if you disagree.

EvanHahn commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, not urgent at all. No rush.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants