Skip to content

v0.15.0

Choose a tag to compare

@Ikepeeee Ikepeeee released this 01 Nov 15:20
· 314 commits to main since this release
286b1fd

What a container reaches can be narrowed, listed, and constrained.

A container environment mounts the project directory read-write at /work, and is on a network that reaches anywhere. v0.15.0 adds run options that narrow the mount, three listings of what each environment's commands may reach, and within: a constraint on a function or a module that lask check enforces before anything runs. The defaults are unchanged.

Breaking changes

  • Haskell API (experimental): DFunction gains a Maybe AccessSpec before its body, and DeclF gains DWithin (#150). RunSpec gains runMounts, the mounts of the base directory (#150).

Language

  • within { ... } bounds the host files and networks that the commands of a function, or of every declaration of a module, may reach (spec 5, 10.11, #150).

    within { volumes: false }
    
    build(): String within { files: { ".": "ro", "dist": "rw" }, network: "none" } = $[node] npm run build
    
    • The fields are files (as base_access takes them), volumes (false, or the host paths allowed), network ("none" or "default") and publish. A function's constraint can narrow its module's, never widen it. #local exceeds any constraint that gives a field.
    • The check is static. It follows every function a covered declaration calls, in any module, and lambdas passed to one. An environment passed as an argument is checked at the call that passes it. For the function run or eval invokes, it is checked with the arguments the command line gives, before anything runs. lask cmd checks the word it runs against the constraint of the module that declares it.
    • A run option is read as a literal, a top-level binding, a parameter, or an expression that only computes. Such an expression has no effect, reads no process variable and awaits nothing, and is evaluated with effects refused, so a library that builds its options with functions is read as a run would read them (#150).
    • A broken constraint is reported in what it covers: at the call that leads out of it, not inside the function called, which keeps to its own (#151).
    • New codes: E-TYPE-WITHIN-SPEC, E-TYPE-WITHIN-EXCEEDED (shown to exceed the constraint) and E-TYPE-WITHIN-UNPROVEN (cannot be shown to stay within it).
    • within is a contextual keyword, so within = 1 is still a name, and the editor shows it as a keyword only where it is one.

Environments

  • base_access narrows what the mount of the project directory permits: "rw" (the default), "ro", "none", or a table of paths where the longest wins, as in {".": "ro", "dist": "rw", ".env": "none"}. A path given "none" is hidden. A path given rw or ro must exist, and must resolve inside the project directory with links followed, or the command does not run (spec 10.2, #150).
  • base_mount mounts the project directory elsewhere than /work, and the default working directory moves with it (spec 10.2, 10.5, #150).
  • Both apply to commands, the file functions, with_container and the probe of lask sync.

CLI

  • lask envs files, lask envs network and lask envs access [<function>] list, for each environment the commands may run in, the host paths it may read or write, the network it is on, and both in one line. CHECK shows what the constraints find. They read the source without running anything, and still list a program that breaks its constraints (spec 11.4, #150).

Examples

  • The language guide's environments topic narrows sealed with base_access: "ro" and constrains sealed_user with within (#150).
  • The local LLM example stops its web UI by the port it holds. Its image tag finds nothing, since Lask runs the digest the lock pins (#152).
  • The examples that use lask-module-tools move to v0.7.0. Its Go runs on 1.27.2, so the Go supply-chain example's release passes its vulnerability scan again.