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

Avoid raw erb syntax (<%==) linter #387

Open
gravitystorm opened this issue Dec 12, 2024 · 0 comments
Open

Avoid raw erb syntax (<%==) linter #387

gravitystorm opened this issue Dec 12, 2024 · 0 comments

Comments

@gravitystorm
Copy link
Contributor

I'm a maintainer of an open-source rails application (OpenStreetMap) and I recently found out about the "raw erb" syntax i.e. using <%== instead of <%=. For example:

<%= "<hr />" %>
<%== "<hr />" %>

The first is escaped, but the second one outputs raw html. This has security implications for situations like:

<%= user.name %>
<%== user.name %>

Now hopefully any accidental usage of <%== will be caught during code review, but our reviewers are fallible (particularly during large refactoring diffs) and a lot of our code contributors aren't erb experts either, so mistakes might happen!

I'd like to write a custom linter to catch these, and ideally for it to be available here upstream too. But I have no idea how to write it! I'd also welcome any guidance on whether it should be written as a standalone linter here, or as part of the "better-html" erb safety codebase, to help with any eventual pull request.

If anyone would like to help write this linter for me, I'd be very grateful!

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

1 participant