Skip to content

Set and check file access ​

中文 · Configuration and activation · Protection guide

Give the protected program write access to its work, read access to reference material, and no access to the sensitive paths covered by your policy. Choose the platform and execution entry first: Windows Candidate rules and macOS/Linux wrapper policies use different schemas.

File permissions provide neither backups nor undo. A writable file can be overwritten or deleted. Readable content can still leave through an allowed network path; configure network and content inspection separately.

Choose a recipe ​

The evidence below was collected on December 3, 2026. This guide assembles those recorded operations and public configuration examples; it adds no new cross-platform acceptance run. Commands with your replacement paths must be checked in your own environment.

Platform / entryRecipe and recorded resultLimit
Windows personal CLI, installed 0.11.84, run / self-confinePrepared workspace writable; read-only fixture readable but overwrite/delete denied; prepared denied fixture unreadableRequires existing authorized paths. This is not 0.11.85 acceptance or a recipe for changing arbitrary plugin paths
macOS personal CLI, v0.11.85 archive / executable 0.11.48, SeatbeltDeclared workspace writable; declared reference readable but overwrite/delete denied; undeclared sensitive fixture unreadablemacOS 26.6.1 arm64. Codex 0.152.0 also completed these file operations through host-network run; another integration needs its own coverage check
Linux personal CLI, same release / executable 0.11.48, bubblewrap runWorkspace writable; reference readable but overwrite/delete returned Read-only file systemPrivileged Docker Desktop linuxkit, emulated amd64. Undeclared sensitive reads succeeded without Landlock; no general custom-directory deny-read recipe is established here
Windows DSH / OpenCode pluginsInspect bundled path rules, use normal authorization/reopen, then check the protected toolsPublic plugin guides establish no arbitrary directory editor. Do not edit generated Effective files or restore retired overrides
macOS/Linux desktop plugins; managed/SaaS on any platformUse the delivered integration or administrator instructionsThe records here establish no configurable three-directory recipe for these entries; do not borrow the personal CLI syntax

Full records: Windows, macOS, Linux. Product controls can be checked with a shell; no model account is required. Repeat through the Agent's actual tool only when checking integration coverage.

Windows: check three prepared paths ​

Use the EXE and authorized effective.yaml from the same installation. Before starting, select three existing, owned disposable test directories covered by effective read_write, read_only and deny rules. Keep the last two outside the writable workspace. Do not use real credential or application-data directories as test fixtures. If your installation has no supported workflow to prepare such paths, use the default deletion demo and record the missing custom-path entry instead.

Configuration and activation ​

For a delivery with supported Candidate authoring, the relevant entries are in policy.filesystem, for example:

yaml
# Shape of entries in an existing Windows Candidate; not a complete policy.
- id: file-check-work
  path: 'C:\YourPreparedTest\work'
  access: read_write
  lifecycle: existing
  inheritance: descendants
- id: file-check-reference
  path: 'C:\YourPreparedTest\reference'
  access: read_only
  lifecycle: existing
  inheritance: descendants
- id: file-check-private
  path: 'C:\YourPreparedTest\private'
  access: deny
  lifecycle: existing
  inheritance: descendants

These are schema examples, not newly authorized paths. Preserve the existing Candidate's other entries, identifiers, network rules and compatibility settings. Follow the selected installation's configuration workflow to generate Effective and complete required preparation/authorization; editing YAML alone grants nothing. The recorded Windows check used existing preparation and made no permission changes. The plugin baseline filesystem_coverage.root: read_write allows more than the workspace; adding one writable rule does not narrow it.

In ordinary PowerShell, replace the configuration and directory paths:

powershell
$finshieldExe = 'C:\Program Files\FinSAFE\finsafe.exe'
$effectiveYaml = 'C:\YourFinShieldConfig\effective.yaml'
$workspace = 'C:\YourPreparedTest\work'
$readOnlyDir = 'C:\YourPreparedTest\reference'
$deniedDir = 'C:\YourPreparedTest\private'
$shellExe = Join-Path $env:WINDIR 'System32\WindowsPowerShell\v1.0\powershell.exe'
& $finshieldExe --version
$checkText = & $finshieldExe prepare check --yaml-path $effectiveYaml --json
if ($LASTEXITCODE -ne 0) { throw 'Preparation check failed' }
if (($checkText | ConvertFrom-Json).result -ne 'same') { throw 'Selected configuration is not prepared' }

All three directories must already exist. Create only new marker files from this ordinary host session. Keep this session open for independent checks:

