8000 fix(apparmor): install no profile where the parser has no abi/4.0 by minimal-backporter[bot] · Pull Request #3562 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(apparmor): install no profile where the parser has no abi/4.0 - #3562

Merged
norrietaylor merged 1 commit into
release/0.7.xfrom
backport/3285-to-release/0.7.x
Nov 18, 2026
Merged

norrietaylor merged 1 commit into
release/0.7.xfrom
backport/3285-to-release/0.7.x

Conversation

@minimal-backporter
Copy link
Copy Markdown
Contributor

Backport of #3285 to release/0.7.x.

Squash-merge this PR and keep the PR title as the subject. The cherry-picked commit keeps the source subject.

)

* fix(apparmor): install no profile where the parser has no abi/4.0

The minimald profile declares abi/4.0 and carries one rule, `userns`,
both of which exist from AppArmor 4.0. On Debian 12 (AppArmor 3.0.8) the
parser cannot open that abi and refuses the file, so a package's
postinst or the hand loader reported an error on every install there
(gominimal/inbox#1197). That kernel does not restrict unprivileged user
namespaces either, so the profile has nothing to allow on it, which is
why `min finalize-install` already installs it only where the sysctl
restricts them.

The loader now does the same: without abi/4.0 under the AppArmor
directory it says the host mediates no user namespaces and installs
nothing, and --uninstall still removes a file an earlier run left. The
profile's header says why there is no second rendering: a 3.x profile
could not say `userns`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(apparmor): the loader's --check finds apparmor_parser on a user's PATH

`--check` runs as the user, as the docs say, and on Debian and Ubuntu
apparmor_parser lives in /usr/sbin, which a user's PATH does not hold,
so the check died with "apparmor_parser not found" on a host that has
AppArmor (a lab run of the installed loader on Ubuntu 24.04). The
loader adds /usr/sbin and /sbin to its PATH before looking.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(apparmor): say that --check was skipped where the parser has no abi/4.0

A lane that runs `--check` on an older host read a 0 and two lines about
installing nothing. The check mode now says the profile was not parsed
here and why, so a lane that depends on the parse can read it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(apparmor): decide the abi/4.0 skip by the kernel's switch, and test the loader

The guard skipped on a parser without abi/4.0 alone, and said the host
does not mediate user namespaces. On a host that restricts them with an
old parser that was false: nothing installed, every box to EPERM. The
loader now reads the switch finalize-install reads: off or absent, it
installs nothing and says so; on, it fails and names the remedy. The
notes are sentences. The policy directory and the switch file take an
override, and install_test.sh drives the loader over a scratch tree
with a stub parser through every branch, under bash.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 89436ef)
@coderabbitai
coderabbitai Bot commented Nov 18, 2026
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1371f335-439c-464c-918a-db11a619379a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@minimal-foundry
minimal-foundry Bot commented Nov 18, 2026 •
Copy link
Copy Markdown
Contributor

Reviewed: 1 finding, none blocking at b4a15567c112.

Address the comments on the diff.

Clobber: none seen in the three files.

@minimal-foundry minimal-foundry Bot 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.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

# reports the skip either way. The --uninstall path still runs, for a file
# an earlier run left.
if [ "$mode" != uninstall ] && [ ! -e "$APPARMOR_D/abi/4.0" ]; then
parser_version="$(apparmor_parser --version 2>/dev/null | head -1)"
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.

LOW · correctness · confidence 0.50 · in parser_version

The version probe is a pipeline under set -euo pipefail. If apparmor_parser --version exits nonzero, or gets SIGPIPE from head -1, the assignment fails and the script exits silently. The user then sees none of the skip or remedy messages. Add || true to the pipeline.

What the reviewer checked

parser_version="$(apparmor_parser --version 2>/dev/null | head -1)"

Hand this to an agent
Act on a code-review finding.

File:       scripts/install-apparmor-profile.sh
Lines:      81-81
Category:   correctness
Severity:   low (reviewer confidence 0.50)

Finding:
The version probe is a pipeline under `set -euo pipefail`. If `apparmor_parser --version` exits nonzero, or gets SIGPIPE from `head -1`, the assignment fails and the script exits silently. The user then sees none of the skip or remedy messages. Add `|| true` to the pipeline.

First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.

👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.

@norrietaylor
norrietaylor enabled auto-merge (squash) November 18, 2026 21:16
@norrietaylor
norrietaylor merged commit 4653443 into release/0.7.x Nov 18, 2026
35 checks passed
@norrietaylor
norrietaylor deleted the backport/3285-to-release/0.7.x branch November 18, 2026 21:39
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.

2 participants

0