Skip to content

Accept any HTTPS origin with optional port as public URL - #3

Merged
Jenik5 merged 4 commits into
Jenik5:mainfrom
mirecekd:feat/any-https-origin
Oct 5, 2026
Merged

Jenik5 merged 4 commits into
Jenik5:mainfrom
mirecekd:feat/any-https-origin

Conversation

@mirecekd

@mirecekd mirecekd commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

public_base() currently accepts only https://<name>.ui.nabu.casa on port 443. This PR lets the public URL be any HTTPS origin with a DNS hostname and an optional port, for example https://ha.example.org:8125, so the connector also works with a self-hosted HTTPS endpoint.

Changes

  • security.py: public_base() accepts a DNS hostname and an optional port. The port is kept in the returned origin, so the issuer, resource URL and Origin check stay consistent. :443 is normalised away.
  • Still rejected: non-HTTPS schemes, IP literals, single-label hosts such as localhost, userinfo, path, query, fragment and invalid ports.
  • Error texts, the form description and the field label in strings.json and all five translations (en, cs, de, pl, sk) no longer mention Nabu Casa only.
  • tests/test_security.py: the Nabu-only test is replaced by one covering the new accept/reject cases.

Testing

  • python -m unittest discover -s tests passes (77 tests) and python tools/check_package.py passes.
  • Verified manually: paired with Grok over a self-hosted HTTPS origin with a non-standard port, and Grok could use the connector.

Notes

I could not find a stated reason for the Nabu Casa restriction, so I treated it as a scope limit rather than a security requirement. If it was meant as a safeguard, I am happy to put this behind an option or adjust it. README and docs/ still describe Nabu Casa and are unchanged in this PR.

mirecekd and others added 4 commits October 5, 2026 06:51
public_base() was limited to *.ui.nabu.casa on port 443. Allow any DNS
hostname with an optional port so the connector works behind a self-hosted
HTTPS endpoint (e.g. https://example.org:8125). IP literals, userinfo,
path, query and fragment are still rejected. Update error texts and tests.
@Jenik5
Jenik5 merged commit 08cb928 into Jenik5:main Oct 5, 2026
4 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