Skip to content

feat(pki): add SigningService interface, mock implementation and unit… - #15

Closed
makr-code wants to merge 3 commits into
mainfrom
feature/wal-archiving
Closed

makr-code wants to merge 3 commits into
mainfrom
feature/wal-archiving

Conversation

@makr-code

@makr-code makr-code commented Nov 12, 2025 •

Copy link
Copy Markdown
Owner

This PR adds a scaffold and first implementations for PKI/eIDAS work and backup scaffolding.

Changes included:

  • interface ().
  • Mock signing implementation using OpenSSL EVP (, ).
  • CMS-based signing service using OpenSSL CMS (, , ).
  • BackupManager scaffold for incremental backups / WAL archiving (, , ).
  • Docs: , .

Checklist (what to review / next actions):

  • API of and mock impl (thread-safety, error modes).
  • CMS implementation: uses / with DETACHED DER encoding (prototype-level).
  • BackupManager scaffold: filesystem-based placeholder, suitable for unit tests only.

Recommended next steps:

  1. Integrate with /Vault/HSM for production key material (feature: key lookup + secure PKCS#11). (1-2d)
  2. Extend CMS to CAdES: add signed attributes (signingTime, signaturePolicyId), and signature-policy validation for eIDAS compliance. (1-2d)
  3. Implement (HTTP endpoints) + integration tests that exercise sign/verify flows. (1d)
  4. Expand to use RocksDB checkpoints and add S3 uploader for archive retention. (2-3d)

Notes:

  • The PR intentionally supplies scaffolds and unit-tests that generate keys/certs in-memory. No secrets are stored in the repo.
  • Production eIDAS compliance requires legal/policy review, signature-policy configuration and potentially use of a qualified trust service provider (QTSP).

If you'd like, I can also:

  • Add a reviewer list / assignees to this PR.
  • Split PKI and backup scaffolds into two separate PRs (smaller review surface).
  • Run a focused CMake build of the new tests in the dev container and report missing system packages.

@makr-code
makr-code marked this pull request as draft November 12, 2025 15:05
@makr-code
makr-code marked this pull request as ready for review November 12, 2025 15:05
@makr-code makr-code closed this Nov 17, 2025
Copilot AI added a commit that referenced this pull request Jan 7, 2026
Security fixes for remaining TODO items from ROCKSDB_WRAPPER_AUDIT_REPORT.md:

Issue #12 (Phase 2 - Reopen Leak):
- Add explicit close() before db_.reset() when database already open
- Prevents resource leak when reopening after failed open
- Ensures clean state before reinitialization

Issue #13 (Phase 2 - Snapshot Inconsistency):
- Add comprehensive documentation for snapshot lifecycle
- Clarify that snapshots are transaction-local
- Warn callers not to use snapshot pointers after transaction ends

Issue #14 (Phase 2 - write_options Cleanup):
- Already fixed: del() function now uses transactions (line 567)
- No direct write_options_ access, prevents use-after-free
- Consistent with MVCC transaction model

Issue #15 (Phase 3 - Infinite Loop in scanPrefix):
- Add prefix_same_as_start ReadOption for prefix scans
- Prevents over-iteration when prefix doesn't match
- RocksDB optimizes and auto-stops when prefix changes
- Protects against denial-of-service via excessive scanning

All 4 security gaps from audit report are now addressed.

Co-authored-by: makr-code <[email protected]>
@makr-code makr-code added this to the Phase 4: Advanced Features milestone Feb 21, 2026
@makr-code makr-code added this to the v1.0.2 milestone Mar 11, 2026
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