Skip to content

Fix address checks that refused every host (#194) - #195

Open
UniqueDroid wants to merge 1 commit into
mainfrom
fix/regex-brackets
Open

UniqueDroid wants to merge 1 commit into
mainfrom
fix/regex-brackets

Conversation

@UniqueDroid

Copy link
Copy Markdown
Owner

Fixes #194.

POSIX regular expressions end a bracket expression at the first ], and a backslash does not escape inside it. So [A-Za-z0-9.:\[\]_-]+ matched no normal host name:

  • Apps → Store: store_set refused every source, even the default catalog.
  • Paperless: set_global refused every server address.
  • Share description: [\n\r\[\]] only caught a character followed by ], so a line break went through into ksmbd.conf (admin only).

Host names and bracketed IPv6 addresses are now matched apart, as app-perms.uc already does for Docker hosts. The description check looks for line breaks and brackets separately.

Checked with glibc regcomp/regexec (REG_EXTENDED): the old pattern refuses https://github.com/…/index.json; the new one accepts it and https://[fd00::1]:8443/index.json, and still refuses http://, spaces and quotes.

Tests (they only tried invalid addresses before, which is why CI did not see it):

  • test-apps: a normal https source and an IPv6 source are saved; a source with a space is refused.
  • test-cloud-paperless: http://paperless.lan:8000 is saved.
  • test-users: a description with a line break or [ is refused.

parts/README.md notes the pitfall. CHANGELOG line under 0.3.0-beta.15, since that release is not tagged yet.


Generated by Claude Code

POSIX regular expressions end a bracket expression at the first "]"; a
backslash does not escape inside it. "[A-Za-z0-9.:\[\]_-]+" therefore
matched no normal host name, so store sources (store_set) and the
Paperless server address could not be saved at all. Host names and
bracketed IPv6 addresses are now matched apart, as app-perms.uc does for
Docker hosts.

The share description check "[\n\r\[\]]" only refused a character
followed by "]", so a line break went through into ksmbd.conf (admin
only). It now looks for line breaks and brackets separately.

Tests: a normal https source and an IPv6 source are accepted, a Paperless
host with port is accepted, a description with a line break or "[" is
refused. parts/README.md notes the pitfall.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sb3gb1FHs6DNkZHKinKAJv

This branch has not been deployed

No deployments
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.

Apps Store: cannot save app repository sources (invalid source error due to \] inside POSIX regex bracket expression)

2 participants