Skip to content

Reject a bundle identifier with a trailing newline - #3054

Merged
mhsmith merged 2 commits into
beeware:mainfrom
rawsun007:fix/bundle-identifier-fullmatch
Sep 14, 2026
Merged

mhsmith merged 2 commits into
beeware:mainfrom
rawsun007:fix/bundle-identifier-fullmatch

Conversation

@rawsun007

Copy link
Copy Markdown
Contributor

is_valid_bundle_identifier applies VALID_BUNDLE_RE with re.match, and $ matches before a final newline, so a bundle ending in one validates:

>>> is_valid_bundle_identifier("com.example\n")
True

The value then reaches the places that use the identifier as a name — flatpak.py joins it onto the build path, and appimage.py puts it in a Docker image tag:

>>> app = AppConfig(app_name="myapp", version="1.0", bundle="com.example\n", ...)
>>> app.bundle_identifier
'com.example\n.myapp'

fullmatch is what is_valid_pep508_name two hundred lines above already uses, and it makes the trailing $ redundant, so that comes off too. Reverting only config.py fails exactly the one new case.

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

Assisted-by: Claude Opus 5 (Claude Code)

`VALID_BUNDLE_RE` was applied with `re.match`, and `$` matches before a
final newline, so `com.example\n` validated and reached the places that
use the identifier as a name: the flatpak build directory and the
AppImage Docker image tag, among others.

`fullmatch` is what the neighbouring `is_valid_pep508_name` already uses.

Assisted-by: Claude Opus 5 (Claude Code)
Assisted-by: Claude Opus 5 (Claude Code)

@mhsmith mhsmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mhsmith
mhsmith merged commit 0679862 into beeware:main Sep 14, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants