feat: seal stored records with HMAC-SHA256 instead of CRC-16 - #44
Merged
Conversation
SolidSyslogMbedTlsHmacSha256Policy replaces SolidSyslogCrc16Policy on the store. Records at rest are tamper-evident rather than checksummed: an edit without the key fails verification, and Open compares in constant time. Flash +13,424 B (+348 on the previous stage) RAM +35,684 B (+20) Log stack +712 B (unchanged) Service +3,800 B (unchanged) Twenty bytes, and it is the policy's pool entry — nothing else. The mechanism for holding a named symmetric key and handing it out is the device's own: a device already doing mTLS has provisioned secrets and somewhere to keep them, so the key slot, the loader and the accessor all sit below the line. What SolidSyslog is charged for is the policy and the callback that reaches for the key. No stack movement and no heap: SHA-256 was already linked, and the policy hashes into a caller-owned buffer. The key is fetched per seal and per verify rather than held, so it never sits on the policy instance. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughSyslog persistent-store authentication changes from CRC16 to HMAC-SHA256 using a symmetric key fetched from ChangesHMAC at-rest sealing
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Syslog_Start
participant HMACPolicy as HMAC-SHA256 Policy
participant SyslogStoreKey
participant DeviceCertStore
Syslog_Start->>HMACPolicy: configure store authentication
HMACPolicy->>SyslogStoreKey: request symmetric key
SyslogStoreKey->>DeviceCertStore: fetch provisioned store key
DeviceCertStore-->>SyslogStoreKey: return key material
SyslogStoreKey-->>HMACPolicy: provide key for sealing or verification
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@run-report.md`:
- Around line 50-62: Extend the self-check scenario in run-report.md beyond the
TLS delivery and resource counters to exercise an offline/store write and read
using the new key callback, then tamper with the stored record and verify it is
rejected with the expected HMAC verification failure. Document the resulting
store-path output alongside the existing report evidence.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 655d9d11-8caa-44a4-9802-2d06dbae7d44
⛔ Files ignored due to path filters (2)
measurements/hmac.csvis excluded by!**/*.csvmeasurements/stages.tsvis excluded by!**/*.tsv
📒 Files selected for processing (3)
README.mdapp/syslog/Syslog.crun-report.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request
What this stage adds
SolidSyslogMbedTlsHmacSha256Policy replaces SolidSyslogCrc16Policy on the store.
Records at rest are tamper-evident rather than checksummed: an edit without the key
fails verification, and Open compares in constant time.
Flash +13,424 B (+348 on the previous stage)
RAM +35,684 B (+20)
Log stack +712 B (unchanged)
Service +3,800 B (unchanged)
Twenty bytes, and it is the policy's pool entry — nothing else. The mechanism for
holding a named symmetric key and handing it out is the device's own: a device
already doing mTLS has provisioned secrets and somewhere to keep them, so the key
slot, the loader and the accessor all sit below the line. What SolidSyslog is
charged for is the policy and the callback that reaches for the key.
No stack movement and no heap: SHA-256 was already linked, and the policy hashes
into a caller-owned buffer.
The key is fetched per seal and per verify rather than held, so it never sits on
the policy instance.
Files
Checklist
measurements/hmac.csvcommitted.measurements/stages.tsv.python3 scripts/gen-cost-table.py../run.shgreen (build + QEMU + baseline self-check) —run-report.mdcommitted.Context for review: 17 of 21 sequential single-commit PRs replaying the integration on top of the Baseline root. Each lands green and reviewed before the next is built on it, because a change to an early commit would force every commit above it to be re-run and re-measured.
Summary by CodeRabbit
New Features
Documentation