Proposal for simplifying browser security
Proposal for simplifying browser security
Attribute-Level Immutability (ALI) 
Status: Draft / Proposal
Concept: Introducing an "Immutable Prefix" (!) for HTML attributes to radically simplify web security and performance.
1. The Problem
Current Content Security Policy (CSP) implementations are cumbersome and prone to error. To secure inline styles or attributes, developers must:
- Maintain heavy HTTP headers with nonces or hashes (increasing latency).
- Manage complex build-time synchronizations.
- Deal with the DOM as a "Shared State" where any script can manipulate any attribute at any time.
2. The Solution: The Space-Separated ! Marker
An attribute starting with an space-separated exclamation mark (e.g., ! style="...", ! href="...") is flagged as immutable by the browser's initial HTML parser.
- Initialization: Only the initial streaming parser is allowed to set these flagged attributes.
- Write Protection: Once the element exists in the DOM, any attempt to modify this attribute via JavaScript (e.g., setAttribute, .style, or .dataset) is blocked by the engine.
- Security: Injected scripts cannot modify existing ! attributes. Since the browser treats dynamically injected ! strings as standard attributes (lacking the internal "immutable" flag from the parser), the integrity of the server-originated code remains intact.
To ensure 100% backward compatibility, the "Immutable Marker" (!) is used as a standalone prefix:
- Selective Locking (!): <div title="changeable" ! style="color:red"> Locks only the single, immediately following attribute.
- Global Tag Locking: (!!) <a !! href="/" title="Home"> Placing a double exclamation mark after the tag name signals the engine to freeze every attribute within this element.
<!-- Single attributes -->
<a target="_blank" ! href="https://trusted.com" ! rel="noopener">
<!-- All attributes at once -->
<img !! src="photo.jpg" width="800" height="600" loading="lazy" alt="...">
<!-- Mixed -->
<form !! action="/submit" method="post">
<input type="text" ! value="initial" name="data">
</form>
<a target="_blank" ! href="https://trusted.com" ! rel="noopener">
<!-- All attributes at once -->
<img !! src="photo.jpg" width="800" height="600" loading="lazy" alt="...">
<!-- Mixed -->
<form !! action="/submit" method="post">
<input type="text" ! value="initial" name="data">
</form>
3. Key Advantages
- Performance: Security checks move from O(n) (header list lookups) to O(1) (simple bit-check on the element).
- Zero Overhead: No bloated HTTP headers; security intent is declared directly where it’s needed.
- Accessibility: Unlike Canvas-based rendering, ALI preserves the full semantic structure of the DOM for screen readers.
- Backward Compatibility: Legacy browsers simply ignore the ! before the attribute name, ensuring the page remains functional while modern browsers unlock the secure "fast path."
4. Use Cases
- Gaming: Protecting UI elements from console-based memory manipulation (! style).
- FinTech: Preventing malware from tampering with hidden transaction fields (! value).
- Protection against URL Manipulation: <a ! href="https://my-bank.com">Login</a> Prevents attackers from using XSS to silently change link destinations (href) or iframe/image sources (src), effectively neutralizing phishing redirects and UI redressing.
- General Web: Achieving strict CSP compliance without the "unsafe-inline" headache.
Vorschlag zur Vereinfachung der Browser Sicherheit
Vorschlag zur Vereinfachung der Browser Sicherheit
Attribute-Level Immutability (ALI) 
Status: Entwurf / Vorschlag
Status: Entwurf / Vorschlag
Konzept: Einführung eines "Immutable-Prefix" (!) für HTML-Attribute zur drastischen Vereinfachung der Web-Sicherheit.
1. Das Problem
Die aktuelle Content Security Policy (CSP) ist fehleranfällig und schwer zu warten. Um Inline-Styles oder Attribute sicher zu machen, müssen Entwickler:
- Riesige Header mit Nonces oder Hashes mitschleifen (erhöhte Latenz).
- Komplexe Build-Systeme pflegen.
- Trotzdem bleibt das DOM ein "Shared State", in dem jedes Skript jedes Attribut manipulieren kann.
2. Die Lösung: Die leerzeichengetrennte !-Markierung
Ein Attribut, dem ein durch Leerzeichen getrenntes Ausrufezeichen vorangestellt ist (z. B. ! style="...", ! href="..."), wird vom Browser-Parser als unveränderlich (immutable) markiert.
- Initialisierung: Nur der initiale HTML-Parser darf diese Attribute setzen.
- Schreibschutz: Sobald das Element im DOM existiert, schlägt jeder Versuch fehl, dieses Attribut per JavaScript zu ändern (z. B. element.setAttribute oder element.style.color = ...).
- Sicherheit: Ein injiziertes Skript kann keine bestehenden !-Attribute ändern. Da der Browser dynamisch injizierte !-Attribute als "normale" Strings behandelt (ohne das interne Immutable-Flag des Parsers), bleibt die Integrität des vom Server gesendeten Codes gewahrt.
Um eine 100%ige Abwärtskompatibilität zu gewährleisten, wird die Markierung wie folgt verwendet:
- Selektive Sperrung (!): <div ! style="color:red"> Sperrt nur das unmittelbar folgende Attribut (style). Ältere Browser ignorieren das !, während ALI-fähige Engines den Style einfrieren.
- Globale Tag-Sperrung (!!): <a !! href="/" title="Home"> Das Platzieren eines doppelten Ausrufezeichens direkt nach dem Tag-Namen signalisiert der Engine, alle Attribute dieses Elements zu versiegeln.
<!-- Single attributes -->
<a target="_blank" ! href="https://trusted.com" ! rel="noopener">
<!-- All attributes at once -->
<img !! src="photo.jpg" width="800" height="600" loading="lazy" alt="...">
<!-- Mixed -->
<form !! action="/submit" method="post">
<input type="text" ! value="initial" name="data">
</form>
<a target="_blank" ! href="https://trusted.com" ! rel="noopener">
<!-- All attributes at once -->
<img !! src="photo.jpg" width="800" height="600" loading="lazy" alt="...">
<!-- Mixed -->
<form !! action="/submit" method="post">
<input type="text" ! value="initial" name="data">
</form>
3. Warum das besser ist als der Status Quo
- Performance: Sicherheitschecks werden von O(n) (Listenabgleich im Header) auf O(1) (Bit-Check am Element) reduziert.
- Latenz: Keine aufgeblähten HTTP-Header mehr.
- Barrierefreiheit: Die semantische Struktur des HTML bleibt voll erhalten (im Gegensatz zu Canvas-Rendering).
- Abwärtskompatibilität: Ältere Browser ignorieren das ! vor dem Attribut, ohne die Seite zu zerstören.
4. Anwendungsbeispiele
- Spiele: ! style schützt das UI vor Manipulationen durch Konsolen-Cheats.
- Finanzen: ! value in Hidden-Fields verhindert, dass Malware Transaktionsdaten im DOM manipuliert.
- Schutz vor URL-Manipulation: <a ! href="https://my-bank.com">Login</a> Verhindert, dass Angreifer durch XSS-Skripte die Ziele von Links (href) oder Quellen von Iframes/Bildern (src) ändern, um Benutzer auf betrügerische Seiten umzuleiten.
- Allgemein: Strikte CSP ohne unsafe-inline-Kopfschmerzen.