Skip to content

docs: add a URL security guide - #4113

Draft
nan-yu wants to merge 8 commits into
feat/url-security-web-corefrom
docs/url-security-guide
Draft

nan-yu wants to merge 8 commits into
feat/url-security-web-corefrom
docs/url-security-guide

Conversation

@nan-yu

@nan-yu nan-yu commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds a guide for the URL security policy that #4104 adds to @a2ui/web_core: how a host restricts the hosts components and functions may load, open, or embed, and how catalog, component, and function authors keep their URLs inside the policy.

Part of #4045. Stacked on #4104 (base feat/url-security-web-core). Related to #3899, which asks for a security concept page; this guide covers the URL part and can be linked from that page once it exists.

Live Preview: https://a2ui.org/pr-preview/pr-4113/

Modified pages:

Reviewer focus

  1. API accuracy against feat(web_core): add URL security policy and plumb it to components and functions #4104: urlSecurityPolicy and openUrlHandler processor options, AllowlistUrlSecurityPolicy options (media, navigation, iframe, allowRelative, rewrite, allowSvgDataUrls, urlProperties), mediaUrl() / navigationUrl() / iframeUrl(), sanitizeUrl on DataContext / ComponentContext / SurfaceModel, and the URL_BLOCKED warning fields.
  2. The SDK availability table lists the Python (feat(python): add URL security policy to a2ui_core #4119), Dart (feat(dart): add URL security policy to a2ui_core #4114), and Swift (feat(swift): add URL security policy to A2UICore #4121) core work as in progress, and Kotlin as not available. Only TypeScript is documented as available. A second table maps the main names in each SDK (policies, processor option, open handler, sanitizeUrl, schema helper, blocked-URL channel, agent check) as the open PRs define them; update it if those PRs rename anything.
  3. The "Check payloads on the agent" and "Find unmarked URL properties" sections describe checkPayloadUrls in @a2ui/agent and the Catalog.fromJson() / assemble_catalog.py warnings from feat(tooling): warn about unmarked catalog URL props and add an agent pre-send URL check #4116. Merge this PR after feat(tooling): warn about unmarked catalog URL props and add an agent pre-send URL check #4116, or drop those two sections if feat(tooling): warn about unmarked catalog URL props and add an agent pre-send URL check #4116 changes shape.
  4. Whether the guide belongs in the guides sidebar after "How to Define a Catalog".

Changes

  1. New guide docs/site/src/content/docs/guides/url-security.mdx with a four-step core path (set a policy, mark URL properties, check URLs custom code builds, watch for blocked URLs) and additional sections on the baseline, allowlist host rules, rewrite hooks, custom policies, openUrlHandler, the urlProperties map, the agent payload check, unmarked URL property warnings, limits (custom code fetching on its own, CSP as a backstop), and SDK availability.
  2. "URL properties" section in "How to Define a Catalog" showing x-a2ui-url-context in catalog JSON.
  3. A "URLs" entry in the resolved property types of "Authoring Universal Web Components".
  4. Sidebar entry in astro.config.mjs, plus llms.txt and SITE_OUTLINE.md entries.

Impact & risks

Docs only. The guide describes APIs that land with #4104 and #4116, so it must not merge before those PRs.

Testing

  1. npm --prefix docs/site run build: builds, check-links reports 0 errors across internal links and anchors.
  2. python3 docs/scripts/validate_doc_examples.py: 0 errors.
  3. Prettier check on the changed .mdx files.
  4. Type-checked every @a2ui/web_core snippet on the page against the sources of feat(web_core): add URL security policy and plumb it to components and functions #4104 with tsc --noEmit (scratch file, not committed). Checked the @a2ui/agent snippet's names and options against the source of feat(tooling): warn about unmarked catalog URL props and add an agent pre-send URL check #4116.

🤖 Agent-generated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new guide, "How to Restrict URLs with a URL Security Policy," along with corresponding updates to the site outline, configuration, and existing guides to document URL security features. The review feedback points out that the Kotlin SDK is missing from the SDK availability table in the new guide and provides a suggestion to add it.

Comment on lines +327 to +332
| SDK | Status |
| :---------------------------- | :---------------------------------------------------------------------- |
| TypeScript (`@a2ui/web_core`) | Available |
| Python (`a2ui_core`) | In progress ([#4045](https://github.com/a2ui-project/a2ui/issues/4045)) |
| Dart (`a2ui_core`) | In progress ([#4045](https://github.com/a2ui-project/a2ui/issues/4045)) |
| Swift (`A2UICore`) | In progress ([#4045](https://github.com/a2ui-project/a2ui/issues/4045)) |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The SDK availability table is missing the Kotlin (androidx.a2ui) SDK, which is one of the primary supported platforms in A2UI. Please add Kotlin to the table to ensure complete and accurate documentation of SDK availability.

| SDK                           | Status                                                                  |
| :---------------------------- | :---------------------------------------------------------------------- |
| TypeScript (`@a2ui/web_core`) | Available                                                               |
| Python (`a2ui_core`)          | In progress ([#4045](https://github.com/a2ui-project/a2ui/issues/4045)) |
| Dart (`a2ui_core`)            | In progress ([#4045](https://github.com/a2ui-project/a2ui/issues/4045)) |
| Swift (`A2UICore`)            | In progress ([#4045](https://github.com/a2ui-project/a2ui/issues/4045)) |
| Kotlin (`androidx.a2ui`)      | In progress ([#4045](https://github.com/a2ui-project/a2ui/issues/4045)) |

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a Kotlin row in 7931c0e, but as "Not available" rather than "In progress": the rollout in #4045 covers TypeScript, Python, Dart, and Swift, and no Kotlin work is underway. The table now also has a column for the agent payload check.

🤖 Agent-generated

@nan-yu
nan-yu force-pushed the docs/url-security-guide branch from b3d4606 to 7931c0e Compare November 10, 2026 05:30
@nan-yu
nan-yu added this pull request to stack #4134 November 10, 2026 18:06
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs Site Preview Deployed

Preview URL: https://a2ui.org/pr-preview/pr-4113/

Modified pages in this PR:

Built from commit e9d91d5 · Workflow run · GitHub Pages may take ~30–60s to propagate updates. This preview is removed automatically when the PR closes.

github-actions Bot added a commit that referenced this pull request Nov 10, 2026
@nan-yu
nan-yu force-pushed the docs/url-security-guide branch from 96625a2 to edd3913 Compare December 3, 2026 00:52
github-actions Bot added a commit that referenced this pull request Dec 3, 2026
@nan-yu
nan-yu force-pushed the docs/url-security-guide branch from edd3913 to d492158 Compare December 3, 2026 00:56
github-actions Bot added a commit that referenced this pull request Dec 3, 2026
@nan-yu
nan-yu force-pushed the docs/url-security-guide branch from d492158 to 5227231 Compare December 3, 2026 01:10
github-actions Bot added a commit that referenced this pull request Dec 3, 2026
@nan-yu
nan-yu force-pushed the docs/url-security-guide branch from 5227231 to 8dde27a Compare December 3, 2026 01:19
@nan-yu
nan-yu force-pushed the docs/url-security-guide branch from e9d91d5 to 7cd12f5 Compare December 3, 2026 19:13
Add a guide for the URL security policy (#4045): setting a policy on the
message processor, marking custom component URL properties with the
schema helpers or x-a2ui-url-context, checking URLs custom code builds
with sanitizeUrl, URL_BLOCKED warnings, allowlist rules, rewrite hooks,
custom policies, openUrlHandler, the urlProperties map, limits, and SDK
availability. Link it from the catalog and universal component guides.
… security guide

Document checkPayloadUrls in @a2ui/agent and the unmarked URL property
warnings, and list per-SDK status for the core policy and the agent
check, including Kotlin.
@nan-yu
nan-yu force-pushed the docs/url-security-guide branch from 050a3aa to 7c908ca Compare December 3, 2026 19:31

This branch has not been deployed

No deployments
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.

1 participant