update_reply_to_email_address: look up the reply-to by service ID too - #4947
Open
joybytes wants to merge 1 commit into
Open
update_reply_to_email_address: look up the reply-to by service ID too#4947joybytes wants to merge 1 commit into
joybytes wants to merge 1 commit into
Conversation
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
force-pushed
the
filter-reply-to-update-by-service-id
branch
from
August 28, 2026 12:38
6b10fdb to
0562074
Compare
joybytes
marked this pull request as ready for review
August 28, 2026 12:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
update_reply_to_email_addressfetched the row withServiceEmailReplyTo.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_archivedto 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