Deep security review: harden deserialization paths and publish updated security report#4
Draft
Deep security review: harden deserialization paths and publish updated security report#4
Conversation
Agent-Logs-Url: https://github.com/BackendStack21/k-mosaic/sessions/6e2f7f1d-5c91-45cc-82b2-871c6e9cc057 Co-authored-by: jkyberneees <4096860+jkyberneees@users.noreply.github.com>
Agent-Logs-Url: https://github.com/BackendStack21/k-mosaic/sessions/6e2f7f1d-5c91-45cc-82b2-871c6e9cc057 Co-authored-by: jkyberneees <4096860+jkyberneees@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
jkyberneees
April 10, 2026 17:47
View session
…ocol Replace SHAKE256(sk || challenge || witness) response with algebraically verifiable z = r + c*s' witness. Verifier now checks the full lattice relation A'*z - c*t' = w, preventing existential forgery without secret key knowledge. Response grows from 64 to 128 bytes (204-byte signatures).
Export matVecMul so the signing module can compute A'*z for algebraic verification of the sub-SLSS Sigma protocol witness.
Reflect the new sub-SLSS Sigma protocol response size (64B tBytes + 64B zBytes = 128 bytes, up from 64).
Add 3 new tests: arbitrary commitment forgery rejection, algebraic forgery with correct challenge but wrong response, and 1000 random forgery attempts. Update response size assertions to 128 bytes.
Update expected signature size from 140 to 204 bytes and clean stale comments referencing the old response format.
Add 4 CRIT and 4 HIGH findings from automated security audit. Include independent revalidation: CRIT-01 is false positive, CRIT-02/03 downgraded to HIGH (keyless decryption reduces KEM to SLSS-only), CRIT-04 confirmed critical with deeper root cause (t' not independently verifiable), all 4 HIGH findings confirmed valid.
Update response size comment, add existential forgery row to security table, bump test count from 304 to 366.
Rewrite Ch.9 for sub-SLSS Sigma protocol, refresh Ch.13 benchmark numbers with real measurements, update signature sizes throughout.
Replace all 140B references with 204B, update formulas, ratios, and performance numbers from real benchmark measurements.
Update timing numbers from actual bun run examples/benchmark.ts output.
Update sample benchmark output with real timings and 204-byte signature size.
Correct stale comment that referenced the old estimated signature size.
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.
Summary
This PR performs a deep security review pass and ships targeted hardening changes for exploitable malformed-input paths, plus a full updated
SECURITY_REPORT.md.Security fixes included
src/kem/index.tssrc/k-mosaic-cli.ts8 MBper section).src/sign/index.tsto reject trailing bytes.Regression coverage
test/kem-public-key-malformed.test.tsfor malformed/oversized public-key parsing.test/sign.test.tswith trailing-byte rejection coverage for signature parsing.Report
SECURITY_REPORT.mdwith a deep, current review documenting:Validation
npm run build✅npx prettier --checkon changed files ✅npm testcannot run in this runner because project test script requires Bun (bun test) and Bun is unavailable.