Skip to content

Harden after SAST review; go-openadr v0.6.0; Go 1.26 fix - #11

Merged
boeboe merged 4 commits into
mainfrom
fix/sast-hardening
Nov 5, 2026
Merged

boeboe merged 4 commits into
mainfrom
fix/sast-hardening

Conversation

@boeboe

@boeboe boeboe commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Hardening after a SAST review, on go-openadr v0.6.0. Prepares v0.5.0: the notes are in RELEASE.md.

SAST (low/low)

There were 11 findings. 10 are fixed in code, and 1 is triaged in the private triage repository:

  • G115 ×6: the flag binder no longer converts integers. It binds each field through a pointer of its kind, which also makes named types (type Port uint16) work instead of panicking.
  • G304 ×4: every file the user names now goes through a single reader, limited to 16 MiB.
  • G402: --insecure is the user's explicit choice, so it is triaged as a false positive.

Hardening

Network:

  • Redirects are followed only within the same origin, so the client secret is not re-sent to another site.
  • Bearer tokens with control characters are refused.
  • expires_in is capped at 100 years.
  • Token answers and response heads are bounded.
  • Text from a VTN is escaped in error: lines.
  • Passwords in URLs are redacted.
  • No token is sent over plain MQTT for an https VTN.
  • The webhook listener has read, write and idle timeouts.
  • No records are written after a stream ends.

Local:

  • Files and stdin are read up to 16 MiB.
  • Control characters are escaped in text and table output.
  • generate-config --force writes the file with mode 0600.
  • Non-finite --rate and negative ISO durations are refused.
  • New fuzz targets: flag values, environment loading and output escaping.

Several failures now exit with a different code. They are listed in RELEASE.md and documented in docs/exitcodes.md and docs/json-output.md.

Also

  • go fix for Go 1.26.
  • CI workflows otfabric/.github v3.3.1.
  • The interop scripts now default to openadr-interop v0.6.3.

Verified locally

  • make check: coverage 92.1% → 94.0%.
  • make e2e and go test -race ./....
  • scripts/interop.sh: 25/25 against OpenLEADR, v0.6.3.
  • scripts/interop301.sh: 37/37 against OpenLEADR v0.1.4, 3.0.1.
  • SAST PASS with the triage record.

🤖 Generated with Claude Code

boeboe and others added 3 commits November 5, 2026 09:49
…without integer conversions (G115)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Network: redirects stay within the origin (no client secret sent
elsewhere), bearer tokens checked, expires_in capped, token answers
bounded, VTN text escaped in error lines, passwords in URLs redacted, no
token over plain MQTT for an https VTN, webhook server timeouts, no
records after a stream ends.

Local: files and stdin read up to 16 MiB, control characters escaped in
text and table output, generate-config --force writes 0600, non-finite
--rate and negative ISO durations refused, flag binder safe for named
types. Fuzz targets for flag values, environment and output escaping.

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

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…tested

With --force the file is removed and created anew (O_EXCL, 0600), so a
symbolic link at --output is replaced rather than written through. Tests
for a subscription the VTN will not delete, Clean cutting at a rune, a
cut-off /auth/server answer, and write and close failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@boeboe
boeboe merged commit 95ca3a3 into main Nov 5, 2026
21 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.

1 participant