hn.today

Locking down untrusted JavaScript after it loads

transcend.io13 points3 comments
Screenshot of Locking down untrusted JavaScript after it loads

A Content Security Policy (CSP) is valuable but limited: it permits or blocks connections to listed hosts, yet cannot govern what an approved script does after loading or control every navigation. The piece illustrates this with a fictional checkout-page attack in which a trusted vendor’s script changes and tries four ways to steal payment data. Without runtime controls, the script reads form fields and sends them to a lookalike site, while the CSP allows it because the vendor’s host is approved. Adding Transcend’s Airgap browser script creates a runtime layer that checks requests, cookies, inserted scripts, and navigations against privacy data flows and consent rules.

In the demonstration, Airgap blocks a request to an unknown server; the generated CSP blocks data exfiltration hidden in a CSS image request; and navigation control cancels a redirect to an unknown destination. A request to an already approved analytics host remains a gap: it is held for users without consent but can proceed for those who opted in. Custom request overrides can inspect and block such traffic, while Subresource Integrity and script-change detection add protection against modified scripts. The recommended rollout is to observe traffic in report-only mode, classify hosts, block unknown requests, enable navigation controls, and apply strict CSP on high-risk pages. Airgap does not replace nonce- or hash-based CSP, directly inspect allowed scripts’ behavior, or cover every browser navigation.

Read on transcend.io3 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Security

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.