Skip to content

update_reply_to_email_address: look up the reply-to by service ID too - #4947

Open
joybytes wants to merge 1 commit into
mainfrom
filter-reply-to-update-by-service-id
Open

update_reply_to_email_address: look up the reply-to by service ID too#4947
joybytes wants to merge 1 commit into
mainfrom
filter-reply-to-update-by-service-id

Conversation

@joybytes

@joybytes joybytes commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

update_reply_to_email_address fetched the row with ServiceEmailReplyTo.query.get(reply_to_id), using the ID on its own.
It now uses dao_get_reply_to_by_id(reply_to_id, service_id), so the reply-to has to belong to the service in the URL.

This came from a scan report which detected the issue: The admin app checks that the user is allowed to edit the service, but the internal API never checked that the reply-to belonged to that service.

I also added a test case for test_update_reply_to_email_address_raises_sqlalchemy_error_when_reply_to_is_archived to make it clear that with this new way of querying, a reply-to can no longer be edited from admin, if it's archived / deleted which is the correct behaviour

The DAO fetched the reply-to by ID alone, so a reply-to belonging to any
other service could be updated. Use the existing service-scoped getter
instead, which is the pattern used everywhere else, and do it before we
change any default flags so nothing is mutated on a bad ID.

A mismatched ID now returns a 404, as does an archived reply-to.
@joybytes
joybytes force-pushed the filter-reply-to-update-by-service-id branch from 6b10fdb to 0562074 Compare August 28, 2026 12:38
@joybytes
joybytes marked this pull request as ready for review August 28, 2026 12:45
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