Skip to content

Validate config inputs: hostname (closes #8) - #29

Merged
VijitSingh97 merged 2 commits into
mainfrom
fix/validate-hostname
Jun 7, 2026
Merged

VijitSingh97 merged 2 commits into
mainfrom
fix/validate-hostname

Conversation

@VijitSingh97

Copy link
Copy Markdown
Contributor

Problem (#8)

Config inputs were interpolated into the XMRig source patch / pool URL with no validation. The DONATION half was fixed in #26 (integer 0–100). This adds the hostname half.

Fix

parse_config now validates P2POOL_NODE_HOSTNAME before any build:

  • required — empty/missing fails with a clear message
  • charset — must match ^[A-Za-z0-9._:-]+$ (hostname / FQDN / IPv4 / IPv6)

This also rejects the unfilled template placeholder <P2POOL_NODE_HOSTNAME> and any shell/URL metacharacters (space, ;, /, {, …) that would be unsafe in the generated pool URL.

Pithead/XMRig check

The accepted charset covers every value Pithead/stratum needs — a LAN hostname, an FQDN, or an IPv4/IPv6 literal — all of which XMRig accepts as a pool url host. No integration impact (the host flows to <host>:3333, unchanged).

Test

Accepts box, box.lan, 10.0.0.5, fe80::1, rig-01; rejects empty, missing, bad host, evil;rm, a/b, and the <...> placeholder.

make test green. With #26 (DONATION) already merged, this closes #8.

🤖 Generated with Claude Code

VijitSingh97 and others added 2 commits June 7, 2026 02:22
The host is interpolated straight into the XMRig pool URL, so validate it in
parse_config: it must be set and match a hostname/FQDN/IPv4/IPv6 charset
([A-Za-z0-9._:-]). This rejects an empty/missing value, the unfilled template
placeholder (<...>), and shell/URL metacharacters — failing fast with a clear
message before any source patch or build.

The DONATION half of #8 landed earlier in #26; this completes the issue.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@VijitSingh97
VijitSingh97 merged commit 6adaf90 into main Jun 7, 2026
3 checks passed
@VijitSingh97
VijitSingh97 deleted the fix/validate-hostname branch June 7, 2026 13:18
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.

Validate config inputs before building (DONATION integer, hostname)

1 participant