Skip to content

runtime: fail closed on unreadable sandbox grant sources - #3436

Closed
adilalperenciftci wants to merge 1 commit into
aether-lang-dev:mainfrom
adilalperenciftci:fix/sandbox-source-fail-closed
Closed

adilalperenciftci wants to merge 1 commit into
aether-lang-dev:mainfrom
adilalperenciftci:fix/sandbox-source-fail-closed

Conversation

@adilalperenciftci

Copy link
Copy Markdown
Contributor

Summary

I reproduced the preload layer silently becoming inactive when an explicitly configured shared-memory or grant-file source could not be opened. The intercepted process then ran without grant checks even though containment had been requested.

This change:

  • distinguishes "no source configured" from "configured source failed";
  • keeps interception active with zero grants when every configured source is missing, unreadable, malformed, or oversized;
  • preserves grant-file fallback when a shared-memory source is unavailable;
  • bounds both source forms to 8 KiB and refuses truncated file input before parsing;
  • removes the parser's one-byte boundary read when a buffer has no NUL terminator.

Verification

  • BEFORE: missing SHM and missing grant-file cases both read the protected file and exited zero.
  • AFTER: missing SHM, missing file, and oversized file cases fail closed.
  • Valid grant-file fallback after a missing SHM source: passed.
  • Preload with no configured source remains inert: passed.
  • Sandbox preload lookup, child signal-safety, and fork-grant integrations: passed.
  • make check-tests: passed.
  • make test: 634 passed, 0 failed on Ubuntu VM.
  • make check-changelog: passed.

Signed-off-by: Adil Alperen Çiftci <adilalperenciftci@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 08:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@paul-hammant

Copy link
Copy Markdown
Collaborator

Thanks, reviewed and folded into the batch #3456 with your authorship kept on the commit. This PR will be closed when #3456 merges.

🤖 Generated with Claude Code

@paul-hammant

Copy link
Copy Markdown
Collaborator

Merged as part of #3456 (merge 9364d6b), with your authorship on the commit. Thank you, @adilalperenciftci: this was a real fix, carefully tested, and it's appreciated.

🤖 Generated with Claude Code

adilalperenciftci pushed a commit to adilalperenciftci/aether that referenced this pull request Oct 29, 2026
pos += snprintf(...) could pass buf[8192] (snprintf returns the would-be
length), so the following (pos+1)-byte write read past the stack buffer.
Fail the spawn (-1) when an entry does not fit, on Linux and BSD. Adds
sandbox_grant_overflow. ATOMIC_VAR_INIT is deprecated since C17.

docs: note aether-lang-dev#3436 and aether-lang-dev#3440 behaviour in containment-sandbox.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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