powershell
$fixtureName = 'file-check-' + [guid]::NewGuid().ToString('N') + '.txt'
$workFile = Join-Path $workspace $fixtureName
$roFile = Join-Path $readOnlyDir $fixtureName
$denyFile = Join-Path $deniedDir $fixtureName
foreach ($path in @($workFile, $roFile, $denyFile)) {
    if (Test-Path -LiteralPath $path) { throw 'Fixture already exists' }
    [IO.File]::WriteAllText($path, 'file-check-original')
}
$roHash = (Get-FileHash -LiteralPath $roFile -Algorithm SHA256).Hash
$denyHash = (Get-FileHash -LiteralPath $denyFile -Algorithm SHA256).Hash
@($workFile, $roFile, $denyFile) # Copy these exact paths into the protected session.
Set-Location -LiteralPath $workspace
& $finshieldExe self-confine --yaml-path $effectiveYaml --stdio inherit -- $shellExe -NoLogo -NoProfile

Run each operation in the new protected PowerShell ​

Replace all three example filenames with the paths printed above. Run each line separately and retain its output/error; an exception must not prevent the remaining checks:

powershell
$workFile = 'C:\YourPreparedTest\work\file-check-REPLACE.txt'
$roFile = 'C:\YourPreparedTest\reference\file-check-REPLACE.txt'
$denyFile = 'C:\YourPreparedTest\private\file-check-REPLACE.txt'
[IO.File]::WriteAllText($workFile, 'file-check-updated')
[IO.File]::ReadAllText($workFile)
[IO.File]::ReadAllText($roFile)
[IO.File]::WriteAllText($roFile, 'file-check-unexpected-change')
[IO.File]::Delete($roFile)
[IO.File]::ReadAllText($denyFile)
exit

Expected: workspace read returns file-check-updated; reference read returns file-check-original; reference overwrite/delete and private read report access denial. A wrong path or missing fixture is not a successful denial. The Windows record observed those effects through both run and self-confine on installed 0.11.84. To check run separately, pass one inline operation to the same EXE with run --yaml-path <effective> --stdio capture --json -- <PowerShell> -NoProfile -Command <operation>; do not infer its outcome from the other launch route.

Back in the ordinary host session, independently inspect the files:

powershell
[IO.File]::ReadAllText($workFile) -eq 'file-check-updated'
(Get-FileHash -LiteralPath $roFile -Algorithm SHA256).Hash -eq $roHash
(Get-FileHash -LiteralPath $denyFile -Algorithm SHA256).Hash -eq $denyHash

All should be True; a missing file or changed hash fails the check. After the protected process exits, remove only the three recorded fixture files from this host session. Do not delete their parent directories or alter authorization receipts.

macOS: writable, read-only and omitted sensitive paths ​

Use the matching CLI archive, system Seatbelt / /usr/bin/sandbox-exec, and a POSIX shell. Record finsafe --version; the cited v0.11.85 archive contains 0.11.48. The configuration fields below follow the public isolation policy; the dated record supplies the observed effects. This is a shell file test, not an Agent policy with all its login/runtime directories.

In an ordinary shell, choose a new directory under your home, outside /tmp and existing work trees. Keep the root path printed below for cleanup:

sh
fileCheckRoot="$HOME/finsafe-file-check-$(date +%Y%m%d%H%M%S)-$$"
mkdir -m 700 "$fileCheckRoot" || exit 1
mkdir "$fileCheckRoot/work" "$fileCheckRoot/reference" "$fileCheckRoot/private"
printf '%s\n' reference-original > "$fileCheckRoot/reference/fixture.txt"
printf '%s\n' reference-original > "$fileCheckRoot/reference/delete-me.txt"
printf '%s\n' synthetic-not-a-key > "$fileCheckRoot/private/credential.txt"
printf '%s\n' "$fileCheckRoot"

Save this as $fileCheckRoot/policy.yaml. Replace ABSOLUTE_TEST_ROOT with the printed absolute directory; YAML does not substitute that placeholder. Keep the sensitive directory and its parent out of both allow lists:

yaml
schema_version: 1
kind: local-wrapper
program_mode: short-lived
degrade:
  allow_fallback: false
audit:
  require_policy_digest: true
  require_resolved_posture: true
stdio:
  mode: inherit
network: host
resources:
  memory_max: '128M'
  pids_max: '32'
  cpu_max: '100000 100000'
  timeout_ms: 10000
filesystem:
  read_only_paths:
    - /usr
    - /bin
    - /sbin
    - 'ABSOLUTE_TEST_ROOT/reference'
  read_write_paths:
    - 'ABSOLUTE_TEST_ROOT/work'

Activate and check the three targets ​

Use the matching CLI's absolute path if it is not on PATH. From the writable directory, start a fresh run for each operation. There is no Windows prepare step; saving does not update a running process. See CLI activation.

