Repository navigation
v0.15.0
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):
DFunctiongains aMaybe AccessSpecbefore its body, andDeclFgainsDWithin(#150).RunSpecgainsrunMounts, 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(asbase_accesstakes them),volumes(false, or the host paths allowed),network("none"or"default") andpublish. A function's constraint can narrow its module's, never widen it.#localexceeds 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
runorevalinvokes, it is checked with the arguments the command line gives, before anything runs.lask cmdchecks 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) andE-TYPE-WITHIN-UNPROVEN(cannot be shown to stay within it). withinis a contextual keyword, sowithin = 1is still a name, and the editor shows it as a keyword only where it is one.
- The fields are
Environments
base_accessnarrows 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 givenrworromust exist, and must resolve inside the project directory with links followed, or the command does not run (spec 10.2, #150).base_mountmounts 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_containerand the probe oflask sync.
CLI
lask envs files,lask envs networkandlask 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.CHECKshows 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
sealedwithbase_access: "ro"and constrainssealed_userwithwithin(#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.