Web Environment Integrity API
Tags: web
Published: 2023-09-11 17:28:34

---
title: Web Environment Integrity API
published: true
date: 2023-07-26 22:20:00 UTC
tags: Web
canonical_url: https://kevincox.ca/2023/07/26/web-environment-integrity-api/
---

<main style="--width:min(36em,100%);display:grid;grid-template-columns:1fr var(--width) 1fr;overflow:auto;padding:0;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><p style="box-sizing:border-box;grid-column:2;margin:.4em"><a href="https://chromestatus.com/feature/5796524191121408" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Google has proposed adding the “Web environment integrity API” to Chrome</a>. The goal of this API is to ensure that the user does not have control over their device. The API will provide cryptographically secure attestation that a “trusted party” is in control of the device.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">The proposed API is very harmful to individual freedoms and will destroy the open web. The consequence of Chrome implementing this API is that everyone using hardware or software that isn’t entirely under control of a small number of massive corporations will begin to get cut off from the web.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">These “trusted parties” will very likely be Apple, Google and Microsoft. If you don’t have a device controlled by one of these for-profit companies you will be cut of from many websites. No Linux, no Steam Deck, no custom Android ROMs, no rooted devices. If you are in control of your device you will be locked out. There will be no easy or reliable workarounds. I do not welcome our new corporate overlords.</p>
<h2 id="stated-goals" style="box-sizing:border-box;grid-column:2;margin:1.5em .4em .4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#stated-goals" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Stated Goals</a></h2>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">The <a href="https://github.com/RupertBenWiser/Web-Environment-Integrity/blob/main/explainer.md#goals" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">stated goals</a> are:</p>
<ol style="box-sizing:border-box;grid-column:2;margin:.4em">
<li style="box-sizing:border-box;margin:0">Detect social media manipulation and fake engagement.</li>
<li style="box-sizing:border-box;margin:0">Detect non-human traffic in advertising to improve user experience and access to web content</li>
<li style="box-sizing:border-box;margin:0">Detect phishing campaigns (e.g. webviews in malicious apps)</li>
<li style="box-sizing:border-box;margin:0">Detect bulk hijacking attempts and bulk account creation.</li>
<li style="box-sizing:border-box;margin:0">Detect large scale cheating in web based games with fake clients</li>
<li style="box-sizing:border-box;margin:0">Detect compromised devices where user data would be at risk</li>
<li style="box-sizing:border-box;margin:0">Detect account takeover attempts by identifying password guessing</li>
</ol>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">I find this rationale an unconvincing argument for such extreme measures.</p>
<h3 id="anti-bot" style="box-sizing:border-box;grid-column:2;margin:.4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#anti-bot" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Anti-Bot</a></h3>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">1, 2, 4 and 7 are effectively the same and don’t actually seem to be significantly impaired by this API. These are all aimed at preventing “bot traffic”. This is any sort of traffic (usually automated) that is high volume and not by the intended users of the service. This is often spam, scraping or brute force attacks. While this API would inconvenience botters I don’t see how this API actually prevents this traffic. There is nothing stopping these “bots” from using an “Approved” Chrome browser on an “Approved” OS on “Approved” hardware. These bots are actually low-paid humans more often than one would expect.</p>
<h3 id="anti-malware" style="box-sizing:border-box;grid-column:2;margin:.4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#anti-malware" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Anti-Malware</a></h3>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">3 and 6 are similar. They are trying to ensure that the client device is “trustworthy” as defined by the server. For example this API could detect if an OS has been compromised by malware either at the OS level or a modified browser. For example your bank could deny you access to their website if your device seems to be compromised.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">This seems reasonable at first, but falls apart after brief consideration. If your device has malware which is going to steal banking credentials why bother actually connecting to the legitimate bank website? Spoofing login pages is trivial and would completely bypass the need to produce a valid attestation. The attacker can then use an “Approved” device to log into the bank account. This does add minor obstacles but doesn’t seem to provide any fundamental security that justifies such a heavy-handed approach.</p>
<h3 id="trusted-client-side-computing" style="box-sizing:border-box;grid-column:2;margin:.4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#trusted-client-side-computing" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Trusted Client-side Computing</a></h3>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">Number 5 appears to be the real goal. Google wants to be able to run code on your device that you have no control over. They want to verify that you can’t access any data that they send and can’t modify how the code works. They want to ensure that the user has no <a href="https://www.gnu.org/philosophy/keep-control-of-your-computing.en.html" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">control over their computing</a>.</p>
<h2 id="upsides" style="box-sizing:border-box;grid-column:2;margin:1.5em .4em .4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#upsides" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Upsides</a></h2>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">The upsides of this API are few and far between. Trusted clients can be useful for a small number of things. For example anti-cheat may be an acceptable use case if users agree to use it. Many games want to send data to the client for performance reasons but the user should not be able to access it. For example the location of an enemy that is about to walk around a corner. This is useful for lag compensation but the precedence of the enemy should not be revealed until the correct time.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">Unfortunately we have been shown time and time again that we can’t trust capitalist corporations with these powerful interfaces to control users. Their goal is to make money, not to promote the public good. This API <strong style="box-sizing:border-box;margin:0">will</strong> be abused.</p>
<h2 id="downsides" style="box-sizing:border-box;grid-column:2;margin:1.5em .4em .4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#downsides" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Downsides</a></h2>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">The downside is that we lose all agency in our computing. The websites we visit will place requirements on the software and hardware that we can use. In practice this means that you better be running an OS and Browser developed by Google, Apple or Microsoft. If you aren’t a big corporation you won’t be able to make or modify a browser or an operating system. You won’t be able to access your bank, government services or <a href="https://archive.is/7MUcw" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">even McDonald’s</a> from any “unapproved” software or hardware.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">This is effectively banishing Free Software from accessing the web. Let’s reflect on <a href="https://www.gnu.org/philosophy/free-sw.html#four-freedoms" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">the 4 essential freedoms for software that respects the user</a>.</p>
<ol start="0" style="box-sizing:border-box;grid-column:2;margin:.4em">
<li style="box-sizing:border-box;margin:0">The freedom to run the program as you wish, for any purpose.</li>
<li style="box-sizing:border-box;margin:0">The freedom to study how the program works, and change it so it does your computing as you wish. Access to the source code is a precondition for this.</li>
<li style="box-sizing:border-box;margin:0">The freedom to redistribute copies so you can help others.</li>
<li style="box-sizing:border-box;margin:0">The freedom to distribute copies of your modified versions to others. By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.</li>
</ol>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">Freedom 0 is violated. I am unable to run the software on the operating system or hardware of my choice, and if the remote Attestation API is disabled I can not continue to use these features.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">Freedom 1 is violated. If I change the program in any way I can no longer run it. So I am unable to compute as I wish. It is Google’s way or the highway.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">Freedom 2 is mostly preserved. However, the signature can be revoked or the remote Attestation API can start refusing to sign attestations at any time.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">Freedom 3 is violated as it depends on being able to modify the program (Freedom 1) which is not available.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">So any “trustworthy web environment” can provide at most ½ of the four essential freedoms. It is clear that this program is no longer an agent of the user, but an agent of mega-corporations that will be the attestation providers.</p>
<h2 id="are-you-just-being-dramatic" style="box-sizing:border-box;grid-column:2;margin:1.5em .4em .4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#are-you-just-being-dramatic" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Are You Just Being Dramatic?</a></h2>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">I don’t think so. We have already seen this happen on Android with <a href="https://developer.android.com/training/safetynet/attestation" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">SafetyNet Attestation API</a> and then the <a href="https://developer.android.com/google/play/integrity" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Play Integrity API</a>. These APIs are already used to restrict the freedom of users. The most common examples are Google Pay and banking apps but there is a long tail of others such as Netflix, Snapchat, Pokemon Go, McDonald’s and even Mario Run. That’s right, if you want to play Mario you need a device that is certified to be in control of Google, not the user.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">If this interface becomes available on the web the same thing is sure to happen. More and more sites will start requiring it. After all 95% of users are running “Approved” setups anyway. <em style="box-sizing:border-box;margin:0">That other 5% is probably just bots anyway /s</em></p>
<h2 id="what-can-we-do-about-it" style="box-sizing:border-box;grid-column:2;margin:1.5em .4em .4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#what-can-we-do-about-it" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">What Can We Do About It?</a></h2>
<h3 id="browser-diversity" style="box-sizing:border-box;grid-column:2;margin:.4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#browser-diversity" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Browser Diversity</a></h3>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">The best long-term option is to use a different browser. Google can push these user-hostile features because Chrome has 70% market share (or up to 85% depending on how you count). If there were a diversity of competitive browsers Google wouldn’t be able to force their features into the web. They would have to get agreement from the other browsers.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">But with the majority of users using Chrome, they can just push features. Sites will start using them and this will push more people to Chrome because if their bank refuses to support Firefox most people will switch so that they can access their bank. <a href="https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguish" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Extend and Extinguish</a>.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">In general, I would say that the best options are <a href="https://firefox.com" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Firefox</a> and Safari. But <a href="https://developer.apple.com/news/?id=huqjyh7k" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Safari already shipped an equivalent API</a> and attestation is in their favour because it means that they get to sell more locked down hardware. So in this case Firefox is our best option.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">Other options are Chromium derivatives like <a href="https://brave.com/" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Brave</a>, <a href="https://www.microsoft.com/edge" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Edge</a> and <a href="https://www.opera.com/" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Opera</a>. However, these still provide power to Google as new Chromium features end up in derivatives by default. While specific derivatives may block specific features it is infeasible for them to maintain too many patches on top of Chromium due to ongoing cost. For example <a href="https://www.ghacks.net/2022/09/29/brave-browser-manifest-v2-extensions-after-v3-update/" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Brave has made some claims around supporting Manifest v2 features after Chrome removes them</a>, but it is clear that they are careful what they are promising, as maintaining full support and a new extension store is clearly too much work for the company. So while using a derivative is better than using Chrome directly it still gives Google power over the web. Power that they have shown they can’t be trusted with.</p>
<h3 id="regulatory-interference" style="box-sizing:border-box;grid-column:2;margin:.4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#regulatory-interference" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Regulatory Interference</a></h3>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">It is clear that Google is abusing its dominant position to push features that are hostile to the public. Regulatory bodies should be able to prevent them from doing this. Please reach out to whoever you can.</p>
<h3 id="raise-awareness" style="box-sizing:border-box;grid-column:2;margin:.4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#raise-awareness" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Raise Awareness</a></h3>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">The last is making noise. Enough user backlash will likely make them back out. Or at least it will drive users away from Chrome and leave a big stain on any websites refusing to support other browsers.</p>
<h2 id="how-is-this-possible" style="box-sizing:border-box;grid-column:2;margin:1.5em .4em .4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#how-is-this-possible" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">How is This Possible?</a></h2>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">The attestation will be cryptographically signed. It will ensure that you are only running supported hardware and software in a supported configuration. At a high level it looks like this:</p>
<ol style="box-sizing:border-box;grid-column:2;margin:.4em">
<li style="box-sizing:border-box;margin:0">When your device boots the first code to execute is firmware on a hardware security module (HSM).</li>
<li style="box-sizing:border-box;margin:0">This module will cryptographically verify the bootloader before launching it.</li>
<li style="box-sizing:border-box;margin:0">The bootloader will cryptographically verify the operating system before starting it.</li>
<li style="box-sizing:border-box;margin:0">The operating system will cryptographically verify the browser.</li>
<li style="box-sizing:border-box;margin:0">When the JavaScript Web Integrity API is called the browser will request a signature from the OS.</li>
<li style="box-sizing:border-box;margin:0">The OS will request a signature from the HSM.</li>
<li style="box-sizing:border-box;margin:0">The signature will be provided to the JavaScript caller to be relayed to the website.</li>
<li style="box-sizing:border-box;margin:0">The website will validate that this signature is from a trusted party and deny entry otherwise.</li>
</ol>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">If at any point a signature verification fails or an untrusted operation is performed either the computer will stop (refuse to boot) or trust will be revoked. For example if you attach a debugger to the browser the process will be marked as tainted and the OS will refuse to perform signatures (step 5). If an untrusted driver is loaded into the OS it will inform the TPM which will lock the signing key until a clean boot can restore the system to a trusted state. The TPM is a hardened device specifically designed to make extracting the private key difficult.</p>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">This system is well designed. It will likely not be possible to work around it without finding exploits. Exploits will be found as this is a large software stack but they will be fixed rapidly, and the external signing service can refuse to sign attestations from unpatched machines. Apple has shown us that large companies can maintain an OS stack like this with minimal exploits. While iOS jailbreaks are found they are rare and quickly fixed. This isn’t just something that we can hack around with a patched browser.</p>
<h2 id="other-overviews" style="box-sizing:border-box;grid-column:2;margin:1.5em .4em .4em"><a href="https://kevincox.ca/2023/07/26/web-environment-integrity-api/#other-overviews" style="box-sizing:border-box;color:inherit!important;margin:0;text-decoration:inherit;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray;text-shadow:inherit!important">Other Overviews</a></h2>
<p style="box-sizing:border-box;grid-column:2;margin:.4em">These are in no particular order and I haven’t read them all carefully, but they appear to give valuable insights and different explanations of the topic that may be interesting.</p>
<ul style='box-sizing:border-box;grid-column:2;list-style:disc;list-style:"- ";margin:.4em'>
<li style="box-sizing:border-box;margin:0"><a href="https://www.theregister.com/2023/07/25/google_web_environment_integrity/" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Google Web Environment Integrity draft draws developer rage</a></li>
<li style="box-sizing:border-box;margin:0"><a href="https://interpeer.io/blog/2023/07/google-vs-the-open-web/" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Google vs. the Open Web</a></li>
<li style="box-sizing:border-box;margin:0"><a href="https://vivaldi.com/blog/googles-new-dangerous-web-environment-integrity-spec/" style="box-sizing:border-box;margin:0;text-decoration:underline;-webkit-text-decoration-color:gray;text-decoration-color:gray">Unpacking Google’s new “dangerous” Web-Environment-Integrity specification</a></li>
</ul></main>