santifer/career-ops · error · Error
himalayas: invalid URL: ${url}
Error message
himalayas: invalid URL: ${url} What it means
Thrown by assertHimalayasUrl when new URL(url) throws — the supplied string is not a parseable absolute URL. In the shipped code assertHimalayasUrl is only ever called with the hardcoded constant FEED_URL ('https://himalayas.app/jobs/api?limit=50'), which always parses, so from the public contract this branch is effectively unreachable. It exists as an SSRF defense-in-depth guard: it would fire if the FEED_URL constant is edited to a malformed string, or if the function is reused to validate caller-supplied URLs.
Source
Thrown at providers/himalayas.mjs:20
/** @typedef {import('./_types.js').Provider} Provider */
// Himalayas provider - board-wide remote jobs API
// (https://himalayas.app/jobs/api?limit=50). Returns { jobs: [...] }. The
// full feed is fetched so scan.mjs's title_filter / location_filter can do
// the local gating consistently with other zero-token board providers.
//
// Wire in via a `job_boards:` entry with `provider: himalayas`.
const FEED_URL = 'https://himalayas.app/jobs/api?limit=50';
const TRUSTED_HOST = 'himalayas.app';
/** @param {string} url */
function assertHimalayasUrl(url) {
let parsed;
try {
parsed = new URL(url);
} catch {
throw new Error(`himalayas: invalid URL: ${url}`);
}
if (parsed.protocol !== 'https:') throw new Error(`himalayas: URL must use HTTPS: ${url}`);
if (parsed.hostname !== TRUSTED_HOST) {
throw new Error(`himalayas: untrusted hostname "${parsed.hostname}" - must be ${TRUSTED_HOST}`);
}
return url;
}
function cleanText(value) {
return typeof value === 'string' ? value.trim() : '';
}
function cleanHimalayasUrl(value) {
const raw = cleanText(value);
if (!raw) return '';
try {
const parsed = new URL(raw);
const host = parsed.hostname.toLowerCase();View on GitHub (pinned to 9b17a8ac97)
Solutions
- Restore FEED_URL to a well-formed absolute URL (scheme + host + path), e.g. https://himalayas.app/jobs/api?limit=50.
- If extending the provider to accept a configurable URL, validate/normalise it before passing to assertHimalayasUrl.
- Add a unit test asserting new URL(FEED_URL) does not throw so a bad edit is caught at test time.
Example fix
// before const FEED_URL = 'himalayas.app/jobs/api?limit=50'; // missing scheme // after const FEED_URL = 'https://himalayas.app/jobs/api?limit=50';
Defensive patterns
Strategy: validation
Validate before calling
// Guard the constant at module load so a bad edit fails loud, in a test,
// rather than at first fetch. Apply the same check before any caller URL.
function parseOrThrow(url) {
try { return new URL(url); }
catch { throw new Error(`himalayas: invalid URL: ${url}`); }
} Type guard
/** True for an absolute, parseable URL string. */
function isAbsoluteUrl(value) {
if (typeof value !== 'string' || !value.trim()) return false;
try { new URL(value); return true; } catch { return false; }
} Try / catch
try {
return await himalayasProvider.fetch(entry, ctx);
} catch (err) {
if (/himalayas: invalid URL/.test(err.message)) {
// Only reachable if FEED_URL was edited to a malformed value — fix the constant.
console.error(`himalayas: FEED_URL constant is malformed — ${err.message}`);
}
throw err;
} Prevention
- Keep FEED_URL a well-formed absolute URL and unit-test new URL(FEED_URL) so a typo fails at test time.
- If forking to a configurable URL, validate it with new URL() in a try/catch before calling the assert.
- Never route untrusted entry input through the SSRF assert without pre-validation.
When it happens
Trigger: A fork/maintenance edit that changes FEED_URL to a malformed value (missing scheme, stray characters); reusing assertHimalayasUrl on user/entry-supplied input that is not an absolute URL; a build that mangles the constant. In the unmodified shipped provider, the constant parses cleanly so this never fires.
Common situations: A developer forking the provider to point at a staging endpoint and typoing the URL; extending the provider to accept entry.api and routing unvalidated input through the assert.
Related errors
- himalayas: URL must use HTTPS: ${url}
- himalayas: untrusted hostname "${parsed.hostname}" - must be
- comeet: invalid URL: ${redactToken(url)}
- comeet: URL must use HTTPS: ${redactToken(url)}
- comeet: untrusted hostname "${parsed.hostname}" — must be ${
AI-assisted analysis of santifer/career-ops@9b17a8ac97 (2026-08-13).
Data as JSON: /api/errors/88acc97f7cd4a2f9.
Report an issue: GitHub.