Skip to content

Allow sanitise_content_for arg in send_email_notification endpoint#276

Open
CrystalPea wants to merge 3 commits into
mainfrom
allow_sanitise_content_for_placeholder_when_sending_email
Open

Allow sanitise_content_for arg in send_email_notification endpoint#276
CrystalPea wants to merge 3 commits into
mainfrom
allow_sanitise_content_for_placeholder_when_sending_email

Conversation

@CrystalPea
Copy link
Copy Markdown
Contributor

@CrystalPea CrystalPea commented May 1, 2026

So that users can tell us to sanitise content for specific placeholders. This is part of the work to mitigate against the placeholder injection vulnerability.

What problem does the pull request solve?

Checklist

  • I’ve used the pull request template
  • [] I’ve written unit tests for these changes
  • I’ve updated the documentation in
  • I’ve bumped the version number in
    • notifications_python_client/__init__.py
  • I've added new environment variables to
    • notifications-python-client/scripts/generate_docker_env.sh
    • notifications-python-client/tox.ini
    • CONTRIBUTING.md

@CrystalPea CrystalPea force-pushed the allow_sanitise_content_for_placeholder_when_sending_email branch 3 times, most recently from 60e00bb to 3e9cdbe Compare May 7, 2026 11:16
@CrystalPea CrystalPea marked this pull request as ready for review May 7, 2026 11:16
@CrystalPea CrystalPea changed the title Allow sanitise_content_for arg in send_email_notification endpoint. Allow sanitise_content_for arg in send_email_notification endpoint May 7, 2026
@CrystalPea CrystalPea force-pushed the allow_sanitise_content_for_placeholder_when_sending_email branch 2 times, most recently from 14e2242 to 948885d Compare May 8, 2026 11:33
So that seervice users can tell us to sanitise content for specific placeholders.
This is part of the work to mitigate against the placeholder injection
vulnerability.

Also add sanitised_content attribute to the response schema
- this is new response attribute where we tell service users
when a content they told us to sanitise was actually altered
as a result.
@CrystalPea CrystalPea force-pushed the allow_sanitise_content_for_placeholder_when_sending_email branch from 948885d to 1902b7d Compare May 8, 2026 13:41
Copy link
Copy Markdown

@kr8n3r kr8n3r left a comment

Choose a reason for hiding this comment

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

this is in line with what api is set to accept and return alphagov/notifications-api#4841

@CrystalPea
Copy link
Copy Markdown
Contributor Author

I need to add new version

"required": ["id", "content", "uri", "template"],
}

# TODO: this doesn't seem to be used anywhere, do we still need it?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR that added this seems to indicate that notification_schemas.py was intended to be the same as its's API counterpart https://github.com/alphagov/notifications-api/blob/main/app/v2/notifications/notification_schemas.py so everything was copied over.

I think it is good to leave the TODO heading in this PR so it can be revisited in the future.

To release "Sanitise personalisation" feature.
@CrystalPea
Copy link
Copy Markdown
Contributor Author

Since I linked to the documentation in the CHANGELOG, I think it's actually good if this change and the documentation are released around the same time.

Still, we have to fix the release pipeline for this before anything gets released, so 🤷🏼‍♀️

Comment thread CHANGELOG.md Outdated
Co-authored-by: Chris Hill-Scott <me@quis.cc>
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.

4 participants