Verify on jammy: PASS
=====================

1. Confirm dotted invalid names are already rejected (old and new
snapd):

```
sudo snap set lxd x.Y=z
error: cannot perform the following tasks:
- Run configure hook of "lxd" snap (invalid option name: "Y")
```

2. Reproduce on unfixed snapd (2.76.3+ubuntu22.04.1):

```
snap version --verbose
snap            2.76.3+ubuntu22.04.1
snapd           2.76.3+ubuntu22.04.1
series          16
ubuntu          22.04
kernel          5.15.0-198-generic
architecture    amd64
snapd-bin-from  native-package
snap-bin-from   native-package

sudo snap set lxd -t 'x={"Y": "z"}'

snap warnings
No warnings.

sudo snap get lxd -d
{
        "x": {
                "Y": "z"
        }
}
```

3. Nested and list cases warn on 2.77.1+ubuntu22.04 from jammy-proposed.
lxd 5.0 is not core26, so the set is kept and snapd warns:

```
snap version --verbose
snap            2.77.1+ubuntu22.04
snapd           2.77.1+ubuntu22.04
series          16
ubuntu          22.04
kernel          5.15.0-198-generic
architecture    amd64
snapd-bin-from  native-package
snap-bin-from   native-package

sudo snap set lxd -t 'x={"Y": "z"}'
WARNING: There is 1 new warning. See 'snap warnings'.

sudo snap set lxd -t 'one={"good":{"Bad":1}}'
WARNING: There are 2 new warnings. See 'snap warnings'.

sudo snap set lxd -t 'one=[{"Bad":1}]'
WARNING: There are 2 new warnings. See 'snap warnings'.

snap warnings
warning: |
  Option value has invalid field name "Y". For core26+ snaps, fields must be
  dash separated lowercase alphanumerics.
---
warning: |
  Option value has invalid field name "Bad". For core26+ snaps, fields must be
  dash separated lowercase alphanumerics.

4. Valid JSON keys still work:

```
sudo snap set lxd -t 'x={"y": "z"}'

sudo snap get lxd -d
{
        "one": [
                {
                        "Bad": 1
                }
        ],
        "x": {
                "y": "z"
        }
}

sudo snap get lxd x.y
z

sudo snap set lxd plain=ok
sudo snap get lxd plain
ok

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

Title:
  dash-case-subset config on snap set not being validated when passing
  JSON

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


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

Reply via email to