Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Feature Request: placeholders which explicitly prevent markdown injection #4080

Open
furnivall opened this issue May 9, 2024 · 2 comments

Comments

@furnivall
Copy link

furnivall commented May 9, 2024

Hi there,
At current, placeholders are able to be transformed into markdown if they are populated as such.

e.g. if you send [link](dodgy-link here) into ((your-placeholder-here)) it will render in your email.

This presents a compelling opportunity for an adversarial attacker to utilise gov notify's relative respectability as a phishing vector which both appears legitimate and gets through spam filters.

A potential suggestion would be to have specific fields that are populated in user input denoted within the template using some type of new syntax (e.g. ({safe-placeholder})) which gives protection at the template level.

Gov notify could then choose to not send that email, throw an error or even alert the responsible template holder.

It would also allow your team to spot adversarial behaviour patterns via logging.

Hope this is helpful.

@furnivall furnivall changed the title Feature request: placeholders which explicitly prevent markdown rendering Security Feature Request: placeholders which explicitly prevent markdown injection May 9, 2024
@quis
Copy link
Member

quis commented Sep 17, 2024

Hi @furnivall, thanks for writing this up.

It’s not documented, but you can use the code syntax in Markdown to effectively mark a block of text as ‘unsafe’.

For example

```
hello [link](dodgy-link here)
```

will render as-is, without the link being converted to HTML. We are probably going to document this explicitly and make sure it continues to be supported in the future.

You would still need to escape the content if you wanted to put it inside some other Markdown, for example a heading:

# Hello ((name))

@furnivall
Copy link
Author

@quis - that's a great wee solution. If you could let me know when the documentation change happens I'd be grateful for informing the non-techies!

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

No branches or pull requests

2 participants