Skip to content

fix: logins for every command, a password file, a payload bound, escaped text output, checks before connecting (v0.6.0) - #37

Merged
boeboe merged 1 commit into
mainfrom
fix/policy-1.6-review
Nov 15, 2026
Merged

boeboe merged 1 commit into
mainfrom
fix/policy-1.6-review

Conversation

@boeboe

@boeboe boeboe commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Implements the policy 1.6 review findings planned for v0.6.0 (minor).

Logins and credentials

  • edge, host and app now log in with --username and the password, as listen and publish do. They connected without a login before.
  • New --password-file and SPARKPLUGBCTL_PASSWORD_FILE take the password from a file:
    • One trailing line end is ignored.
    • The file holds at most 65535 bytes.
    • Giving a password both as a flag and as a file is exit 2.
  • --password is marked deprecated in help, and still works.
  • A password without --username is not sent, and a warning says so.
  • A --tls-* flag with a broker URL that connects without TLS prints a warning naming the flag and the scheme.
  • Broker URLs are printed with the password of their user information replaced by xxxxx.

Input bounds and validation

  • listen and decode decode payloads of at most --max-payload bytes (default 16 MiB).
    • listen reports a larger message on stderr and goes on.
    • decode exits 3, after reading one byte more than the bound.
  • edge checks --metric and --interval (must be more than 0) before it connects.
  • publish refuses topics with + or #, and --seq above 255, before it connects.

Output

  • Text output escapes control characters, bidirectional formatting characters and bytes that are not UTF-8 in what comes from the broker. --json is unchanged.
  • listen and decode write the metrics of a message one at a time instead of holding the whole output. JSON is the same byte for byte; text columns are aligned in blocks of 4096 lines.
  • A failed write to stdout is exit 10, "the output could not be written", for every command that prints results. edge reports a DDEATH that could not be published as such.

Docs

  • README, SECURITY.md, docs/exitcodes.md and RELEASE.md (v0.6.0) are updated.
  • app --help no longer mentions sending commands.
  • The README make lint row says it runs staticcheck.

Exit codes that change (RELEASE.md, ### Breaking, with the way back)

  • A failed write is 10.
  • decode above the bound is 3.
  • edge --interval of 0 or less is 3, before connecting.
  • A publish wildcard topic or --seq above 255 is 3, before connecting.

Tests

  • A test broker that admits one login runs every network command with flags, variables and a password file.
  • Recording-transport tests check validation before connecting and the write-error paths.
  • Boundary tables cover the payload bound (including 32-bit), the password length and --seq.
  • A heap budget for printing, and checks that the JSON form is the same byte for byte and the text form keeps its columns.
  • Escaping tests.
  • TestEdgePrimaryHost drives the publish interval through a seam instead of sleeping.

Files: cmd/{app,decode,edge,encode,exit,host,listen,publish,root,seams,version}.go, new cmd/conn.go and cmd/limits.go, internal/output/output.go, new internal/output/escape.go, tests in cmd/ and internal/output/, README.md, SECURITY.md, RELEASE.md, docs/exitcodes.md.

🤖 Generated with Claude Code

…ped text output, checks before connecting (v0.6.0)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.12894% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/listen.go 84.37% 3 Missing and 2 partials ⚠️
internal/output/output.go 95.55% 3 Missing and 1 partial ⚠️
cmd/app.go 92.85% 1 Missing and 1 partial ⚠️
cmd/conn.go 96.61% 1 Missing and 1 partial ⚠️
cmd/edge.go 89.47% 1 Missing and 1 partial ⚠️
cmd/host.go 89.47% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@boeboe
boeboe merged commit 595b055 into main Nov 15, 2026
14 of 15 checks passed
@boeboe
boeboe deleted the fix/policy-1.6-review branch November 15, 2026 19:00
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.

1 participant