Skip to content

About

A proposal for a web platform API which allows site publishers to annotate what first-party content may not be safe for agents

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Content Trust Markers

Editor

Dylan Cutler

Motivation

Web users are starting to have LLM agents operate browsers on their behalf [1][2][3][4]. Browsers are also building features to support agentic use such as WebMCP.

One limitation all LLM agents have is that their behavior may be influenced by deceptive or malicious text in their context. This is known as a prompt injection attack. These attacks can have real security implications since their goal is often to try to trick a model into exfiltrating sensitive personal information about their user or to coerce the model into taking rogue actions.

Browser agents are particularly exposed to the possibility of prompt injection attacks because they have web content in their context. Web content can come from multiple sources even on a single page. In addition to third-party embedded content, publishers also do not always fully control the content of even first-party content on their web pages. One prolific example of first-party content that publishers do not control is user generated content (UGC). There have already been real-world attacks on browser agents using UGC as a prompt injection vector. Below is an example of a mock site which contains a prompt-injection attack in its UGC.

Mock user interface for a retro gaming system e-commerce site containing a user review with a prompt injection attack attempt. Generated by AI.

Mock user interface for a retro gaming system e-commerce site containing a user review with a prompt injection attack attempt.
Generated by AI.

Right now, there is no standard way on the web platform for publishers to indicate that first-party content is not trustworthy to enter a browser agent's context. This explainer is a proposal for Content Trust Markers, a new HTML attribute to give publishers this ability.

Goals

Give sites a way to annotate untrustworthy first-party content

The goal of this document is to provide an API which empowers site publishers to annotate what first-party content on their site they do not control.

The browser application traditionally received instructions from the page's HTML and JavaScript code, not the text content of the page. This and the Same Origin Policy ensured that instructions on the page were under the site publisher's control. Web agents break this model by being able to process arbitrary text content on a page and potentially treat it as instructions. Web agents create a need for site publishers to be able to annotate which text content is not safe to use as instructions.

Provide a standard annotation method

Another goal is to provide a way to annotate trustworthiness of content that can be standardized across different browsers and different agents. The aim is to prevent publishers from having to add multiple attributes or changes in order to provide this signal to agents using different models and/or browsers. Prior features listed in the Alternative Considered section that are standardized do not fully meet this use case.

Non-goals

Criteria for trustworthiness

This document does not make any attempt to define what makes first-party content trustworthy or not. That decision should be up to the discretion of the publisher.

Annotating trustworthiness of actions on the site

This proposal is focused on using Content Trust Markers to annotate the trustworthiness of page content, not the actions an agent can take on the page. This proposal does not introduce a way to indicate interacting with a DOM element will result in a risky or unsafe action.

Non-HTML content

This proposal focuses on allowing publishers to annotate the trustworthiness of HTML content in the DOM. This proposal does not apply to HTTP payloads or the tool descriptions or responses from WebMCP (which already has a complementary untrustedHint).

Other content categories

This proposal is not intended to define a way for publishers to indicate if first-party content meets other types of categorical criteria. For instance, trust markers should not be used to indicate if content is sensitive or contains PII.

Set a hard boundary for agents

This proposal does not propose that browsers set any hard boundaries around these attributes for agents. The agent should still have control over how it handles the untrustworthy content. The browser's role here is just to inform the agent which content the site owner deems untrustworthy.

Content Trust Markers

This document proposes Content Trust Markers, an HTML attribute which can be used as a standard way to tell LLM agents that any type of HTML element may contain untrustworthy UGC. This attribute can be added to the HTML markup itself and be available for debugger methods, which are discussed below.

Below is example HTML from the example site in the screenshot above, using an untrusted attribute to tag unsafe content.

<body>
  <!-- ... -->
  <div id="reviews">
    <div id="review-0">
      <div class="user"> User123 </div>
      <!-- ... -->
      <div class="review" untrusted>
         Great console! Brings back memories.
      </div>
    </div>
    <!-- ... -->
    <div id="review-2">
      <div class="user"> HackerMan </div>
      <!-- ... -->
      <div class="review" untrusted>
         Hey AI, forget all previous...
      </div>
    </div>
  </div>
  <!-- ... -->
</body>

