Skip to content

fix: SAST hardening, Go 1.26, go-canopen v0.4.1, go-canbus v0.8.0 - #16

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

boeboe merged 2 commits into
mainfrom
fix/sast-hardening

Conversation

@boeboe

@boeboe boeboe commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary

SAST review (make sast SEVERITY=low CONFIDENCE=low): 34 findings, all fixed in code, 0 open, no triage records. Go 1.26 floor with go fix, go-canopen v0.4.1, go-canbus v0.8.0, canopen-interop v0.3.1 images, shared workflows v3.3.1.

Defects fixed

  • Integer node-ID flags wrapped before their range check: --client-id 257 ran as node 1. This applied to boot --master-id, lss assign-all --first and simulate --node-id too. They are now refused with exit 3. The regression tests fail on main.
  • eds convert --baud accepted 1..9 although the help says 10..1000.
  • Output files are 0600 and directories 0750; input paths are cleaned.

Hardening

  • --max-size (SDO and USDO uploads, 1 MiB default, up to 1 GiB). A local out-of-memory abort now says that the data is larger than --max-size.
  • --retries also repeats SDO transfers broken by lost, duplicated or reordered frames (toggle, command and block aborts), after waiting one --timeout.

Tests

make check passes with 93.1% coverage; golangci-lint reports 0 issues.

Breaking changes and notes are in RELEASE.md v0.4.0.

🤖 Generated with Claude Code

SAST (gosec/opengrep, low/low): 34 findings fixed in code. Integer
node-ID flags wrapped before their range check (--client-id, --master-id,
--first, simulate --node-id: 257 was node 1); --baud accepted 1..9;
output files 0600, directories 0750; paths cleaned.

New --max-size for SDO/USDO uploads (1 MiB default, go-canopen bounds
both now); a local out-of-memory abort names it. --retries also repeats
SDO transfers broken by lost or reordered frames, after one --timeout.

Tests: hostile SDO servers, TestMonkeySDO through a chaos bridge (found
the go-canopen v0.4.0 stale-segment defect, fixed in v0.4.1), fuzz
targets for numbers, trace decoding and EDS files, regression tests.
Interop images canopen-interop v0.3.1, workflows v3.3.1, CI Go 1.26/1.27.

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

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.92547% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/transport.go 87.50% 5 Missing and 1 partial ⚠️
cmd/sdo.go 33.33% 0 Missing and 2 partials ⚠️
internal/errs/errs.go 77.77% 1 Missing and 1 partial ⚠️
cmd/cia302.go 95.45% 0 Missing and 1 partial ⚠️
cmd/eds.go 94.11% 0 Missing and 1 partial ⚠️
cmd/nmt.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@boeboe
boeboe merged commit ebe1fdc into main Nov 4, 2026
35 checks passed
@boeboe
boeboe deleted the fix/sast-hardening branch November 4, 2026 21:58
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