Skip to content

duckdns: strip whitespace from API token - #4814

Open
Helvio88 wants to merge 2 commits into
home-assistant:masterfrom
Helvio88:fix/duckdns-token-whitespace
Open

duckdns: strip whitespace from API token#4814
Helvio88 wants to merge 2 commits into
home-assistant:masterfrom
Helvio88:fix/duckdns-token-whitespace

Conversation

@Helvio88

@Helvio88 Helvio88 commented Sep 3, 2026

Copy link
Copy Markdown

Helped a friend debug empty WARNING: lines every 5 minutes. DuckDNS was returning KO because the token had a leading space from copy-paste on duckdns.org.

Same class of bug as #2864.

This strips whitespace after reading the token in the IP update loop and the Let's Encrypt hook. Left version/changelog for you to bump on merge.

Summary by CodeRabbit

  • Bug Fixes
    • DuckDNS tokens are now automatically cleaned of surrounding and embedded whitespace when configuration is loaded.
    • This prevents formatting inconsistencies in stored tokens from interfering with DuckDNS update requests.
    • Existing configuration values continue to be used without requiring manual cleanup or re-entry.

Copy-paste from duckdns.org often includes a leading space. Strip whitespace after reading the token so IP updates do not fail with KO / empty WARNING.
Trim whitespace from the SYS_TOKEN variable.
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 3393f97e-692d-4d9e-9893-ed5b76c6094d

📥 Commits

Reviewing files that changed from the base of the PR and between ab41621 and 47b82e2.

📒 Files selected for processing (2)
  • duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/run
  • duckdns/rootfs/root/hooks.sh

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The DuckDNS service and root hook now remove whitespace from configured token values before DuckDNS updates and certificate-renewal operations.

Changes

DuckDNS token normalization

Layer / File(s) Summary
Normalize configured tokens
duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/run, duckdns/rootfs/root/hooks.sh
The DuckDNS service strips whitespace from TOKEN. The root hook strips whitespace from SYS_TOKEN before DuckDNS requests.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 47b82

The add-on now normalizes configured DuckDNS tokens in both update paths, preventing whitespace-related API failures. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: stripping whitespace from the DuckDNS API token.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant