Skip to content

fix(EVO-2178): take the media host allowlist from config, not from the event#7

Merged
gomessguii merged 1 commit into
developfrom
fix/EVO-2178-media-allowlist-from-config
Jul 21, 2026
Merged

fix(EVO-2178): take the media host allowlist from config, not from the event#7
gomessguii merged 1 commit into
developfrom
fix/EVO-2178-media-allowlist-from-config

Conversation

@gomessguii

Copy link
Copy Markdown
Member

Fixes a regression I introduced in #6, and corrects the shape of the guard added there.

The regression

#6 anchored the media host allowlist on the host of the event's postback_url. That host never matches the one the CRM signs attachment URLs with:

source shipped value
host the guard authorized BOT_RUNTIME_POSTBACK_BASE_URL evo-crm (internal DNS)
host the CRM signs media with ACTIVE_STORAGE_URL, falling back to BACKEND_URL the public CRM host (production refuses localhost)

So on develop every attachment was rejected as pipeline.ai.attachment.blocked_url, the text reply went out alone, and the agent stopped seeing images — the EVO-2178 bug, reintroduced. The tests in #6 did not catch it because every httptest server binds 127.0.0.1, so the postback host and the media host always matched there.

Why the anchor was wrong in the first place

Whoever sends the event chooses every field in it, including the one being used to decide what that same event may reach. An allowlist read out of the event therefore constrains nobody it needs to constrain — it only stops a caller who can set attachments[].url but not the other fields, which is not a real attacker.

The allowlist now comes from MEDIA_HOST_ALLOWLIST only, so the decision sits with the operator where the caller cannot pick it. A2ARequest.PostbackURL is dropped again.

The scheme check and the per-redirect re-check are unchanged — those are the parts of #6 that did hold up.

Consequence

The variable is now required wherever media is expected: unset means no attachment is fetched. k8s/configmap.yaml and k8s/deployment.yaml carry it here; the compose/swarm/env surfaces are wired in the umbrella PR, which should land together with this one.

Verification

go build ./... · go vet ./... · go test ./... — green, e2e included, against a throwaway Redis.

Part of EVO-2178.

🤖 Generated with Claude Code

…e event

Fixes a regression I introduced in #6. The allowlist was anchored on the host
of the event's postback_url, which never matches the host the CRM actually
signs media URLs with: postback_url comes from BOT_RUNTIME_POSTBACK_BASE_URL
(internal DNS, "evo-crm" in the shipped compose) while the URL is built from
ACTIVE_STORAGE_URL, falling back to BACKEND_URL — which production requires to
be a public host. So on develop every attachment was rejected as
blocked_url and the agent stopped seeing images: the EVO-2178 bug, back.

Anchoring on the event was also the wrong shape for the guard. Whoever sends
the event chooses every field in it, including the one being used to decide
what that same event may reach, so the check constrained nobody it needed to.
Reading MEDIA_HOST_ALLOWLIST only puts the decision with the operator, where
it cannot be chosen by the caller. A2ARequest.PostbackURL is dropped again.

The scheme check and the per-redirect re-check are unchanged.

This makes the variable required wherever media is expected: unset means no
attachment is fetched. The deploy surfaces are wired up in the umbrella PR;
k8s/configmap.yaml and k8s/deployment.yaml carry it here.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @gomessguii, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@gomessguii
gomessguii merged commit b2b2d88 into develop Jul 21, 2026
5 checks passed
@gomessguii
gomessguii deleted the fix/EVO-2178-media-allowlist-from-config branch July 21, 2026 22:51
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.

1 participant