Validate Linux app identifiers#597
Conversation
Greptile SummaryThis PR adds a
Confidence Score: 3/5The validation logic will incorrectly reject legitimate Flatpak app IDs containing underscores, which are allowed by the D-Bus naming convention Flatpak follows. The regex excludes underscores from every component segment, meaning any real-world Flatpak ID with an underscore (e.g. The Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[build / ship called] --> B[requireAppId]
B --> C{appId present?}
C -- No --> D[throw: desktop-linux requires appId]
C -- Yes --> E{matches APP_ID_PATTERN?}
E -- No --> F[throw: must be a valid reverse-DNS identifier]
E -- Yes --> G[return trimmed appId]
G --> H{build or ship?}
H -- build --> I[write linux-package-plan.json using validated appId]
H -- ship --> J[log uses raw config.appId ⚠️ / return id uses validated appId]
I --> K[return artifact path]
J --> L[return id: appId@version]
|
| direct?: { host: 'github-releases' | 'cdn'; project?: string }; | ||
| } | ||
|
|
||
| const APP_ID_PATTERN = /^[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/; |
There was a problem hiding this comment.
The regex character class
[A-Za-z0-9-] excludes underscores. Flatpak application IDs follow the D-Bus naming convention, which explicitly permits underscores in each segment (e.g. org.some_project.App). Without underscore support, valid Flatpak IDs will be wrongly rejected by this validator.
| const APP_ID_PATTERN = /^[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/; | |
| const APP_ID_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*(\.[A-Za-z][A-Za-z0-9_-]*)+$/; |
Fixes #596.
Changes:
Validation: