Repository navigation
Conversation
nan-yu
force-pushed
the
feat/url-security-web-renderers
branch
from
November 10, 2026 05:24
56f7367 to
c536a18
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements URL security policies and baseline URL checks across Angular, Lit, React, and Markdown-it renderers. It applies the surface's URL security policy to URL properties in the Angular renderer (v0.9), introduces built-in baseline checks for media URLs in v0.8 renderers (Angular, Lit, React), and updates the Markdown-it renderer to follow the A2UI Markdown subset by default. As there are no review comments, I have no feedback to provide.
nan-yu
force-pushed
the
feat/url-security-web-renderers
branch
from
November 10, 2026 05:55
c536a18 to
9dbe2d7
Compare
nan-yu
force-pushed
the
feat/url-security-web-core
branch
3 times, most recently
from
December 3, 2026 00:55
cde736f to
76b0957
Compare
nan-yu
force-pushed
the
feat/url-security-web-renderers
branch
4 times, most recently
from
December 3, 2026 01:19
be34779 to
dbde12a
Compare
nan-yu
force-pushed
the
feat/url-security-web-core
branch
from
December 3, 2026 19:12
b813633 to
e38ab5e
Compare
…icy (#4045) - @a2ui/markdown-it follows the Markdown subset by default; createMarkdownRenderer opts in to links and images, whose URLs go through MarkdownRendererOptions.sanitizeUrl (navigation for links, media for images). - Angular v0.9: ImageComponent leaves out src when the policy blocks url, the deprecated ComponentBinder.bind(context) filters URL props like bindNode, TextComponent passes the surface policy to the MarkdownRenderer, and ComponentApiToProps types URL props as possibly undefined. - v0.8 React/Angular Image, Video, AudioPlayer and the Lit surface logo apply the built-in media URL baseline.
nan-yu
force-pushed
the
feat/url-security-web-renderers
branch
from
December 3, 2026 19:13
acf7421 to
e5d6ebc
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #4045. Stacked on #4104 (base
feat/url-security-web-core).This PR sends the URLs that web renderers use outside the resolver through the URL security policy from #4104, and makes
@a2ui/markdown-itfollow the A2UI Markdown subset by default. MCP app CSP capping and Vega chart URLs are in #4117.Reviewer focus
@a2ui/markdown-itdefault change:renderMarkdownnow renders links as their text and images as their alt text. Links and images are opt-in throughcreateMarkdownRenderer({allowLinks, allowImages}), and each URL goes throughMarkdownRendererOptions.sanitizeUrl(added in feat(web_core): add URL security policy and plumb it to components and functions #4104).MarkdownItRenderersetsvalidateLink = () => trueso schemes markdown-it previously dropped as raw syntax (such asjavascript:links and SVG data images) pass through the URL rules and render as text or alt text too. This is a breaking change for apps that relied on links.ComponentApiToProps: URL props (Image.url,Video.url,AudioPlayer.url, and any prop marked withmediaUrl()and friends) are now typedBoundProperty<string | undefined>, since the policy can block them.ComponentBinder.bind(context)path filters both top-level URL props (matchingGenericBinderprecedence: hosturlProperties, schema mark, built-in basic list) and nested URL properties (NestedUrlPropertiesdelegating toGenericBinder).ImageComponent,VideoComponent, andAudioPlayerComponentkeep a defense-in-depth media baseline check (BasicCatalogComponent.checkedMediaUrl, respectingsurface.urlSecurityPolicy.allowSvgDataUrls), matching@a2ui/web_coreuniversal components.Changes
@a2ui/markdown-itconformance/adapter/markdown_subset.yaml; the twoxfailedcases (link_rendered_as_text_without_target,image_syntax_not_rendered_as_image) now pass and are no longer marked as known gaps.createMarkdownRenderer(options?)andMarkdownItRendererOptions.validateLinkstays open soregisterUrlRuleshandles every scheme uniformly: enabled links are checked asnavigationURLs and images asmediaURLs, a blocked or throwing URL renders as its text or alt text, and without asanitizeUrl, the built-in baseline checks apply.@a2ui/angularBasicCatalogComponent.checkedMediaUrlruns the media baseline on resolved URLs inImageComponent,VideoComponent(urlandposterUrl), andAudioPlayerComponent, andImageComponentbinds[attr.src]="url() || null"so a blocked URL leaves outsrcinstead of loadingundefinedas a relative URL.TextComponentpassessanitizeUrl(the surface'ssanitizeUrlwith component info) toMarkdownRenderer.render.ComponentBinder.bind(context)filters top-level and nested URL props;bindNodealready gets filtered values fromGenericBinder.Image,Video, andAudioPlayerapply the built-in media baseline (v0.8 has no policy).AudioPlayeruses[attr.src], so a blocked or missing URL leaves outsrc.@a2ui/reactImage,Video(including the YouTube embed path), andAudioPlayerapply the built-in media baseline.MarkdownComponentContextreceivessanitizeUrl(url, context), bound to the surface of theTextit renders. The check can't travel in the host element's attribute, sorenderMarkdownHostkeeps it in a bounded table under an ID the element carries until the element connects. A host rendered without a check gets the baseline; a host whose check was pushed out of the table blocks every URL.@a2ui/lit(v0.8):Surface(styles.logoUrl),Image,Video, andAudioPlayernow share a localcheckMediaUrlhelper backed byPermissiveUrlSecurityPolicyinstead of the deprecatedsanitizeMediaUrl(so surrounding whitespace is blocked rather than trimmed, matching Angular and React v0.8).DefaultMarkdownRendererand Litmarkdowndirective) and an updated "Links and images" section in the markdown-it README.React and Lit v0.9/v1.0 use the universal basic catalog elements from
@a2ui/web_core, which #4104 already covers.Impact & risks
renderMarkdown(including AngularDefaultMarkdownRendererand Lit'smarkdowndirective fallback) lose rendered links and images until they switch tocreateMarkdownRenderer. This matches the documented Markdown subset that Flutter and SwiftUI already follow.MarkdownComponentContextneed to call the newsanitizeUrlprop for links and images; components that ignore it still render URLs without the policy.stringget a type error until they handleundefined.Testing
@a2ui/markdown-it: 27 unit tests (subset default, opt-in links and images,javascript:/vbscript:/file:/ SVG data links rendered as text/alt, autolinks, reference links, nested links/images, attribute breakout escaping, throwing sanitizers, baseline fallback, tag classes) and 7/7 Markdown subset conformance cases pass.@a2ui/angular:yarn testpasses (bind/bindNodeURL filtering including nested schemas andurlPropertiesoverrides, v0.9 Image baseline +allowSvgDataUrls, Text passingsanitizeUrl, v0.9 integration withAllowlistUrlSecurityPolicy, v0.8 Image/Video/AudioPlayer baseline rejections), plusangular-explorerpasses locally (yarn test).@a2ui/react:vitest run(555 passed, 1 skipped, including aMarkdownComponentContexttest with anAllowlistUrlSecurityPolicy) and explorer Karma (278/278) pass.@a2ui/lit: fullyarn testand ESLint pass.🤖 Agent-generated