Skip to content

serve: keep the access code out of the log, and 0.5.3 - #52

Merged
richlegrand merged 2 commits into
mainfrom
release-0.5.3
Nov 9, 2026
Merged

richlegrand merged 2 commits into
mainfrom
release-0.5.3

Conversation

@richlegrand

Copy link
Copy Markdown
Owner

Two commits: the #49 fix, and the version bump for 0.5.3.

Fixes #49.

Off a terminal the startup URL now stops at the #, and the QR goes with
it. Everything after the # is the access code, and a fragment is never
sent in an HTTP request -- which is the point of putting it there, and then
the listener wrote it into a journal on every reconnect.

The QR half is not what #49 asked for and is the part worth a second look.
It is gated on -noqr alone, so a headless listener without that flag
encoded the same URL, code and all, as eighteen lines of block characters.
Fixing only the text would have moved the credential into pixels.

On a terminal nothing changes -- the URL stays whole and the QR stays.

Left alone deliberately: connect_pair.go after pairing, and the share
Control/View URLs. Both are one-shot output where handing you the credential
is the entire point, rather than a block reprinted on every reconnect.

Test

TestReadyBlockKeepsTheCodeOffNonTerminals covers piped and daemon, and
asserts a terminal still gets both. It fails without the fix. The existing
piped and daemon assertions changed, since they asserted the full URL
reaches a non-terminal, which is the behavior being fixed.

TestReadyBlockNoQR now builds a TTY display explicitly: under go test
stdout is not a terminal, so newDisplay would produce no QR either way and
the test would have proved nothing.

Off a terminal the startup URL now stops at the `#`. Everything after it
is the access code, and a fragment is never sent in an HTTP request --
which is the whole reason the code lives there, and then the listener
wrote it into a journal systemd is happy to ship somewhere else.

The QR goes with it, which #49 did not ask for and needs saying. It is
gated on -noqr alone today, so a headless listener without that flag
encoded the same URL, code and all, into eighteen lines of block
characters on every reconnect. Dropping only the text would have moved
the credential into pixels rather than removed it. A QR is for a camera
pointed at a screen, which is the same test the banner already uses.

On a terminal nothing changes: the URL stays whole and the QR stays,
because that is where it is read in order to be used.

The code is 8 bytes and lives in the identity, so it survives restarts.
A log line leaked it for the life of that identity, not of that process.

Reported by @lars18th, who found it in an OpenWRT journal.
@richlegrand
richlegrand merged commit 3ff70c7 into main Nov 9, 2026
4 of 5 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.

When using -noqr and logging the output the URL fragment is printed

1 participant