René's URL Explorer Experiment


Title: Extensible Sanitizer · Issue #36650 · angular/angular · GitHub

Open Graph Title: Extensible Sanitizer · Issue #36650 · angular/angular

X Title: Extensible Sanitizer · Issue #36650 · angular/angular

Description: 🚀 feature request Relevant Package @angular/core this line and file are of key interest: angular/packages/core/src/sanitization/html_sanitizer.ts Line 95 in 486cade export const VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS, AR...

Open Graph Description: 🚀 feature request Relevant Package @angular/core this line and file are of key interest: angular/packages/core/src/sanitization/html_sanitizer.ts Line 95 in 486cade export const VALID_ATTRS = merge...

X Description: 🚀 feature request Relevant Package @angular/core this line and file are of key interest: angular/packages/core/src/sanitization/html_sanitizer.ts Line 95 in 486cade export const VALID_ATTRS = merge...

Opengraph URL: https://github.com/angular/angular/issues/36650

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Extensible Sanitizer","articleBody":"# 🚀 feature request\r\n\r\n### Relevant Package\r\n@angular/core\r\n\r\nthis line and file are of key interest:\r\nhttps://github.com/angular/angular/blob/486cade596a57b7c146ae3aa269d69d7d828a6ab/packages/core/src/sanitization/html_sanitizer.ts#L95\r\n\r\n\r\n### Description\r\nThe ability to trust a custom whitelist of HTML tags, attributes, and values with a DOM sanitizer, without bypassing the whole sanitizer.\r\n\r\nThis would allow preservation of `id`, `style`, data attributes, and other common attributes. These attributes are useful in a variety of use cases for many Angular developers. This issue is a common cause of many GitHub issues, StackOverflow questions, and other indicators that there is a real problem with demand for a secure and flexible solution.\r\n\r\n[Related SO 1](https://stackoverflow.com/questions/57400432/angular-how-to-retain-html-id-attribute-when-sanitized)\r\n[Related SO 2](https://stackoverflow.com/questions/39628007/angular2-innerhtml-binding-remove-style-attribute)\r\n[Tutorial on a best practice approach to doing what I am requesting](https://www.intricatecloud.io/2019/10/using-angular-innerhtml-to-display-user-generated-content-without-sacrificing-security/)\r\nthis would close a bunch of github issues and resolve many SO questions.\r\n\r\n### Describe the solution you'd like\r\nI would like to be able to specify three things to allow keys and values to be sanitized in a SecurityContext.HTML.\r\n\r\nThis could be implemented as an options argument to DomSanitizer.sanitize, or it could be implemented as a custom SecurityContext, but I will use options object in my description below:\r\n\r\n```\r\n    trustedFirstParagraph$ = this.translateService\r\n        .translate('some-translation-key')\r\n        .pipe(map(s => this.domSanitizer.sanitize(SecurityContext.HTML, s, options)));\r\n```\r\n\r\nHere, options can be an object with any of three keys:\r\n```\r\nconst options = {\r\n  trustAttributeKeyExpression: /some-regex-to-trust/,\r\n  trustAttributeValueExpression: /some-value-to-trust/,\r\n  trustAttribute: (el, key, value): boolean | string[] => {\r\n      // arbitrary logic that can return a boolean\r\n      // or [string, string] sanitized/transformed [key, value].\r\n  }\r\n}\r\n```\r\n\r\n`trustAttributeKeyExpression` and `trustAttributeValueExpression` must both match if both are specified. To implement an OR operation, and other more complex algorithms, a developer can use `trustAttribute`.\r\n\r\n### Describe alternatives you've considered\r\n1. hiding data inside the class attribute and parsing it\r\n2. using a span or div inside my element which is visually hidden but which I can access through my component dom ref and parse out the value\r\n3. de-DRYing my code and having component-specific content across n components instead of being able to leverage a generic service","author":{"url":"https://github.com/Vandivier","@type":"Person","name":"Vandivier"},"datePublished":"2020-04-15T22:58:16Z","url":"https://github.com/angular/angular/issues/36650"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:029b8647-93c3-ff35-3acf-7945dfbdf2fa
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id917E:A99C2:1186A76:1675AE2:6B010790
html-safe-nonce7edb4568bace3cd1c746f66202c5dcfa407f16312610eddf5eed6c401cf3148a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTdFOkE5OUMyOjExODZBNzY6MTY3NUFFMjo2QjAxMDc5MCIsInZpc2l0b3JfaWQiOiI0MzQ0Mzk0NTI4NzYxOTA3MDg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace9d4d4a3f0d9da5ce03240e08309f1484eb06a3a84f55da4c0ea5599949fa77f
hovercard-subject-tagissue:600636742
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/36650/issue_layout
twitter:imagehttps://opengraph.githubassets.com/30d8f44f7a88267324bf0707fd95eaea760e6adba9781d073e9053620ed7b96a/angular/angular/issues/36650
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/30d8f44f7a88267324bf0707fd95eaea760e6adba9781d073e9053620ed7b96a/angular/angular/issues/36650
og:image:alt🚀 feature request Relevant Package @angular/core this line and file are of key interest: angular/packages/core/src/sanitization/html_sanitizer.ts Line 95 in 486cade export const VALID_ATTRS = merge...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameVandivier
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/36650#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F36650
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F36650
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/36650
Reloadhttps://github.com/angular/angular/issues/36650
Reloadhttps://github.com/angular/angular/issues/36650
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests141 (141)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/36650
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/36650
Extensible Sanitizerhttps://github.com/angular/angular/issues/36650#top
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
core: sanitizationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20sanitization%22
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%22
feature: under considerationFeature request for which voting has completed and the request is now under considerationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%3A%20under%20consideration%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/Vandivier
Vandivierhttps://github.com/Vandivier
on Apr 15, 2020https://github.com/angular/angular/issues/36650#issue-600636742
angular/packages/core/src/sanitization/html_sanitizer.tshttps://github.com/angular/angular/blob/486cade596a57b7c146ae3aa269d69d7d828a6ab/packages/core/src/sanitization/html_sanitizer.ts#L95
486cadehttps://github.com/angular/angular/commit/486cade596a57b7c146ae3aa269d69d7d828a6ab
Related SO 1https://stackoverflow.com/questions/57400432/angular-how-to-retain-html-id-attribute-when-sanitized
Related SO 2https://stackoverflow.com/questions/39628007/angular2-innerhtml-binding-remove-style-attribute
Tutorial on a best practice approach to doing what I am requestinghttps://www.intricatecloud.io/2019/10/using-angular-innerhtml-to-display-user-generated-content-without-sacrificing-security/
AndrewKushnirhttps://github.com/AndrewKushnir
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%22
on Apr 15, 2020https://github.com/angular/angular/issues/36650#event-3237613103
ngbothttps://github.com/apps/ngbot
Backloghttps://github.com/angular/angular/milestone/82
on Apr 15, 2020https://github.com/angular/angular/issues/36650#event-3237613146
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
core: sanitizationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20sanitization%22
on Apr 16, 2020https://github.com/angular/angular/issues/36650#event-3238359423
https://github.com/gkgeorgiev
gkgeorgievhttps://github.com/gkgeorgiev
on Oct 29, 2020https://github.com/angular/angular/issues/36650#issuecomment-718846378
https://github.com/RichardMcSorley
RichardMcSorleyhttps://github.com/RichardMcSorley
on Nov 5, 2020https://github.com/angular/angular/issues/36650#issuecomment-722684097
angular-robothttps://github.com/apps/angular-robot
feature: under considerationFeature request for which voting has completed and the request is now under considerationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%3A%20under%20consideration%22
on Jun 4, 2021https://github.com/angular/angular/issues/36650#event-4843663756
https://github.com/Ruud-cb
Ruud-cbhttps://github.com/Ruud-cb
on Aug 4, 2021https://github.com/angular/angular/issues/36650#issuecomment-892605891
https://github.com/cloakedninjas
cloakedninjashttps://github.com/cloakedninjas
on Feb 3, 2022https://github.com/angular/angular/issues/36650#issuecomment-1028918070
https://github.com/iwantwin
iwantwinhttps://github.com/iwantwin
on Apr 13, 2022https://github.com/angular/angular/issues/36650#issuecomment-1097702768
https://github.com/iwantwin
iwantwinhttps://github.com/iwantwin
on Apr 13, 2022https://github.com/angular/angular/issues/36650#issuecomment-1097704631
https://www.npmjs.com/package/sanitize-htmlhttps://www.npmjs.com/package/sanitize-html
https://github.com/Vandivier
Vandivierhttps://github.com/Vandivier
on Apr 22, 2022https://github.com/angular/angular/issues/36650#issuecomment-1106576945
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/36650
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/36650
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
core: sanitizationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20sanitization%22
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%22
feature: under considerationFeature request for which voting has completed and the request is now under considerationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22feature%3A%20under%20consideration%22
BacklogNo due datehttps://github.com/angular/angular/milestone/82
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.