Status: MANUAL_EVIDENCE_REQUIRED.
This file is a reviewer packet, not a security review record. It contains no reviewer identity, signature, approval, or evidence JSON. Automated tests cannot satisfy the two mandatory manual audits, and this repository does not pretend that they do.
The official suite requires two independent human checks against the exact production commit:
| Audit | Obligation |
|---|---|
P-GENERATE-RNG-SOURCE |
Every production generation path obtains 12 fresh bytes from a cryptographically secure source. |
P-GENERATE-RNG-FAILURE |
Entropy-source failure aborts generation; there is no predictable fallback, truncation, retry loop, or partial output. |
Until a genuine independent reviewer records and approves both checks for the
release commit, a default suite run exits 3 and the release remains
NO-GO for the security gate.
- Repository:
pikaid/pikaid-ruby - Implementation id:
pikaid/pikaid-ruby - Gem version:
1.0.0 - Specification revision:
1.0.4 - Official suite revision:
1.0.0 - Official suite commit:
059780cc0e5b113443812720d95c630649bf3aa3 - Review commit: the full 40-character
git rev-parse HEADof the release candidate that contains this file. Reviewers must record that exact SHA in the evidence record; the suite rejects a commit mismatch.
There is one production entropy path. Both public generation entry points converge on it.
| Step | Location | Behavior |
|---|---|---|
Pikaid.generate(timestamp:) |
lib/pikaid.rb 32–33 |
build_id(timestamp).to_s |
Pikaid.generate_binary(timestamp:) |
lib/pikaid.rb 42–43 |
build_id(timestamp).to_binary |
| Timestamp selection and bounds | lib/pikaid.rb 224–226 |
Time.now.to_i when nil; Validation.timestamp! rejects non-Integer, negative, and overflow values before entropy is requested |
| Entropy request | lib/pikaid.rb 227, 230–231 |
secure_random_bytes(RANDOMNESS_BYTES) → SecureRandom.random_bytes(12) |
| Entropy size constant | lib/pikaid/constants.rb 20 |
RANDOMNESS_BYTES = 12 |
| Shape check | lib/pikaid.rb 232–235 |
The value must be a String of exactly 12 bytes; otherwise RandomnessError |
| Encoding normalization | lib/pikaid.rb 237 |
bytes.b (binary encoding; no truncation or numeric coercion) |
| Error mapping | lib/pikaid.rb 238–242 |
RandomnessError re-raised unchanged; StandardError and SecurityError wrapped as RandomnessError |
| Error contract | lib/pikaid/errors.rb 32–36 |
Pikaid::RandomnessError < Pikaid::Error; documented as fail-closed |
| Value construction | lib/pikaid.rb 227; lib/pikaid/id.rb 36–50 |
Id.new validates components, freezes the 12 bytes, and computes both canonical forms |
Pikaid::Id.new is a public decoding/validation constructor. It does not call
SecureRandom and therefore is not an additional entropy path. parse,
from_binary, valid?, well_formed?, compare, and the accessors are pure
decoding/validation and never request randomness.
Review these facts at the pinned commit:
- Both
generateandgenerate_binarycallbuild_id; no other production generation path exists (lib/pikaid.rb32–33, 42–43, 224–228). build_idrequests exactlyRANDOMNESS_BYTES, defined as 12, throughSecureRandom.random_bytes(lib/pikaid.rb227, 230–231;lib/pikaid/constants.rb20).SecureRandomis Ruby's standard-library cryptographic source. It delegates to the platform CSPRNG (OpenSSL'sRAND_byteswhen the openssl extension is available, otherwise Ruby's OS entropy implementation). No seed, counter,Random,rand,srand, UUID, PID, clock, or user-supplied value is used as entropy.- The returned value is checked for exact size and type before use
(
lib/pikaid.rb232–237). There is no truncation, padding, hashing of a short value, or widening of a long value. - Explicit timestamps change only the five-byte timestamp; the 12-byte
randomness request is unchanged (
lib/pikaid.rb224–227). - A leading-zero randomness value is preserved rather than stripped;
test/generation_test.rb90–98 proves the 12 bytes survive encoding. test/generation_test.rb78–88 proves repeated generation within one second yields distinct, valid identifiers (freshness sanity, not proof of CSPRNG quality).
Review these facts at the pinned commit:
SecureRandom.random_bytesis called exactly once per generation; there is no retry loop (lib/pikaid.rb227, 230–231).- Any exception from the source is converted to
Pikaid::RandomnessError(lib/pikaid.rb240–242).SecurityErroris explicit because it is not aStandardError. - A non-String or wrong-length result raises
RandomnessErrorinstead of being used (lib/pikaid.rb232–235). RandomnessErroris re-raised without double wrapping, so callers see the stable library error (lib/pikaid.rb238–239;lib/pikaid/errors.rb32–36).- Failure propagates to both public generation entry points because both call
build_id(lib/pikaid.rb32–33, 42–43). - Invalid timestamps raise
InvalidTimestampErrorbefore the source is called, so a bad timestamp cannot consume or mask a CSPRNG failure (lib/pikaid.rb225–226;test/generation_test.rb100–113). test/generation_test.rb134–148 asserts one source call, aRandomnessError, and the original exception ascause.test/generation_test.rb150–154 covers the binary entry point; 156–161 coversSecurityError; 163–170 covers wrong size and wrong type.
Run at the exact commit under review on a supported Ruby line:
git rev-parse HEAD
# Focused failure-path and freshness tests.
bundle exec ruby -Ilib -Itest test/generation_test.rb
# Direct fail-closed demonstration (fresh process, test-only stub).
ruby -Ilib -e '
require "pikaid"
require "securerandom"
SecureRandom.singleton_class.prepend(Module.new do
def random_bytes(_count); raise "CSPRNG offline"; end
end)
begin
Pikaid.generate
abort "generation unexpectedly succeeded"
rescue Pikaid::RandomnessError => error
puts "fail-closed: #{error.message}"
end
'Official suite, from the pinned conformance/ directory:
# Automated layer only: exit 0, explicitly non-certifying.
python tools/run_adapter.py --automated-only -- \
ruby -I/path/to/pikaid-ruby/lib /path/to/pikaid-ruby/test/support/official_adapter.rb
# Default run without a security evidence record: exit 3.
python tools/run_adapter.py -- \
ruby -I/path/to/pikaid-ruby/lib /path/to/pikaid-ruby/test/support/official_adapter.rb
echo $? # 3 while both manual audits are outstandingThe adapter's csprng_failure_injection capability is test-only. It prepends a
module to SecureRandom inside the adapter process to raise while the suite
activates the fault; production files are not modified. It proves the library's
own error mapping, not CSPRNG quality (test/support/official_adapter.rb
52–73, 117–135).
A genuine reviewer must create a JSON document conforming to the suite's
schemas/security-evidence.schema.json with:
format:pikaid-csprng-review-v1implementation_id:pikaid/pikaid-rubyimplementation_commit: the full 40-character release SHAspec_revision:1.0.4suite_revision:1.0.0reviewed_at_utc: the reviewer's UTC timestampreviewer: the reviewer's real identitychecks: exactlyP-GENERATE-RNG-SOURCEandP-GENERATE-RNG-FAILURE, bothPASS, each with repository-relative paths and line ranges
Then, from the pinned conformance/ directory:
python tools/run_adapter.py \
--security-evidence /path/to/genuine-review.json \
--implementation-commit <full-40-character-sha> \
-- ruby -I/path/to/pikaid-ruby/lib /path/to/pikaid-ruby/test/support/official_adapter.rbThe runner validates the record, not the reviewer's identity or the truth of the assertions. Approval must happen through the consuming release process. Do not commit a review record, add a reviewer signature, or inject one into CI unless a real independent reviewer produced and approved it.
- Automated official checks: PASS on Ruby 2.6–4.0 (see the release report).
P-GENERATE-RNG-SOURCE: OUTSTANDING — manual evidence not recorded.P-GENERATE-RNG-FAILURE: OUTSTANDING — manual evidence not recorded.- Matching verified security evidence record: none in this repository.
- Release security gate: NO-GO /
MANUAL_EVIDENCE_REQUIRED.