sh
cd "$fileCheckRoot/work" || exit 1
finsafe --policy "$fileCheckRoot/policy.yaml" run -- /bin/sh -c 'printf "%s\n" allowed > allowed.txt; cat allowed.txt'
finsafe --policy "$fileCheckRoot/policy.yaml" run -- /bin/cat "$fileCheckRoot/reference/fixture.txt"
finsafe --policy "$fileCheckRoot/policy.yaml" run -- /bin/sh -c 'printf "%s\n" changed > "$1"' file-check "$fileCheckRoot/reference/fixture.txt"
finsafe --policy "$fileCheckRoot/policy.yaml" run -- /bin/rm "$fileCheckRoot/reference/delete-me.txt"
finsafe --policy "$fileCheckRoot/policy.yaml" run -- /bin/cat "$fileCheckRoot/private/credential.txt"

Expected on the recorded macOS entry: writable create/read succeeds; reference read succeeds; overwrite/delete and omitted sensitive-path read fail with Operation not permitted. Check each operation and the inner program result, not only the wrapper exit status. A parse/startup error is not a file denial.

Independently check from the ordinary host shell that the workspace contains allowed, both reference files still contain reference-original, and the private file still contains synthetic-not-a-key. For example:

sh
cat "$fileCheckRoot/work/allowed.txt"
cat "$fileCheckRoot/reference/fixture.txt" "$fileCheckRoot/reference/delete-me.txt"
cat "$fileCheckRoot/private/credential.txt"

To change a target from writable to read-only, move its path from read_write_paths to read_only_paths, save, and start a new process. The measured activation sequence confirmed that an old process kept write access while a new one denied writes. Do not grant a sensitive target's parent as a shortcut: an undeclared child can become readable through that parent. self-confine uses a separate policy copy with program_mode: interactive; its separately recorded outcome does not make an untested launch a pass.

Linux: check write restrictions and the read boundary separately ​

Use the Linux archive and its matching finsafe-helper, finsafe-supervisor and finsafe-landlock-shim. Record the distribution/kernel/architecture, bubblewrap and namespace availability, Landlock/seccomp status and cgroup v2 delegation. Run finsafe probe --json and finsafe doctor; follow Linux setup for the selected entry. Do not disable confinement or enable fallback to obtain a successful start.

For the recorded bubblewrap run scope, prepare the disposable fixtures and wrapper above on the Linux host, then run the same individual shell operations. These wrapper fields are shared inputs; the macOS enforcement result does not carry over. The cited public 0.11.48 linux-x64 archive ran in privileged Docker Desktop linuxkit with functional delegated cgroup v2, no Landlock and no functional seccomp:

TargetObserved result in that Linux environmentHow to interpret it
Declared writable workspaceWrite/read succeededWritable recipe for the named entry
Declared read-only referenceRead succeeded; overwrite/delete denied with Read-only file systemRead-only bind behavior; independently check original contents and file presence
Omitted custom sensitive path outside workspaceRead succeededOmission is insufficient for deny-read on this host. Do not use this configuration to protect such data
Existing synthetic file at the built-in ~/.ssh/id_rsa deny pathRead denied in a separate follow-upCoverage of that existing explicit path, not every credential filename or custom directory

The built-in-path result is evidence, not an instruction to create or use real SSH credentials for this test. On the same public x64 guest, self-confine stopped before the command with landlock policy was only partially enforced; no successful self-confine recipe is offered for that environment.

The Linux record separately reports an aarch64 unix CLI 0.9.105, Landlock ABI 8, and denied reads of an undeclared custom credential outside its workdir. That is a different binary. It is not acceptance for public linux-x64 0.11.48 or a native Linux server. For a general custom-directory deny-read recipe, obtain matching public-package evidence on the intended Landlock-capable host before relying on it; this guide supplies no verified copy-and-run recipe for that combination.

Path rules, filenames and cleanup ​

QuestionWhat to check
Is everything outside the workspace denied?Windows plugin defaults retain a broad writable baseline. macOS omission denied the recorded paths. Linux without Landlock still allowed undeclared reads. Select the correct row above
Does an SSH rule protect a key saved elsewhere?A rule for .ssh does not establish coverage for a custom directory, backup or another drive. Test a synthetic file at the custom location through the actual entry
Does a directory rule match every .env or *.pem file?Directory paths and filename/glob rules are different. Neither Windows plugin default has a universal .env filename rule. Do not put a glob into filesystem[].path or assume a Unix built-in deny layer applies on Windows
Can read-only data reach a model?Yes, if a permitted request reads and sends it. File read-only status is separate from network/PII controls

End the test processes before cleanup. Remove only the named markers and newly created test directories whose absolute paths you recorded; keep the original configuration and authorization intact. Do not recursively remove a parent work directory. Preserve original errors and independently observed file results when a check fails, then get help. A failed check is a result to investigate, not a reason to weaken the policy.