Skip to content

Add addPolicyName/removePolicyName methods for TrustedTypesDirective#11

Closed
sideshowbarker wants to merge 1 commit intoHtmlUnit:mainfrom
sideshowbarker:add-remove-policy-name-methods
Closed

Add addPolicyName/removePolicyName methods for TrustedTypesDirective#11
sideshowbarker wants to merge 1 commit intoHtmlUnit:mainfrom
sideshowbarker:add-remove-policy-name-methods

Conversation

@sideshowbarker
Copy link
Contributor

Summary

Port the remaining manipulation API from
shapesecurity/salvation#273 that was not
included in 34b5635:

- Add ManipulationErrorConsumer interface to Directive
- Add removeValueExact() to Directive for case-sensitive value removal
- Add addPolicyName() and removePolicyName() to TrustedTypesDirective
- Add tests for validation, duplicates, case sensitivity, round-trip
  serialization, and edge cases
@kingthorin
Copy link
Contributor

I'm not against these methods but if I recall correctly all the manipulation functionality was removed when the library was brought into this repo.

@sideshowbarker
Copy link
Contributor Author

sideshowbarker commented Feb 1, 2026

I'm not against these methods but if I recall correctly all the manipulation functionality was removed when the library was brought into this repo.

Ah OK — well, if the manipulation functionality was intentionally removed, then I don’t feel strongly about adding it back. And in that case, we could just close this unmerged. I don’t need that functionality for the HTML checker, and I don’t personally have any other use cases for it. I had raised this only in a kind of due-diligence spirit of having the patch check off all the boxes only being complete as I could make it. But it seems like we don’t need for it be quite so “complete”…

@rbri
Copy link
Member

rbri commented Feb 1, 2026

but if I recall correctly all the manipulation functionality was removed when the library was brought into this repo.

The readme also states this

For HtmlUnit, the code has been adapted to the code style rules used, and support for editing policies has been removed.

Removing the edit part makes maintenance a bit simpler and as long as noone needs this I like to stay with this.

❤️ cool to have you on board @sideshowbarker, thanks!

@sideshowbarker
Copy link
Contributor Author

Removing the edit part makes maintenance a bit simpler and as long as noone needs this I like to stay with this.

OK, then I’ll go ahead and close this.

❤️ cool to have you on board @sideshowbarker, thanks!

Cheers~ Excited to be here 😄

@sideshowbarker sideshowbarker deleted the add-remove-policy-name-methods branch February 1, 2026 09:22
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.

3 participants