Skip to content

feat(bench): Let the operator trust named private hosts for backup downloads - #660

Open
pramoodsurya wants to merge 1 commit into
frappe:developfrom
pramoodsurya:feat/trusted-private-backup-hosts
Open

pramoodsurya wants to merge 1 commit into
frappe:developfrom
pramoodsurya:feat/trusted-private-backup-hosts

Conversation

@pramoodsurya

Copy link
Copy Markdown

Problem

Since #654, the agent refuses to download a backup from any host that resolves to a private address. That is the right default for URLs a customer supplies. On a self-hosted Press, though, the platform's own S3-compatible backup store (Garage, MinIO, Ceph RGW) usually sits on the private network next to the app servers. "New Site from Backup" from that store then fails with:

The URL resolves to an address that is not public.

There is no setting to allow it, so today the only options are to put the backup store on a public address or to patch the agent.

Change

A new environment variable, AGENT_TRUSTED_PRIVATE_HOSTS, takes exact hostnames, comma-separated (for example s3.internal.example). A host on the list may resolve to private addresses. Nothing else changes:

  • Matching is by exact hostname, without wildcards or suffixes, so s3.internal.example.attacker.com is not trusted.
  • Every other host, including each redirect target from a trusted host, is checked as before.
  • Connections are still pinned to the resolved address.
  • When the variable is unset, the behaviour is the same as today.

The list is read at call time, so it is set in the agent's supervisord environment. Operators should list only stores that require signed requests.

Tests

Three new cases in agent/tests/test_remote_url.py:

  • a trusted host that resolves to a private address downloads;
  • other private hosts are still refused while some are trusted, including a lookalike suffix;
  • a redirect from a trusted host to an untrusted private host is refused before it is requested.

python -m unittest agent.tests.test_remote_url passes on Python 3.8 (12 tests). Two of the new tests fail without the change. ruff check and ruff format --check are clean.

Tried in a lab

I ran Press v0.174.0 on Proxmox VMs, with Garage v2.4.1 as the Backup Bucket store on the private network. With an earlier version of this change and AGENT_TRUSTED_PRIVATE_HOSTS set on the app server, "New Site from Backup" restored a site from Garage. The restored data was checked against the source site. That version had the same check but read the list once at import.

Related: #558 (passing ENDPOINT_URL to boto3) fixes the upload side of the same setup. I tested an equivalent change in the same lab, and it works.

🤖 Generated with Claude Code

…wnloads

The backup URL check refuses any host that resolves to a private address.
On a self-hosted Press, the platform's own S3-compatible backup store
(Garage, MinIO, Ceph RGW) often sits on the private network, so
"New Site from Backup" from it fails with "The URL resolves to an address
that is not public."

AGENT_TRUSTED_PRIVATE_HOSTS takes exact hostnames, comma-separated. Those
hosts may resolve to private addresses; every other host, including each
redirect target, is checked as before. Unset, nothing changes.

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

mergify Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant