fix: set sticky bit on the default directory
Metadata
Current evaluation
Merged #1317 in commit 88c7ae17, changing /var/lib/pebble/default from 0777 to 01777 in both creation paths and adding permission coverage; fixes #1170.
Resolution: closed resolved
Reason: PR #1317 was merged as commit 88c7ae17. It adds the sticky bit while retaining non-root write access and tests implicit and generated Pebble layers.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Describe your changes.
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/rockcraft/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [x] I've successfully run `make lint && make test`.
- [ ] I've added or updated any relevant documentation.
- [ ] In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing.
- [ ] I've updated the relevant release notes.
Fixes #1170.
`/var/lib/pebble/default` is intentionally world-writable so that Pebble can create its socket and state files when a rock uses a non-root `run-user`. However, mode `0777` allows users to remove or rename entries owned by other users and is reported by insecure world-writable-directory checks.
Set the directory mode to `01777`, preserving non-root write access while protecting directory entries with the sticky bit.
The mode is updated in both paths that create the directory:
- the implicit Pebble part, including rocks without services or checks;
- the layer generated when services or checks are present.
Tests now verify the complete mode with `stat.S_IMODE` instead of inspecting only the final three octal digits. Spread coverage checks the resulting image both with and without a generated Pebble layer, while retaining the existing non-root file-creation check.
After this is released, affected base images must be rebuilt and republished; the change cannot alter permissions in already-published OCI layers.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged #1317 in commit 88c7ae17, changing /var/lib/pebble/default from 0777 to 01777 in both creation paths and adding permission coverage; fixes #1170. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1317, commit 88c7ae17, setting /var/lib/pebble/default to 01777 in both creation paths, adding sticky-bit coverage for implicit and generated Pebble layers. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for #1170 updating /var/lib/pebble/default permissions from 0777 to 01777. The added sticky bit prevents unauthorized file removal while preserving non-root write access. Affected base images require rebuilding. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for #1170 setting /var/lib/pebble/default to mode 01777. The sticky bit prevents unauthorized file removal while preserving world-writable access for non-root Pebble. Tests and creation paths updated. Base images require rebuilding. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for #1170. Updates /var/lib/pebble/default permissions from 0777 to 01777, adding a sticky bit to prevent unauthorized file removal while preserving non-root access. Applies to all Pebble layer creation paths. Base images require rebuilding. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
15
Confidence:
95
|
needs review | Updates /var/lib/pebble/default permissions from 0777 to 01777 to add the sticky bit, preventing unauthorized entry removal while preserving non-root write access. Approved by two reviewers, CI passing, ready to merge. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
15
Confidence:
90
|
needs review | Updates /var/lib/pebble/default directory permissions from 0777 to 01777 (sticky bit) to prevent unauthorized entry removal while preserving non-root write access. Includes test updates and is approved with passing CI. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
15
Confidence:
85
|
needs review | Changes /var/lib/pebble/default permissions from 0777 to 01777 (sticky bit) to prevent unauthorized entry removal while preserving non-root access. Updates tests and covers both implicit and explicit Pebble paths. Awaiting maintainer review and CI. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
15
Confidence:
90
|
needs review | Updates /var/lib/pebble/default permissions from 0777 to 01777 (sticky bit) to prevent unauthorized entry removal while preserving non-root write access. Includes test updates and covers both implicit and generated layer paths. Currently awaiting maintainer review. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
15
Confidence:
90
|
needs review | Sets sticky bit on /var/lib/pebble/default directory mode from 0777 to 01777 to prevent unauthorized entry deletion while preserving non-root write access. Updates creation paths and tests. Currently pending maintainer review with passing CI. |
Update history
| Date | Change |
|---|---|
| updated | |
| updated | |
| updated | |
| updated | |
| created |
Related work
-
Related To:
canonical/rockcraft#1170
(confidence 100%)
The missing sticky-bit issue explicitly fixed by this merged PR.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #473 fix(pebble): /var/lib/pebble/default has mode 0777 | rockcraft | merged | Merged PR #473 via commit 72c1af5d, fixing #461 by always setting /var/lib/pebble/default to mode 0777, including rocks without services or checks. | |
| #1170 missing sticky bit in PEBBLE_PATH | rockcraft | closed | Rockcraft now sets Pebble's default directory to mode 01777, adding the missing sticky bit; the fix was merged in canonical/rockcraft#1317 (88c7ae17). |