Web Environment Integrity

A Collection of Interesting Ideas,

Issue Tracking:
GitHub
Editor:
(Google)

Abstract

An API used to integrity check the environment a web page runs on. This check is performed by trusted attesters.

1. Introduction

Todo

1.1. Motivations

Todo

1.2. Examples

Requesting environment integrity attestation.
// getEnvironmentIntegrity expects a "content binding" of the request you are
// about to make. The content binding protects against this information being
// used for a different request.
// The contentBinding will be concatenated with top-level domain name and hashed
// before it is sent to the attester.

const contentBinding = "/someRequestPath?requestID=xxxx" +
    "Any other data needed for a request-specific contentBinding...";

const attestation = await navigator.getEnvironmentIntegrity(contentBinding);

console.log(attestation.encode());
"base-64 encoding of the attestation payload and signature approx 500 bytes; see below for details"

// More on attestation validation below
const response = await fetch(`/someRequest?requestID=xxxx&attested=${attestation.encode()}`);
// Do something with this ...

2. Key terms

The web environment is defined as TODO

3. Attesters

The term attester refers to a third party capable of returning an Integrity verdict. A Integrity verdict refers to a response that confirms if the attester trusts the web environment the user agent is executing in.

The user agent connects to the attester through an AttesterConnection.

The user agent SHOULD use separate AttesterConnections if the AttesterConnection stores state in the Integrity verdict that can be used for cross site tracking.

3.1. Token Format

Todo

3.2. Browser Acceptance Requirements

Todo

3.3. AttesterConnection

[Exposed=Window]
interface AttesterConnection {
  ArrayBuffer getAttestation(DOMString contentBinding);
};
getAttestation

Returns a COSE signed CBOR object as an ArrayBuffer from the attester that contains the Integrity verdict.

4. Web Environment Integrity API

4.1. Extensions to Navigator

[Exposed=Window]
partial interface Navigator {
  [SecureContext] Promise<EnvironmentIntegrity> getEnvironmentIntegrity(DOMString contentBinding);
};
The user agent has the global attesterConnection, which is an AttesterConnection with the attester.

The getEnvironmentIntegrity(contentBinding) method, when invoked, runs these steps:

  1. Let promise be a new promise

  2. Run the following steps in parallel:

    1. Let environmentIntegrity be a new EnvironmentIntegrity

    2. Set environmentIntegrity.attestationToken to attesterConnection.getAttestation(contentBinding). If this fails then:

      1. Reject promise with a TODO Exception

      2. Abort these steps

    3. Resolve promise with environmentIntegrity

  3. Return promise

4.2. EnvironmentIntegrity

[Exposed=Window]
interface EnvironmentIntegrity {
  readonly attribute ArrayBuffer attestationToken;
  DOMString encode();
  object toJSON();
};
attestationToken

The attestation token is a COSE signed CBOR object as an ArrayBuffer from the attester.

encode()

The encode method will return a Base64 string representation of the attestation token.

toJSON()

The toJSON method returns a human readable JSON representation of the attestation token. It will first decode the CBOR object. Useful for local debugging.

5. Security and privacy considerations

5.1. Security considerations

Todo

5.2. Privacy considerations

Todo

Conformance

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example", like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with class="note", like this:

Note, this is an informative note.

Index

Terms defined by this specification

Terms defined by reference

References

Normative References

[HTML]
Anne van Kesteren; et al. HTML Standard. Living Standard. URL: https://html.spec.whatwg.org/multipage/
[INFRA]
Anne van Kesteren; Domenic Denicola. Infra Standard. Living Standard. URL: https://infra.spec.whatwg.org/
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119
[WEBIDL]
Edgar Chen; Timothy Gu. Web IDL Standard. Living Standard. URL: https://webidl.spec.whatwg.org/

IDL Index

[Exposed=Window]
interface AttesterConnection {
  ArrayBuffer getAttestation(DOMString contentBinding);
};

[Exposed=Window]
partial interface Navigator {
  [SecureContext] Promise<EnvironmentIntegrity> getEnvironmentIntegrity(DOMString contentBinding);
};

[Exposed=Window]
interface EnvironmentIntegrity {
  readonly attribute ArrayBuffer attestationToken;
  DOMString encode();
  object toJSON();
};