Skip to content

test: check that CKAN_PRIVATE_HOSTS reaches the safe agents' lookup - #596

Merged
aborruso merged 1 commit into
ondata:mainfrom
bjornhagstrom:test/private-hosts-agent-lookup
Nov 12, 2026
Merged

aborruso merged 1 commit into
ondata:mainfrom
bjornhagstrom:test/private-hosts-agent-lookup

Conversation

@bjornhagstrom

Copy link
Copy Markdown
Contributor

The two optional items from your review of #594.

  • The test: a request through the axios safe agents to localhost, which, unlike an IP literal, goes through their DNS lookup. With CKAN_PRIVATE_HOSTS=localhost it reaches a local listener. After the list is changed, the same agents refuse it, so the list is read at lookup time and not when the agents are built.
  • The nit: the redundant const raw = privateHosts; in isPrivateHostAllowed is gone. No behaviour change.

How to check.

  • npm test: 739 passed, 6 skipped (738 on main, plus this test).
  • The test fails if http.ts builds the agents without the list (createSafeAgents(() => '')): "Access to private/internal IP addresses is not allowed ("localhost" resolves to 127.0.0.1)".
  • npm run build and npm run build:worker succeed.

AI assistance: prepared with Claude (Anthropic) under my direction and review, with automated reviews before opening.

Also drops the redundant local in isPrivateHostAllowed (review of ondata#594).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RetriggerView in Greptile

[Low impact] This PR appears safe to merge.

Summary

Adds a real Axios test for CKAN_PRIVATE_HOSTS and removes a redundant local variable.

  • The Axios test checks the host list again on the next lookup.
  • The private-host matcher uses the host list directly.

Reviews (1) · Last reviewed commit: "test: check that CKAN_PRIVATE_HOSTS reac..." · Reviewed by Greptile

@aborruso
aborruso merged commit c6ab095 into ondata:main Nov 12, 2026
1 check passed
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.

2 participants