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

Explain that replaceRE results are unsafe #2240

Closed
wants to merge 1 commit into from
Closed

Explain that replaceRE results are unsafe #2240

wants to merge 1 commit into from

Conversation

willfaught
Copy link
Contributor

No description provided.

@jmooring
Copy link
Member

I'm not sure what "unsafe" means, because at face value that is not true.

It seems like this PR might be about specifying that this string function returns a string, not template.HTML. Is that correct?

@willfaught
Copy link
Contributor Author

"Unsafe" as in not the result of safeHTML, as in HTML content is escaped. In other words, someHTMLString | safeHTML | replaceRE <x> <y> needs to pipe through another safeHTML to be unescaped when printed.

@willfaught
Copy link
Contributor Author

replaceRE "strips" the safety marked by safeHTML that is on its input.

@jmooring
Copy link
Member

A function that returns a string returns a string. I think there are a couple of actionable items:

  1. Specify return types for each function, which is in the works.
  2. Provide a better description of what Go's html/template package does, and how that relates to the safe.Whatever functions.

@jmooring jmooring closed this Sep 29, 2023
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.

2 participants