PeaBox Lab › PeaLang › Learn › Chapter 23 › Lesson 1

Part IV — Expert Production Engineering · Chapter 23 · Lesson 1 of 6 · 2 min read

Lesson 1: Browser-Safe Capabilities and Execution Constraints

Lesson level: Expert

Purpose: Browser safety requires explicit host enforcement and a verified execution path. Permission validation and policy metadata are useful inputs, not complete sandbox proof.

Learning Objectives

1.1 Concepts

A browser profile narrows authority relative to an unrestricted host. browser_profile.py allows console, storage.read, storage.write, and http.fetch through validate_browser_permissions; it rejects unknown permissions such as process. WasmPolicy is a different contract: it records network and filesystem denial by default while allowing the clock. These profile names are not interchangeable, and policy metadata does not itself install enforcement. The host must restrict imports, origin access, storage, resource use, and sensitive data.

1.2 Annotated Example

Verified Python calls: validate_browser_permissions(["console"]) and WasmPolicy(allow_network=False, allow_filesystem=False). The first validates capability names; the second describes an artifact policy. Neither call proves that a JavaScript loader enforces fuel or memory. For deterministic fixtures, configure or replace clock access explicitly.

1.3 Guided Practice

Classify console output, local storage, a remote fetch, and process execution. Identify which policy governs each action and which host component must enforce it.

1.4 Common Mistakes

Do not equate browser-safe with authorized, store secrets in client-side storage, or label fuel metadata as a functioning browser instruction budget.

1.5 Hands-On Lab

Deliverable: Artifact report, permission matrix, and observed support/failure evidence.

1.6 Review Questions

Why are browser permissions and WasmPolicy separate? Why can clock access affect reproducibility? Where is fuel enforcement demonstrated?

1.7 Applied Challenge

Specify an offline rules-demo profile with no sensitive data, no remote requests, bounded inputs, and a visible unavailable-execution state.

Lesson Summary

Browser safety requires explicit host enforcement and a verified execution path. Permission validation and policy metadata are useful inputs, not complete sandbox proof.

Lesson status: Draft complete; ready for review. Source-checked, not browser-execution validated.

← Previous Next →