Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i/prompting: do not error when converting empty abstract perms to AA perms #14975

Conversation

olivercalder
Copy link
Member

It's reasonable that one might wish to convert an empty list of abstract permissions to AppArmor permissions, such as when one is constructing an allowed permissions set where all permissions are denied.

It was incorrect to treat this as an error, and furthermore, the only current caller of AbstractPermissionsToAppArmorPermissions which actually uses the error value is in requestprompts, which logs a logger notice on an error. So we were getting false-positive errors in the journalctl log. This commit fixes that issue.

This addresses https://warthogs.atlassian.net/browse/SNAPDENG-31322

@olivercalder olivercalder added the Simple 😃 A small PR which can be reviewed quickly label Jan 23, 2025
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@7adb9b7). Learn more about missing BASE report.
Report is 23 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #14975   +/-   ##
=========================================
  Coverage          ?   78.03%           
=========================================
  Files             ?     1143           
  Lines             ?   152647           
  Branches          ?        0           
=========================================
  Hits              ?   119121           
  Misses            ?    26188           
  Partials          ?     7338           
Flag Coverage Δ
unittests 78.03% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

github-actions bot commented Jan 24, 2025

Sat Jan 25 02:48:45 UTC 2025
The following results are from: https://github.com/canonical/snapd/actions/runs/12958139008

Failures:

Preparing:

  • openstack:debian-12-64:tests/unit/
  • google:ubuntu-18.04-64:tests/regression/lp-1815869
  • google:ubuntu-18.04-64:tests/regression/lp-1871652

Executing:

  • openstack:centos-9-64:tests/main/degraded
  • openstack:centos-9-64:tests/main/prepare-image-validation-sets
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-backoff
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-pre-download:close
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-pre-download:restart
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-pre-download:close_mid_restart
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-gating-from-snap
  • openstack:opensuse-tumbleweed-64:tests/main/snap-refresh-hold
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-pre-download:ignore
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-retry
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh-gating
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh:regular
  • openstack:opensuse-tumbleweed-64:tests/main/auto-refresh:parallel
  • openstack:opensuse-tumbleweed-64:tests/main/refresh-app-awareness-notify
  • google:ubuntu-25.04-64:tests/main/lxd-try
  • google:ubuntu-16.04-64:tests/unit/go:static
  • google:ubuntu-18.04-64:tests/regression/lp-1867752

Restoring:

  • openstack:opensuse-tumbleweed-64:tests/main/refresh-app-awareness-notify
  • google:ubuntu-18.04-64:tests/regression/lp-1871652

Copy link
Member

@andrewphelpsj andrewphelpsj left a comment

Choose a reason for hiding this comment

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

Thanks!

…perms

It's reasonable that one might wish to convert an empty list of abstract
permissions to AppArmor permissions, such as when one is constructing an
allowed permissions set where all permissions are denied.

It was incorrect to treat this as an error, and furthermore, the only
current caller of `AbstractPermissionsToAppArmorPermissions` which
actually uses the error value is in `requestprompts`, which logs a
logger notice on an error. So we were getting false-positive errors in
the journalctl log. This commit fixes that issue.

Signed-off-by: Oliver Calder <[email protected]>
@olivercalder olivercalder force-pushed the prompting-no-log-empty-response-permissions branch from 0da5340 to edb36c2 Compare January 24, 2025 21:45
@olivercalder olivercalder merged commit 2cbce28 into canonical:master Jan 25, 2025
62 of 67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Simple 😃 A small PR which can be reviewed quickly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants