Skip to content

config: stop truncating values at a '#' - #70

Merged
rsantacroce merged 1 commit into
LayerTwo-Labs:mainfrom
Wired4ncer:up/config-no-hash-truncation
Sep 1, 2026
Merged

config: stop truncating values at a '#'#70
rsantacroce merged 1 commit into
LayerTwo-Labs:mainfrom
Wired4ncer:up/config-no-hash-truncation

Conversation

@Wired4ncer

Copy link
Copy Markdown
Contributor

A # anywhere in a config value silently truncates it. config.c strips from the first # on the line before parsing, so a value that legitimately contains one arrives cut short — and nothing warns.

The failure is quiet, which is what makes it worth fixing. An operator writes a value, reads it back in the file, and sees what they intended; only the running process disagrees.

This keeps # as a comment introducer where it starts a comment, and stops it eating the rest of a value otherwise.

Adds a test_config suite — there was no coverage of the config parser at all. The test that matters asserts the value arrives intact, so that whatever validates it later is validating the real string rather than a truncated one.

Verified on a clean checkout of main: full suite green, including the new suite.

Comments were stripped by cutting the line at the first '#' anywhere, before
the key/value split and before unquote(). A password of p#ssw0rd silently
became p, quoting did not help, and the pool then failed RPC auth with
nothing in the log pointing at the config file. coinbase_tag and the address
fields had the same exposure.

'#' now introduces a comment only at the start of a line or after whitespace,
and never inside double quotes. Inline comments still work, which is what
proxy.conf.example documents.

Adds tests/test_config.c — there was no config suite at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rsantacroce
rsantacroce merged commit eb2b4c0 into LayerTwo-Labs:main Sep 1, 2026
7 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