Skip to content

feat(conformance): add URL security policy proposal and shared conformance suite - #4102

Draft
nan-yu wants to merge 8 commits into
mainfrom
feat/url-security-spec
Draft

nan-yu wants to merge 8 commits into
mainfrom
feat/url-security-spec

Conversation

@nan-yu

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

Copy link
Copy Markdown
Collaborator

Summary

Adds the shared, language-agnostic contract for the URL security policy proposed in #4045: a proposal doc and a conformance suite that every core SDK will run. No SDK behavior changes in this PR. The TypeScript implementation follows in a stacked PR, and the Python, Dart and Swift implementations follow after the TypeScript API has been reviewed.

Changes

  1. specification/proposals/url_security_policy.md defines:
    • the three URL contexts (media, navigation, iframe)
    • the x-a2ui-url-context catalog annotation (set by catalog authors, never sent by agents, ignored by validators)
    • the built-in baseline every policy runs first
    • the permissive and allowlist policies, and the order in which checks run
    • how SDKs apply the policy: blocked URLs resolve to no value, each URL is checked once, and openUrl checks the policy before the host handler and fails with URL_BLOCKED
  2. conformance/core/url_security_policy.yaml adds 28 cases in two actions:
    • url_policy_check (20 cases) checks a policy directly: scheme smuggling, data: URLs, relative URLs, host and wildcard lists, ports, and rewrites.
    • url_policy_resolution (8 cases) checks resolved component props and openUrl on a surface, covering data-bound values, formatString, a custom catalog with nested annotated props, check-once with a rewrite, and openUrl blocked versus allowed.
  3. conformance/conformance_schema.json and conformance/README.md describe the two new case shapes.
  4. The Python, TypeScript, Dart and Swift core harnesses record the new cases as skipped with the reason URL security policy not implemented yet (#4045), following each harness's existing convention, so CI stays green until each SDK implements the policy.

The shared basic catalog (catalogs/basic/v1/catalog.json) is not annotated in this PR. Annotating it would break each SDK's catalog to_json and round-trip conformance until every SDK can emit the keyword. Until a later cross-SDK change annotates it, SDKs treat Image.url, Video.url, Video.posterUrl and AudioPlayer.url as media through a built-in list.

Verification

  1. uv run --all-packages pytest -q python/a2ui_core/tests conformance/tests: 2321 passed, 60 skipped, 3 xfailed.
  2. node typescript/core/web_core/tests/conformance/conformance_test.mjs: passes, with the 28 new cases skipped.
  3. dart test test/conformance in dart/a2ui_core: all passed.
  4. conformance/scripts/check_executed_cases.py --corpus core passes for the Python and web_core harnesses, and check_feature_coverage.py --static reports no findings.
  5. The schema rejects malformed policies (for example media on a permissive policy, an unknown rewrite key, allowRelative: [iframe]).
  6. The Swift harness change mirrors the existing unsupportedCoreSuites entries; it was not compiled locally.

Part of #4045.

🤖 Agent-generated

@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-4102/

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

@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 proposal and conformance test suite for a new URL security policy (tracking issue #4045). It adds a detailed specification proposal document, updates the conformance JSON schema, and introduces a comprehensive YAML test suite covering baseline, allowlist, and resolution behaviors. Additionally, it marks these new tests as skipped or unimplemented across the Dart, Python, Swift, and TypeScript SDK test harnesses since the policy is not yet implemented. I have no feedback to provide as there are no review comments.

…mance suite (#4045)

Adds specification/proposals/url_security_policy.md, which defines the
media, navigation and iframe URL contexts, the x-a2ui-url-context catalog
annotation, the baseline every policy runs, and the permissive and
allowlist policies.

Adds conformance/core/url_security_policy.yaml with two actions:
url_policy_check checks URLs directly against a policy, and
url_policy_resolution checks how URL props resolve on a v1.0 surface and
how openUrl behaves. The Python, TypeScript, Dart and Swift core harnesses
record the suite as skipped until each SDK implements the policy.
… URLs (#4045)

An allowlist entry such as host:443 limits the port even though it is the
scheme's default, and an allowed host hidden in the userinfo, query, or
fragment of a URL doesn't match.
@nan-yu
nan-yu force-pushed the feat/url-security-spec branch from 53f8e27 to 183e38e Compare December 3, 2026 00:31
github-actions Bot added a commit that referenced this pull request Dec 3, 2026
github-actions Bot added a commit that referenced this pull request Dec 3, 2026

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