: asapien/signet

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
# Optional detached timestamps — source checkpoint 2026-11-19

## Scope and decision

Owner approved existing generic Signet sign-offs/facsimiles plus optional
validated detached RFC3161 evidence for the unchanged released PDF, **not
PAdES B-T**, certificate-based PDF signing, personal-key custody or a payroll
workflow. Approved dependencies are **libcurl + OpenSSL libcrypto**; the owner
specifically chose the HTTPS library over launching curl. No production/native
installation, preserved-preview upgrade, commit, publication or deployment.
See `docs/adr/0003-detached-release-timestamps.md`, `docs/timestamps.md` and
research `.scratch/{pdf-signatures,india-pades-key-custody}.md`.

## Implemented

- `src/timestamp.{c,h}`: SHA-256 imprint, fresh 128-bit nonce, HTTPS-only libcurl,
  no redirects/proxy, TLS peer/hostname checks, bounded response/timeouts;
  OpenSSL verifies full DER, nonce/imprint/version, signer/chain/validity/EKU
  against explicit TSA trust. CMS digest must be SHA-256/384/512; no SHA-1.
- `src/signet-timestamp.c`: short-lived system-cron runner, no HTTPS in render
  worker, one database-wide session advisory lock, four durable attempt slots
  consumed before I/O. Deadline is release +1h, approximate slots 0/5/20/55m;
  missed slots have at least1m spacing, never a reset window. A newly acquired
  lock waits1s too, covering a predecessor crashing before its final rate delay.
  No document row is held over HTTPS; hash/revision/released state guard storage.
- Fresh schema/migration004/grants, Makefile/install wiring, disabled config and
  cron example. Dependencies added only to the development Containerfile.
- API exposes separate server `signed_at`/`released_at` and validated
  `timestamped_at`/status/attempts. Authorized full RFC3161-response download
  uses `/api/docs/<id>/file/timestamp`, `application/timestamp-reply`, `.tsr`.
  Missing evidence404, backend failure503; original PDF access is unchanged.
- UI labels times separately, offers explicit pending-status refresh and evidence
  download; no hour-long polling, PDF rewriting or new document status.

## Verification and evidence

Private evidence/checkpoints:
`~/.local/var/signet-work/timestamp-implementation-20261119/`.
`before/` preserves the already-dirty pre-timestamp tree; do not confuse its
contents with Git HEAD or restore unrelated work away.

Final owned image `signet-timestamp-r5` and disposable stack of the same name:
warning-clean full rebuild plus real `make install` in the container. A later
incremental header rebuild/staged DESTDIR install also passed and reproduced
the installed timestamp binary. **101 product/config/fixture/test/build-input
hashes** match the authoritative worktree (`sources.sha256`, `final-checks.log`).
libcurl8.14.1 / OpenSSL libcrypto3.5.8; linkage inspected.
Final image ID `5b7095868485a9318a7b3fc853ef7f9dd5bfb476e39b4b7546c4866bf1106426`;
base remains verified `0e7b09eb561705af9d5b20ebc116865977ec85e5c5364f9f17779382ea67ea14`.
All five owned timestamp stacks are now **stopped, exit0** (`stopped.log`);
private :18095 is no longer served. The three preserved stacks remain running
unchanged on their existing :8080/:18087/:18090 ports. `sh -n` passes for all
new/modified shell files and the private check script; `node --check www/app.js`
passes. Tests are POSIX-sh syntax using existing Alpine-specific facilities,
not a claim of cross-platform utility portability.

`final-r5.log` ends full E2E **all passed**, then passes the32-document synthetic
A5 probe. Timestamp coverage includes valid SHA-256/384/512 evidence, wrong
nonce/imprint, damaged signature, expired/untrusted signer, untrusted HTTPS,
SHA-1 rejection, rejected/malformed/oversized/HTTP-error replies, HTTP refusal,
timeout, four attempts, actual SIGKILL/restart slot consumption, deadline expiry,
concurrent-runner exclusion, real disposable cron, preservation of old migration
fields/decisions/grants, all four status labels, revision/hash binding,
owner/party/admin download and unrelated-user denial, backend503, unchanged
final PDF/sign-off time, and another document releasing during a held TSA request.
The scheduler was drained before removing its fixture, with no live fixture
worker/cron/TSA, temporary TSA directory, migration database, held advisory lock,
DB holder or stamping queue job after final checks.

- Timestamp/release fixture sampled **39,784KiB /40,738,816bytes** aggregate app
  RSS; includes the actual short-lived timestamp worker and concurrent small
  document release, excludes root test client/compiler/TSA, PostgreSQL and Redis.
- Subsequent synthetic32-document A5 batch sampled **33,660KiB /34,467,840bytes**,
  source4108bytes,29 rows each, exact source/final hashes, seal/facsimile and audit.
  Timestamp scheduler is off during this A5-only batch; these are separate
  representative fixtures, **not** a worst-case simultaneous A5/TSA/native proof.
- Sampler is a non-atomic1ms Linux `/proc` scan. Ticket20's existing warm parser
  overlap counterexamples and native/aggregate gates remain OPEN.

Earlier logs are retained honestly: r1 had a deprecated OpenSSL store setter
warning, fixed with the3.4+ API/older-version fallback; `weak-digest-red.log`
reproduced that libcrypto accepted a SHA-1 CMS signature before the explicit
policy fix. Initial r3 E2E/trace failed a new test because API configuration uses
`SIGNET_CONF`, not a `-c` argument; only the test was corrected. The standalone
r3 fix, full r4, and final r5 passed. Do not report those earlier failures as passes.

## Limits / next authorization

No live TSA/provider trust has been configured or contacted; local synthetic
HTTPS verification is not provider or legal qualification. No online revocation
fetch/check, archival renewal or long-term-validation system is implemented.
The optional existing browser regression was **not run**: its old
`/tmp/signet-ticket10-browser/node_modules/playwright-core` directory has been
pruned and lacks `index.mjs`; no dependency reinstall/alternative automation was
introduced. JS syntax/source review and native/API checks are not browser UX
acceptance. Native/OpenRC, deployment trust/permissions/cron and aggregate memory
acceptance still require separate authorized work. Preserved previews, original
checkout, private A5 files, host clock/known_hosts and third-party/vendor code are
untouched. This timestamp checkpoint intentionally changes product files AFTER
the restored final22 parser baseline; it does not repair or supersede ticket20.