Skip to content

interfaces/builtin: allow missing resolve1 link setters#16807

Open
zyga wants to merge 1 commit intocanonical:masterfrom
zyga:fix/lp-2143934
Open

interfaces/builtin: allow missing resolve1 link setters#16807
zyga wants to merge 1 commit intocanonical:masterfrom
zyga:fix/lp-2143934

Conversation

@zyga
Copy link
Copy Markdown
Contributor

@zyga zyga commented Mar 23, 2026

The network-control and network-manager AppArmor snippets allowed
SetLink{DefaultRoute,DNSOverTLS,DNS,DNSEx,...} on
org.freedesktop.resolve1.Manager but omitted the equivalent methods
on org.freedesktop.resolve1.Link.

Add DefaultRoute, DNSOverTLS, and DNSEx to the Link member list
for both interfaces, and add regression checks in the corresponding
tests to ensure the member set stays in sync.

Fixes: https://bugs.launchpad.net/bugs/2143934

Copilot AI review requested due to automatic review settings March 23, 2026 19:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the AppArmor DBus rules for the network-control and network-manager built-in interfaces to permit additional org.freedesktop.resolve1.Link setter methods that were already permitted on org.freedesktop.resolve1.Manager, and adds regression tests to prevent future omissions.

Changes:

  • Extend the allowed org.freedesktop.resolve1.Link Set{...} member list to include DefaultRoute, DNSOverTLS, and DNSEx for both interfaces.
  • Add regression assertions in the corresponding test suites to validate the presence of the updated member list.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
interfaces/builtin/network_manager.go Expands the resolve1 Link Set{...} member list in the network-manager AppArmor snippet.
interfaces/builtin/network_manager_test.go Adds an assertion intended to guard the updated resolve1 Link member list.
interfaces/builtin/network_control.go Expands the resolve1 Link Set{...} member list in the network-control AppArmor snippet.
interfaces/builtin/network_control_test.go Adds a regression assertion covering the updated resolve1 Link member list.

err = apparmorSpec.AddPermanentSlot(s.iface, s.slotInfo)
c.Assert(err, IsNil)
c.Assert(apparmorSpec.SecurityTags(), HasLen, 1)
c.Assert(apparmorSpec.SnippetForTag("snap.network-manager.nm"), testutil.Contains, `member="Set{DefaultRoute,DNS,DNSEx,DNSSEC,DNSSECNegativeTrustAnchors,DNSOverTLS,Domains,LLMNR,MulticastDNS}"`)
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

These new assertions verify the Link Set{...} member list contains the expected methods, but they don’t actually check that the Link list stays in sync with the corresponding SetLink{...} member list in the same snippet (as described in the PR). Consider asserting both lists are equivalent (e.g., by extracting a shared expected member list) so future changes can’t update one without the other.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.55%. Comparing base (3e1428f) to head (6ed5c94).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #16807      +/-   ##
==========================================
- Coverage   77.63%   77.55%   -0.08%     
==========================================
  Files        1351     1365      +14     
  Lines      188484   188785     +301     
  Branches     2446     2446              
==========================================
+ Hits       146322   146421      +99     
- Misses      33338    33523     +185     
- Partials     8824     8841      +17     
Flag Coverage Δ
unittests 77.55% <ø> (-0.08%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zyga zyga added the Needs security review Can only be merged once security gave a :+1: label Mar 23, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

Thu Mar 26 12:42:36 UTC 2026
The following results are from: https://github.com/canonical/snapd/actions/runs/23591497552

Failures:

Executing:

  • openstack:ubuntu-core-18-64:tests/main/install-many-transactional
  • openstack:ubuntu-core-24-64:tests/main/snap-services

Restoring:

  • openstack:ubuntu-20.04-64:tests/main/nss-modules:winbind
  • openstack:ubuntu-24.04-64:tests/completion/indirect:hosts
  • openstack:ubuntu-24.04-64:tests/completion/
  • openstack:ubuntu-24.04-64:

Skipped tests from snapd-testing-skip

If you wish to have any of the below tests run in your PR, in your PR description, add 'unskip:' followed by a copy-and-pasted list (without variants) of the below tests you wish to run (unskip plus test list must be valid yaml)

  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_actioned_by_other_pid_always_allow
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_actioned_by_other_pid_always_deny
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_allow
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_deny
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_not_actioned_by_other_pid_single_allow
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_not_actioned_by_other_pid_single_deny
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:download_file_conflict
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:download_file_defaults
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:download_file_safer
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:read_single_allow
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:read_single_deny
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:timespan_allow
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:timespan_deny
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:write_read_multiple_actioned_by_other_pid_allow_deny
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:write_read_multiple_actioned_by_other_pid_deny_allow
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:write_single_allow
  • openstack:ubuntu-20.04-64:tests/main/apparmor-prompting-integration-tests:write_single_deny
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_actioned_by_other_pid_always_allow
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_actioned_by_other_pid_always_deny
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_allow
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_deny
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_not_actioned_by_other_pid_single_allow
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:create_multiple_not_actioned_by_other_pid_single_deny
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:download_file_conflict
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:download_file_defaults
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:download_file_safer
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:read_single_allow
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:read_single_deny
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:timespan_allow
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:timespan_deny
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:write_read_multiple_actioned_by_other_pid_allow_deny
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:write_read_multiple_actioned_by_other_pid_deny_allow
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:write_single_allow
  • openstack:ubuntu-24.04-64:tests/main/apparmor-prompting-integration-tests:write_single_deny
  • openstack:ubuntu-24.04-64:tests/main/i18n

The network-control and network-manager AppArmor snippets allowed
SetLink{DefaultRoute,DNSOverTLS,DNS,DNSEx,...} on
org.freedesktop.resolve1.Manager but omitted the equivalent methods
on org.freedesktop.resolve1.Link.

Add DefaultRoute, DNSOverTLS, and DNSEx to the Link member list
for both interfaces, and add regression checks in the corresponding
tests to ensure the member set stays in sync.

Fixes: https://bugs.launchpad.net/bugs/2143934
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs security review Can only be merged once security gave a :+1:

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants