Skip to content

Session Roles

Each frontend connection is assigned a role. Five built-in roles:

RoleDescription
adminFull access. Config, other sessions, audit log.
userStandard interactive use. Own processes, plugins, jobs.
script(default) Like user without job control, plugins, or admin.
ciRestricted spawn via allowlist. Full redirect and env.
restrictedMinimal. No arbitrary processes, no redirects, no env mutation.
CapabilityDescription
spawnAnyAllow spawning any process from PATH.
spawnAllowlistComma-separated permitted commands (when spawnAny is false).
fileRedirectAllow >, >> file writes.
fileSandboxRestrict writes to a directory. Uses textual path normalization only.
envMutationAllow modifying env vars.
envSafelistComma-separated env vars that can be modified.
pluginAccessAllow calling plugin methods.
pluginAllowlistComma-separated permitted plugins.
configModifyAllow modifying config at runtime.
sessionManageAllow managing other sessions (list, kill).
jobControlOwnAllow fg/bg/jobs for own jobs.
jobControlOthersAllow managing other sessions’ jobs.
auditAccessAllow audit commands and log access.

Defined in ~/.lash/roles.conf:

[role:ci]
spawnAny = false
spawnAllowlist = make, cmake, ninja, gcc, g++, clang, git, cargo, dub
fileRedirect = true
fileSandbox = /home/ci/builds
envMutation = true
envSafelist = PATH, HOME, CC, CXX
pluginAccess = false
[role:monitoring]
spawnAny = false
spawnAllowlist = ps, top, df, free, uptime
fileRedirect = false
auditAccess = true

Custom roles override built-in defaults of the same name.

role # prints current role
role user # switch to user role
role admin # requires audit password

Switching to a role with auditAccess requires entering the audit password. The password is verified against the stored verification hash in ~/.lash/audit.key.

When a role denies an action, the shell returns a Problem/Suggestion error:

Problem: This session (role: restricted) cannot run 'curl'.
Suggestion: 'curl' is not in the allowlist. Switch to a 'user' session.

Set the default role in ~/.lash/config:

[settings]
role.default = script