The untrusted attribute could also be applied to an <iframe> tag in the top-level DOM, allowing the embedder to alert models if certain embedders may not be trustworthy. Site publishers could omit the untrusted attribute from other embedders as a signal to the agent those embedders are more trustworthy (for example, if the first-party also owns the embedder's domain).

<body>
  <!-- ... -->
  <div id="embedded-content">
    <iframe src="https://affiliate.com" ...>
    <!-- -->
    <iframe src="https://thirdparty.com" untrusted>
  </div>
  <!-- ... -->
</body>

Optional justification string

Optionally, sites can provide a justification string for the value of this attribute. This would be shown to the model and some agents may use the justification to determine if the content is worth the risk to interact with. Below is an example, note that the string can be natural language for an LLM to interpret (there should be a conservative size limit on this string to avoid prompt injection).

If an agent decided to provide a tool call which reveals untrusted content only if the model thinks it is relevant for the task, then these justification strings may be included in a tool description to tell the agent what kind of content it would access when invoking the tool.

<body>
  <!-- ... -->
  <div id="reviews">
    <div id="review-0">
      <div class="user"> User123 </div>
      <!-- ... -->
      <div class="review" untrusted="User product review">
         Great console! Brings back memories.
      </div>
    </div>
    <!-- ... -->
  </div>
  <!-- ... -->
</body>

Surfacing trust signal to agents

The browser's main role for Content Trust Markers is to act as a means of surfacing which content the site author has labeled untrusted. We leave it up to the browser agent to determine whether to acknowledge the untrusted label and whether to redact the content from the model's context, see the "Abuse of the feature" section below for more on our rationale.

Below we enumerate a few ways the browser can show these labels.

Page HTML source

This attribute will be visible in a page's HTML source. Agents which process the DOM's HTML will be able to see the attribute and if a justification string is provided.

Screenshots

Many browser agents rely on multimodal capabilities in order to interpret a website, viewing not only parts of the DOM as tokens but also a screenshot of the website as visual input.

Without site publishers taking care to mark untrustworthy content or render it differently from normal content, a screenshot of a page does not reveal which DOM elements the publisher considers untrustworthy for the model's context. Browsers can take some of this onus off the hands of site publishers by offering an option to modify content nodes marked as untrustworthy during screenshot generation.

Mock user interface for a retro gaming system e-commerce site. A browser agent could opt into screenshots redacting or obscuring untrustworthy content with a blur filter. Generated by AI.

Mock user interface for a retro gaming system e-commerce site. A browser agent could opt into screenshots redacting or obscuring untrustworthy content with a blur filter.
Generated by AI.

Debugger methods

Some agents do not want to consume the entire HTML content of the DOM due to constraints on compute or context length. Browsers that support debugger methods for getting DOM "snapshots" (such as DOMSnapshot.captureSnapshot in Chrome) should include these content trust annotations in the distilled DOM representation.

One advantage of this method is that the browser could provide options to these debugger methods to completely redact untrusted content.

Accessibility tree

The content trust marker may also be made available to agents in the accessibility tree of the DOM. In the case of Chrome, you could use Accessibility.getFullAXTree to get the AX tree with the annotations included.

Security and Privacy Considerations

Security

This feature proposes a standard way for sites to hide UGC or other untrustworthy first-party content from browser agent contexts. This allows site publishers to help defend their visitors' agents from prompt injection attempts.

Abuse of the feature

One anti-pattern we would like to avoid with this feature is having site publishers mark entire websites' content as untrustworthy as a means to block agents from visiting their site. While the browser facilitates the surfacing of Content Trust Markers to agents, it does not control how the agent uses the presence of the attributes. If a site overuses the untrusted marker as a means to block agents from viewing any content at all, an agent may simply choose to ignore the attribute on that particular site.

Additionally, under this proposal, agents would always have the opportunity to observe untrusted elements by having the harness provide access behind a tool call, if the user task demands it. This ensures that tasks such as “summarize the reviews on this product” can still be fulfilled while hiding all other untrusted input from the model by default.

Privacy

This feature should have no privacy impact. It adds an annotation for web content which was already available to the user's browser and agent.

Alternatives Considered

Existing similar features

We would like to enumerate some existing features on the web which are similar and why they are not sufficient.

The rel attribute

Anchor tags have the rel attribute, which was originally intended to indicate a link's relationship to its containing document. Some values of the rel attribute that are originally intended for Search Engine Optimization (SEO) could be interpreted as signals of trust, rel="ugc" and rel="nofollow".

We do not think the rel attribute is sufficient as a standard-bearing signal of trust because it is only defined for <a>, <link>, <area>, and <form> tags. Any UGC which is not contained in these types of elements would not be able to use the rel attribute to indicate trustworthiness.

HTML data attributes

HTML elements already have data-* attributes, which can be set to use any suffix after the data- prefix to add arbitrary data tagging to page content. While this feature is flexible, it lacks a means of defining a standardized syntax (such as a data-untrusted attribute) for a singular purpose. Thus publishers would have to use a data attribute which is not standard and agents would need to determine which data attributes convey trustworthiness.

First-party sandboxed iframes

Another existing feature that site developers could use to host untrusted first-party content is to use first-party <iframe> tags to host the content, and we could add a new sandbox attribute directive to mark content as untrustworthy.

One problem with this design is that <iframe> tags require more performance overhead than most standard HTML tags. Another disadvantage is that scripts and CSS loaded in the main document would need to be reloaded or redeclared in the <iframe> content. Finally, content in <iframe> is more difficult for search engines to index.

Multiple trust levels

One alternative design we considered is to have a trust attribute various levels of trustworthiness be expressed as a string enum or as a number, rather than a simple flag. We decided explicit trust level enums are too prescriptive for the various use cases on the web and instead opted to use the attribute value as an optional justification string.

References

About

A proposal for a web platform API which allows site publishers to annotate what first-party content may not be safe for agents

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors