feat: encrypt stored records with AES-256-GCM - #47
Conversation
SolidSyslogMbedTlsAesGcmPolicy replaces the HMAC policy on the store. Records at rest gain confidentiality on top of tamper-evidence: the body is encrypted, the record header is authenticated as associated data, and nonce and tag go in the trailer. Flash +13,780 B (+156 on the previous stage) RAM +37,748 B (+8) Log stack +712 B (unchanged) Service +3,800 B (unchanged) A hundred and fifty-odd bytes, because AES-GCM is already linked — a device that negotiates a GCM ciphersuite for TLS is carrying the same primitive the store now uses. No stack movement: the policy encrypts in place, into the buffer the store already owns. The mbedTLS pool does not move either; encrypting a record of this size asks nothing more of it, so peak x 1.5 still lands on 55 KiB. The store key is unchanged. Its name says what it protects, not which algorithm protects it, so escalating the policy does not need another key provisioned. GCM needs a fresh nonce per record and mbedTLS has no context-free RNG, so the policy takes the device's DRBG as well as the key. That is the only wiring difference from the HMAC policy. The pipeline element now reports what the store actually did, derived like the transport value rather than asserted, and both fall back to the weakest honest answer if the credentials behind them are missing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughSyslog now configures AES-256-GCM for stored records, passes RNG-backed security settings into TLS and block-store components, and reports transport and at-rest modes through structured data. README and run-report measurements are updated for the AES-GCM stage. ChangesAES-GCM syslog security
Estimated code review effort: 3 (Moderate) | ~20 minutes 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.
🧹 Nitpick comments (1)
run-report.md (1)
50-62: 🔒 Security & Privacy | 🔵 Trivial | 🏗️ Heavy liftExtend the self-check to prove at-rest encryption and tamper rejection.
The report validates the SD string and resource measurements, but does not inspect a spooled record, confirm plaintext is absent, or verify that modifying the header/body/tag is rejected. Add a deterministic QEMU or host check covering encryption, decryption, and tamper failure.
🤖 Prompt for 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. In `@run-report.md` around lines 50 - 62, Extend the self-check in run-report.md beyond the existing SD string and resource measurements to inspect a deterministic spooled record, confirm its stored content does not contain plaintext, verify it decrypts to the expected message, and exercise tampering of the header, body, and authentication tag with each modification being rejected. Use the existing AES-GCM measurement flow and report clear pass/fail results for encryption, decryption, and all tamper cases.
🤖 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.
Nitpick comments:
In `@run-report.md`:
- Around line 50-62: Extend the self-check in run-report.md beyond the existing
SD string and resource measurements to inspect a deterministic spooled record,
confirm its stored content does not contain plaintext, verify it decrypts to the
expected message, and exercise tampering of the header, body, and authentication
tag with each modification being rejected. Use the existing AES-GCM measurement
flow and report clear pass/fail results for encryption, decryption, and all
tamper cases.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: dfb45029-019b-4cd2-b5ca-f86a4c2e47b9
⛔ Files ignored due to path filters (2)
measurements/aes-gcm.csvis excluded by!**/*.csvmeasurements/stages.tsvis excluded by!**/*.tsv
📒 Files selected for processing (5)
README.mdapp/syslog/Syslog.capp/syslog/SyslogPipelineSd.capp/syslog/SyslogPipelineSd.hrun-report.md
Pull request
What this stage adds
SolidSyslogMbedTlsAesGcmPolicy replaces the HMAC policy on the store. Records at
rest gain confidentiality on top of tamper-evidence: the body is encrypted, the
record header is authenticated as associated data, and nonce and tag go in the
trailer.
Flash +13,780 B (+156 on the previous stage)
RAM +37,748 B (+8)
Log stack +712 B (unchanged)
Service +3,800 B (unchanged)
A hundred and fifty-odd bytes, because AES-GCM is already linked — a device that
negotiates a GCM ciphersuite for TLS is carrying the same primitive the store now
uses. No stack movement: the policy encrypts in place, into the buffer the store
already owns. The mbedTLS pool does not move either; encrypting a record of this
size asks nothing more of it, so peak x 1.5 still lands on 55 KiB.
The store key is unchanged. Its name says what it protects, not which algorithm
protects it, so escalating the policy does not need another key provisioned.
GCM needs a fresh nonce per record and mbedTLS has no context-free RNG, so the
policy takes the device's DRBG as well as the key. That is the only wiring
difference from the HMAC policy.
The pipeline element now reports what the store actually did, derived like the
transport value rather than asserted, and both fall back to the weakest honest
answer if the credentials behind them are missing.
Files
Checklist
measurements/aes-gcm.csvcommitted.measurements/stages.tsv.python3 scripts/gen-cost-table.py../run.shgreen (build + QEMU + baseline self-check) —run-report.mdcommitted.Context for review: 20 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