Skip to content

Add seccomp profile generator with CI verification - #370

Open
mertbozfakioglu wants to merge 6 commits into
mainfrom
mertbozfakioglu/seccomp-profile-generator
Open

Add seccomp profile generator with CI verification#370
mertbozfakioglu wants to merge 6 commits into
mainfrom
mertbozfakioglu/seccomp-profile-generator

Conversation

@mertbozfakioglu

Copy link
Copy Markdown
Contributor

Summary

  • Adds charts/retool/seccomp/generate.sh that derives nsjail-seccomp.json and gvisor-seccomp.json from the pinned upstream Docker default seccomp profile (moby/profiles@61eaf32) plus Retool-specific syscall additions
  • Replaces hand-maintained profiles with reproducible generated output — to update, bump the commit pin in generate.sh and re-run
  • Regenerating picks up ~15 newer syscalls in the gVisor profile that the hand-crafted version was missing (getxattrat, listmount, mseal, personality, statmount, uretprobe, etc.)
  • Adds CI workflow (.github/workflows/seccomp-profiles-synced.yaml) that runs generate.sh --check on PRs touching seccomp files

How it works

nsjail profile: Takes Docker default verbatim (all conditional rules, arg-based rules, full archMap) and inserts one unconditional ALLOW block for the 6 syscalls nsjail needs: clone, clone2, mount, pivot_root, sethostname, umount2.

gVisor profile: Flattens all Docker default ALLOW rules for x86_64 + aarch64 into one sorted allowlist, changes defaultErrnoRet to ENOSYS (38), then adds labelled rule groups for the syscalls gVisor/pasta need beyond the default (clone, clone3, unshare, setns, sethostname, mount, umount2, pivot_root, ptrace).

Updating the upstream pin

# Edit UPSTREAM_COMMIT in generate.sh, then:
charts/retool/seccomp/generate.sh
git diff charts/retool/files/  # review changes

Test plan

  • generate.sh produces both profiles without errors
  • generate.sh --check passes (generated output matches checked-in files)
  • CI workflow runs on this PR and passes

🤖 Generated with Claude Code

Add a generate.sh script that derives nsjail-seccomp.json and
gvisor-seccomp.json from the upstream Docker default seccomp profile
(moby/profiles@61eaf32) plus Retool-specific additions, replacing the
hand-maintained profiles with reproducible generated output.

The nsjail profile preserves the Docker default structure and inserts an
unconditional ALLOW block for the 6 syscalls nsjail needs. The gvisor
profile flattens all Docker default rules for x86_64/aarch64 into one
allowlist (errno ENOSYS), then adds labelled gVisor/pasta rule groups.

Regenerating the gvisor profile picks up ~15 newer syscalls from the
current Docker default (getxattrat, listmount, mseal, personality,
statmount, uretprobe, etc.) that the hand-crafted version was missing.

A CI workflow verifies checked-in profiles match the generator output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
charts/retool/seccomp/generate.sh Adds the pinned upstream fetch and deterministic generation/checking flow for both seccomp profiles.
.github/workflows/seccomp-profiles-synced.yaml Adds path-filtered CI verification and now pins checkout to a full commit SHA.
charts/retool/files/gvisor-seccomp.json Replaces the manually maintained gVisor profile with generator output and additional required syscall groups.
charts/retool/files/nsjail-seccomp.json Regenerates the nsjail profile from the pinned upstream default plus nsjail-specific allowances.

Reviews (2): Last reviewed commit: "Bump chart version to 6.11.26" | Re-trigger Greptile

Comment thread charts/retool/seccomp/generate.sh
Comment thread .github/workflows/seccomp-profiles-synced.yaml Outdated
mertbozfakioglu and others added 4 commits September 10, 2026 16:18
…ons pattern

Instead of flattening the Docker default into a monolithic allowlist for
gVisor, both profiles now use the same structure: Docker default as-is,
with labelled unconditional ALLOW rules inserted before the capability-
gated section. For gVisor the header is also patched (defaultErrnoRet →
ENOSYS, archMap narrowed to x86_64 + aarch64).

This makes the generator logic a shared insert_rules helper called by
both profiles, and makes the output trivially diffable against Docker
default — a customer can see exactly which syscalls Retool adds and why.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each profile now starts with a comment field linking to the upstream
Docker default commit and naming the generator script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Cache file now includes the upstream commit in its name, so changing
  UPSTREAM_COMMIT in generate.sh invalidates the stale cache automatically.
- Pin actions/checkout to its v3 commit SHA to make the CI dependency
  immutable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

mertbozfakioglu commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mertbozfakioglu
mertbozfakioglu marked this pull request as ready for review September 11, 2026 18:26

Copy link
Copy Markdown
Contributor Author

@greptile review again

local patched
patched="$(mktemp)"
jq '
.defaultErrnoRet = 38 |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@westrik I'd appreciate a closer look at the err number and architecture bits

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultErrnoRet should be 38 (ENOSYS) to avoid a gvisor panic on older Linux kernels that don't implement the mseal system call. https://github.com/google/gvisor/blob/release-20260601.0/pkg/sentry/platform/systrap/stub_unsafe.go#L334

archMap is needed to configure how seccomp translates system calls across platforms. Previously we had subarchitectures: [] for aarch64, but I think updating that to match the seccomp default should be safe.

@mako-taco mako-taco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea seems logical, but someone else who actually understands seccomp can hopefully provide actual review on the generation script.

mertbozfakioglu commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Tested the editor flow, backend functions, and published app flow on a self hosted instance and all works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants