** Description changed:

  [SRU] 2.78: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/2166403
  
  [Impact]
  
  The bug caused connection failure for {personal,system}-files interfaces
  if the indicated paths contained spaces.
  
  [Test Plan]
  
  Follow the below steps first with a version <2.78 then with the 2.78
- snapd debs
+ snapd debs and verify the expected behavior that the snap gets
+ read/write access.
  
  [Where problems could occur]
  
  The change is simple and merely adds path quoting with no foreseen
  adverse consequences.
  
  ---original---
  ## Summary
  
  Using the `personal-files` (or `system-files`) interface with a
  `write`/`read` path that contains a space causes snapd to generate an
  invalid AppArmor profile. The generated rule is unquoted, so
  `apparmor_parser` fails with a syntax error, and the snap can never
  connect the interface.
  
  ## snapd version
  
  ```
  $ snap version
  snap          2.76.2
  snapd         2.76.2
  series        16
  ubuntu        26.04
  kernel        7.0.0-28-generic
  architecture  amd64
  ```
  
  ## Reproduction
  
  1. Create a snap with the following plug:
  
  ```yaml
  plugs:
    my-personal-files:
      interface: personal-files
      write:
        - $HOME/.local/share/data/My Awesome App/foo
  ```
  
  Example real-world app hitting this: https://github.com/lunacd/MEGAsync-
  snap/blob/main/snap/snapcraft.yaml
  
  2. Install the snap and connect the interface:
  
  ```
  $ snap connect <snap>:my-personal-files
  ```
  
  ## Expected behavior
  
  The interface connects successfully, and the snap gets read/write access
  to the specified directory.
  
  ## Actual behavior
  
  ```
  error: cannot perform the following tasks:
  - Connect <snap>:mega-store to snapd:personal-files (cannot setup profiles 
for snap "<snap>": cannot load apparmor profiles: exit status 1
  apparmor_parser output:
  AppArmor parser error for 
/var/lib/snapd/apparmor/profiles/snap-update-ns.<snap> in profile 
/var/lib/snapd/apparmor/profiles/snap-update-ns.<snap> at line 1941: syntax 
error, unexpected TOK_ID, expecting TOK_MODE
  )
  ```
  
  Inspecting the generated profile at
  `/var/lib/snapd/apparmor/profiles/snap-update-ns.<snap>` shows the
  offending line:
  
  ```
    owner @{HOME}/.local/share/data/My Awesome App/ rw,
  ```
  
  This is invalid AppArmor syntax.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2164689

Title:
  Space in personal-files interface causes snapd to generate invalid
  apparmor  profile

To manage notifications about this bug go to:
https://bugs.launchpad.net/snapd/+bug/2164689/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to