Skip to content

fix: Safe rendering of sandbox violation messages - #391

Open
abhisek wants to merge 2 commits into
mainfrom
fix/handle-safe-sandbox-violation-rendering
Open

fix: Safe rendering of sandbox violation messages#391
abhisek wants to merge 2 commits into
mainfrom
fix/handle-safe-sandbox-violation-rendering

Conversation

@abhisek

@abhisek abhisek commented Jul 25, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 25, 2026 13:04
@safedep

safedep Bot commented Jul 25, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep Github App

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov-commenter

codecov-commenter commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.37931% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.81%. Comparing base (d9240ee) to head (8430aea).

Files with missing lines Patch % Lines
sandbox/platform/landlock_seccomp_linux.go 63.63% 16 Missing ⚠️
internal/ui/sandbox_violation.go 70.00% 1 Missing and 5 partials ⚠️
sandbox/platform/probe_apparmor_linux.go 88.88% 1 Missing and 1 partial ⚠️
sandbox/violation.go 91.30% 1 Missing and 1 partial ⚠️
sandbox/platform/landlock_translator_linux.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #391      +/-   ##
==========================================
+ Coverage   58.66%   58.81%   +0.15%     
==========================================
  Files         222      222              
  Lines       15276    15352      +76     
==========================================
+ Hits         8961     9029      +68     
- Misses       5501     5507       +6     
- Partials      814      816       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a23717890d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +203 to +206
safe := *violation
safe.Target = quoteTerminalText(safe.Target)
safe.Process = quoteTerminalText(safe.Process)
safe.RuleLabel = quoteTerminalText(safe.RuleLabel)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Escape the raw audit log before terminal rendering

When a macOS Seatbelt denial contains a terminal control sequence, seatbelt_diagnostics_darwin.go preserves the complete event as RawLog, and FormatSandboxDetails prints that field verbatim. This display copy escapes Target, Process, and RuleLabel but leaves RawLog unchanged, so pmg sandbox violations explain can still execute attacker-controlled ANSI sequences despite the new sanitization. Escape RawLog (and any other rendered audit-derived fields) in this copy as well.

Useful? React with 👍 / 👎.

Comment on lines +60 to +64
if current, currentErr := p.env.readFile(currentPath); currentErr == nil && isPMGAppArmorProfile(string(current)) {
return sandbox.ProbeResult{
Name: sandbox.ProbeAppArmorUserns,
Status: sandbox.ProbeStatusOK,
Summary: "AppArmor profile permits pmg to create user namespaces",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Verify userns permission instead of trusting the profile name

When the sysctl is restrictive and any AppArmor profile named pmg is attached, this returns OK even if that profile lacks the required userns rule. /proc/self/attr/apparmor/current reports only the active label and mode, not its permissions, so an old or misconfigured pmg profile still leaves Landlock and Bubblewrap failing while sandbox doctor claims they are usable. Use a capability canary or otherwise verify user-namespace creation before returning OK.

Useful? React with 👍 / 👎.

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