René's URL Explorer Experiment


Title: DomSanitizer should keep style attributes in HTML but sanitize them if needed · Issue #45270 · angular/angular · GitHub

Open Graph Title: DomSanitizer should keep style attributes in HTML but sanitize them if needed · Issue #45270 · angular/angular

X Title: DomSanitizer should keep style attributes in HTML but sanitize them if needed · Issue #45270 · angular/angular

Description: Which @angular/* package(s) are the source of the bug? platform-browser Is this a regression? No Description DOM sanitizer removes style attribute from all elements. Expected behavior DOM santitizer keeps the style attribute on elements,...

Open Graph Description: Which @angular/* package(s) are the source of the bug? platform-browser Is this a regression? No Description DOM sanitizer removes style attribute from all elements. Expected behavior DOM santitize...

X Description: Which @angular/* package(s) are the source of the bug? platform-browser Is this a regression? No Description DOM sanitizer removes style attribute from all elements. Expected behavior DOM santitize...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DomSanitizer should keep style attributes in HTML but sanitize them if needed","articleBody":"### Which @angular/* package(s) are the source of the bug?\r\n\r\nplatform-browser\r\n\r\n### Is this a regression?\r\n\r\nNo\r\n\r\n### Description\r\n\r\nDOM sanitizer removes style attribute from all elements.\r\nExpected behavior\r\nDOM santitizer keeps the style attribute on elements, but sanitizes the actual style value if needed, so something innocuous like style=\"text-align: center\" isn't lost.\r\nSo when I use sanitizer.sanitize(SecurityContext.HTML, someHtmlContainedString) I expect to receive html with attributes like id, styles, class if the original string contained them. But if it contaied tags like \u003cscript> \u003ca href=\"javascript:alert('hack')\">\u003c/a> - the javascript / script tags should be sanitized. \r\n\r\nThis issue was mistakely closed in https://github.com/angular/angular/issues/19645 with explanation that the latest version of angular should fix it, but it don't.\r\nSo this one is just a reopen.\r\n\r\n\r\n\r\n### Please provide a link to a minimal reproduction of the bug\r\n\r\nhttp://plnkr.co/edit/AjJMr2pDz8IxvucnpTbC?p=preview\r\n\r\n### Please provide the exception or error you saw\r\n\r\n```true\r\nI receive incorrect html with sanitized style attr.\r\n```\r\n\r\n\r\n### Please provide the environment you discovered this bug in (run `ng version`)\r\n\r\n```true\r\nAngular CLI: 13.2.5\r\nNode: 16.13.0      \r\nPackage Manager: npm 7.24.2\r\nOS: win32 x64\r\n\r\nAngular: 13.2.5\r\n... animations, cli, common, compiler, compiler-cli, core, forms\r\n... platform-browser, platform-browser-dynamic, router\r\n\r\nPackage                         Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect       0.1302.5\r\n@angular-devkit/build-angular   13.2.5\r\n@angular-devkit/core            13.2.5\r\n@angular-devkit/schematics      13.2.5\r\n@schematics/angular             13.2.5\r\nrxjs                            7.5.4\r\ntypescript                      4.5.5\r\n```\r\n\r\n\r\n### Anything else?\r\n\r\nMy guessing is - the fix should be something like adding 'style' str into\r\nconst HTML_ATTRS = tagSet(\r\n    'abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +\r\n    'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +   'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +\r\n    'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +\r\n    'valign,value,vspace,width');\r\n or if it's still causes security vulnerability - add separate parse rules to sanitize style attrs.\r\n   which is defined in https://github.com/angular/angular/blob/13.2.x/packages/core/src/sanitization/html_sanitizer.ts\r\nIf you might believe this is a correct behavior - please close with an explanation why.\r\nThanks!","author":{"url":"https://github.com/amaestr0","@type":"Person","name":"amaestr0"},"datePublished":"2022-03-04T21:47:53Z","url":"https://github.com/angular/angular/issues/45270"}

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:56c8c619-2d53-d85f-6f16-780c77db92e1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC6D0:26ECEB:1892256:1F51847:6B012EE1
html-safe-nonce39150a6ab73fab057f4de1c14ffd0475fb88f2fa97215874a136d07f9d224107
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkQwOjI2RUNFQjoxODkyMjU2OjFGNTE4NDc6NkIwMTJFRTEiLCJ2aXNpdG9yX2lkIjoiNjE5MjEwMzg2OTExNjM5NTIzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0e6e49e052e31c0497ac378ef638a1df85122c3b560acef07f2d39497e886263
hovercard-subject-tagissue:1160078225
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/45270/issue_layout
twitter:imagehttps://opengraph.githubassets.com/dc084313dce04d1d0173b19d47e9dfe84963be4fdeed7c8c9b63a337ecca21cd/angular/angular/issues/45270
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/dc084313dce04d1d0173b19d47e9dfe84963be4fdeed7c8c9b63a337ecca21cd/angular/angular/issues/45270
og:image:altWhich @angular/* package(s) are the source of the bug? platform-browser Is this a regression? No Description DOM sanitizer removes style attribute from all elements. Expected behavior DOM santitize...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameamaestr0
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/45270#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F45270
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%2F45270
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/45270
Reloadhttps://github.com/angular/angular/issues/45270
Reloadhttps://github.com/angular/angular/issues/45270
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues836 (836)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/45270
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/45270
#70425https://github.com/angular/angular/pull/70425
DomSanitizer should keep style attributes in HTML but sanitize them if neededhttps://github.com/angular/angular/issues/45270#top
#70425https://github.com/angular/angular/pull/70425
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
breaking changeshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22breaking%20changes%22
core: sanitizationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20sanitization%22
securityIssues that generally impact framework or application securityhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22security%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/amaestr0
amaestr0https://github.com/amaestr0
on Mar 4, 2022https://github.com/angular/angular/issues/45270#issue-1160078225
#19645https://github.com/angular/angular/issues/19645
http://plnkr.co/edit/AjJMr2pDz8IxvucnpTbC?p=previewhttp://plnkr.co/edit/AjJMr2pDz8IxvucnpTbC?p=preview
https://github.com/angular/angular/blob/13.2.x/packages/core/src/sanitization/html_sanitizer.tshttps://github.com/angular/angular/blob/13.2.x/packages/core/src/sanitization/html_sanitizer.ts
Nexthttps://github.com/angular/angular/issues/45270?timeline_page=1
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
on Mar 4, 2022https://github.com/angular/angular/issues/45270#event-6188264444
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Mar 4, 2022https://github.com/angular/angular/issues/45270#event-6188264513
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
core: sanitizationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20sanitization%22
on Mar 7, 2022https://github.com/angular/angular/issues/45270#event-6196464645
https://github.com/janousek
janousekhttps://github.com/janousek
on Mar 15, 2022https://github.com/angular/angular/issues/45270#issuecomment-1068010962
https://research.securitum.com/xss-in-amp4email-dom-clobbering/https://research.securitum.com/xss-in-amp4email-dom-clobbering/
https://github.com/amaestr0
amaestr0https://github.com/amaestr0
on Mar 22, 2022https://github.com/angular/angular/issues/45270#issuecomment-1074632690
@janousekhttps://github.com/janousek
dylhunnhttps://github.com/dylhunn
area: securityIssues related to built-in security features, such as HTML sanitationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20security%22
securityIssues that generally impact framework or application securityhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22security%22
area: securityIssues related to built-in security features, such as HTML sanitationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20security%22
on Mar 26, 2022https://github.com/angular/angular/issues/45270#event-6310724716
https://github.com/pkozlowski-opensource
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
on Jun 21, 2022https://github.com/angular/angular/issues/45270#issuecomment-1161562496
https://stackblitz.com/edit/angular-ivy-78owxc?file=src%2Fapp%2Fapp.component.tshttps://stackblitz.com/edit/angular-ivy-78owxc?file=src%2Fapp%2Fapp.component.ts
#35621https://github.com/angular/angular/pull/35621
https://github.com/msteel9999
msteel9999https://github.com/msteel9999
on Jul 22, 2022https://github.com/angular/angular/issues/45270#issuecomment-1192554233
https://stackblitz.com/edit/angular-ivy-78owxc?file=src%2Fapp%2Fapp.component.tshttps://stackblitz.com/edit/angular-ivy-78owxc?file=src%2Fapp%2Fapp.component.ts
#35621https://github.com/angular/angular/pull/35621
#35621https://github.com/angular/angular/pull/35621
https://github.com/amaestr0
amaestr0https://github.com/amaestr0
on Jul 22, 2022https://github.com/angular/angular/issues/45270#issuecomment-1192776566
@pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
alxhubhttps://github.com/alxhub
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
on Nov 16, 2022https://github.com/angular/angular/issues/45270#event-7825714624
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
Backloghttps://github.com/angular/angular/milestone/82
on Nov 16, 2022https://github.com/angular/angular/issues/45270#event-7825714870
https://github.com/l-uuz
l-uuzhttps://github.com/l-uuz
on Jan 15, 2023https://github.com/angular/angular/issues/45270#issuecomment-1383123490
https://github.com/raysuelzer
raysuelzerhttps://github.com/raysuelzer
on Dec 7, 2023https://github.com/angular/angular/issues/45270#issuecomment-1846018748
https://gist.github.com/raysuelzer/48c383e992c62066eef35164b80e9c24https://gist.github.com/raysuelzer/48c383e992c62066eef35164b80e9c24
https://github.com/ilapavuluri
ilapavulurihttps://github.com/ilapavuluri
on Jan 11, 2024https://github.com/angular/angular/issues/45270#issuecomment-1886889318
https://github.com/motohead400
motohead400https://github.com/motohead400
on Jan 11, 2024https://github.com/angular/angular/issues/45270#issuecomment-1887137715
@ilapavulurihttps://github.com/ilapavuluri
https://github.com/ilapavuluri
ilapavulurihttps://github.com/ilapavuluri
on Jan 11, 2024https://github.com/angular/angular/issues/45270#issuecomment-1887464129
@motohead400https://github.com/motohead400
https://github.com/TheMelmacian
TheMelmacianhttps://github.com/TheMelmacian
on May 28, 2024https://github.com/angular/angular/issues/45270#issuecomment-2135162206
https://github.com/rubiesonthesky
rubiesontheskyhttps://github.com/rubiesonthesky
on Jun 19, 2024https://github.com/angular/angular/issues/45270#issuecomment-2178229210
https://stackblitz.com/edit/angular-ivy-78owxc?file=src%2Fapp%2Fapp.component.tshttps://stackblitz.com/edit/angular-ivy-78owxc?file=src%2Fapp%2Fapp.component.ts
#35621https://github.com/angular/angular/pull/35621
https://github.com/amaestr0
amaestr0https://github.com/amaestr0
on Jul 28, 2024https://github.com/angular/angular/issues/45270#issuecomment-2254458722
https://stackblitz.com/edit/angular-ivy-78owxc?file=src%2Fapp%2Fapp.component.tshttps://stackblitz.com/edit/angular-ivy-78owxc?file=src%2Fapp%2Fapp.component.ts
#35621https://github.com/angular/angular/pull/35621
#45274https://github.com/angular/angular/pull/45274
https://github.com/Azbesciak
Azbesciakhttps://github.com/Azbesciak
on Jan 2, 2025https://github.com/angular/angular/issues/45270#issuecomment-2568300492
@pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
https://github.com/WhenJavaAttacks
WhenJavaAttackshttps://github.com/WhenJavaAttacks
on Apr 10, 2025https://github.com/angular/angular/issues/45270#issuecomment-2794439567
#45274https://github.com/angular/angular/pull/45274
@amaestr0https://github.com/amaestr0
this onehttps://github.com/angular/angular/pull/45274#issuecomment-1161553647
https://github.com/rubiesonthesky
rubiesontheskyhttps://github.com/rubiesonthesky
on Apr 10, 2025https://github.com/angular/angular/issues/45270#issuecomment-2794484833
https://github.com/Ashutosh0x
Ashutosh0xhttps://github.com/Ashutosh0x
on Feb 20, 2026https://github.com/angular/angular/issues/45270#issuecomment-3932736352
@pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
#35621https://github.com/angular/angular/pull/35621
https://github.com/Xriuk
Xriukhttps://github.com/Xriuk
on May 26, 2026https://github.com/angular/angular/issues/45270#issuecomment-4544804887
https://github.com/a-boertien
a-boertienhttps://github.com/a-boertien
on Aug 26, 2026https://github.com/angular/angular/issues/45270#issuecomment-5428598637
https://github.com/JeanMeche
JeanMechehttps://github.com/JeanMeche
on Aug 27, 2026https://github.com/angular/angular/issues/45270#issuecomment-5440157537
#70425https://github.com/angular/angular/pull/70425
JeanMechehttps://github.com/JeanMeche
breaking changeshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22breaking%20changes%22
on Aug 27, 2026https://github.com/angular/angular/issues/45270#event-30107989672
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/45270
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/45270
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
breaking changeshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22breaking%20changes%22
core: sanitizationhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20sanitization%22
securityIssues that generally impact framework or application securityhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22security%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.