Skip to content

shopping cards: sanitize model-authored text before it reaches the host - #9

Open
vishkaty wants to merge 1 commit into
anthropics:mainfrom
vishkaty:pr/shopping-cards-sanitize-model-text
Open

shopping cards: sanitize model-authored text before it reaches the host#9
vishkaty wants to merge 1 commit into
anthropics:mainfrom
vishkaty:pr/shopping-cards-sanitize-model-text

Conversation

@vishkaty

Copy link
Copy Markdown

A pick's reason on the products card is the model's own text, but it travels to
the host's renderer in the same payload as third-party records. It went through
unsanitized: a fence marker or an invisible character the model copied from a
listing reached the page intact.

enrich_products and the streaming partial now pass the reason through the
storefront fence's sanitize_text, the same treatment every tool result gets.
Found by a conformance statement over the executor (HS-S-06).

Found by running a conformance statement against the reference at fd4d592; the test in this change fails without the fix and passes with it. The full suite, ruff check, ruff format --check and scripts/check.py are clean on this branch.

A pick's `reason` on the products card is the model's own text, but it travels to
the host's renderer in the same payload as third-party records. It went through
unsanitized: a fence marker or an invisible character the model copied from a
listing reached the page intact.

`enrich_products` and the streaming partial now pass the reason through the
storefront fence's `sanitize_text`, the same treatment every tool result gets.
Found by a conformance statement over the executor (HS-S-06).
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.

2 participants