-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Question on allowing any protocol #54
Comments
Actually...this functionality doesn't exist! 😓 However, I looked through the code, and if you want to propose a keyword you'd like, I can implement it pretty quickly. Since protocols are nested within attributes, which are nested within elements, the minimum config for this would be: sanitizer = Selma::Sanitizer.new({
elements: ["a"],
attributes: { "a" => ["href"] },
protocols: { "a" => { "href" => [:all] } },
}) We already have |
I like sanitizer = Selma::Sanitizer.new({
elements: ["a img"],
attributes: { "a" => ["href"], "img" => ["src"] },
protocols: { "img" => { "src" => ["http", "https"] } },
}) So this would sanitize Though I also see the benefit in being explicit, so in that case I like |
Hey thanks for this! I haven't had a chance to test it yet but I will, my week has gone sideways. |
@gjtorikian worked like a charm, thanks! 🙇 |
I have a situation where any protocols are allowed, except a few.
I have a handler that can check every
href
and filter out bad protocols. Same thing I'm able to do usingSanitize
.However, I can't seem to convince Selma to not filter on protocols for the
href
. I've tried adding only ana
element, etc. I tried each of the following with no luck.It always filters out the
href
, giving<a>test</a>
.Is this possible?
The text was updated successfully, but these errors were encountered: