← Back to issue list

Snap names regexes are inconsistent or too permissive

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1763048
Type
issue
State
open
Author
~adam-collard
Labels
Created
Updated
Closed

Current evaluation

Snap name regexes across the store, click-reviewers-tools, and snapd are inconsistent or too permissive (allowing one-char names, leading/trailing dashes, double dashes); snapcraft itself does not enforce a regex. No maintainer response in ~7 years.

Suggested action: needs triage

Reason: The issue has zero comments, no labels, and no maintainer interaction for ~7 years (last activity 2498 days ago), so it has never been triaged. The core problem is still present in the codebase: snapcraft/models/project.py:274 still uses the permissive regex r"^[a-z0-9-]*[a-z][a-z0-9-]*$" without the min-length or dash-position checks snapd applies, and the issue spans multiple repos (store, c-r-t, snapd), so it needs a maintainer to scope and prioritize before any fix.

Impact: 30 Quick Win: 18.0 Staleness: 95 Complexity: 40 Confidence: 65 Support Request: 10

Issue body

Currently, the store restricts snap names to comply with: package_name_re_str = r'^[a-z0-9-]*[a-z][a-z0-9-]*$' The regex above allows snap names of one single char (even '-') being registered. The reviewer tools allow for: r'^[a-z0-9-]*[a-z][a-z0-9-]*$' plus some extra checks (see check_name method in https://bazaar.launchpad.net/~store-reviewers/click-reviewers-tools/trunk/view/head:/clickreviews/sr_lint.py#L173) Snapd allow for: the same regex than the store plus some extra checks, see https://github.com/snapcore/snapd/blob/master/snap/validate.go#L40 Snapcraft does not seem to enforce any regex (or I couldn't find one) -- I think we can leave this as is. We want to ensure snapd, c-r-t and the store are consistent and do not allow one-char snap names being registered, nor having - at the beginning or end of a name, nor -- in it (similar to what snapd does but also restricting the min length).

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 30
Quick Win: 18.0
Staleness: 95
Complexity: 40
Confidence: 65
Support Request: 10
needs triage Snap name regexes across the store, click-reviewers-tools, and snapd are inconsistent or too permissive (allowing one-char names, leading/trailing dashes, double dashes); snapcraft itself does not enforce a regex. No maintainer response in ~7 years.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 65
Confidence: 88
Support Request: 10
close stale Reports inconsistent and overly permissive regex validation for snap names across store, snapd, and reviewer tools. Allows single-character names and invalid hyphen usage. Unlabeled, zero comments, inactive for over six years.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 75
Confidence: 90
Support Request: 15
close stale Reports inconsistencies in snap name validation regexes across store, snapd, and reviewer tools, requesting stricter rules to prevent single-character or hyphen-prefixed names. Unaddressed for over 8 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 75
Confidence: 90
Support Request: 15
close stale Reports inconsistencies in snap name validation regexes across store, snapd, and review tools, requesting stricter rules to prevent single-char names and invalid dash usage. Issue is inactive for over 6 years with no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 70
Confidence: 90
Support Request: 5
close stale Inconsistencies in snap name validation regexes across store, snapd, and reviewer tools allow invalid formats like single-char or hyphen-prefixed names. Untriaged, inactive for over 6 years.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#1590620 (confidence 55%)

    Related Launchpad bug: snapcraft can generate snaps with names longer than 107 characters, another gap in snapcraft-side name validation.

Related issues

No related issues found above the similarity threshold.