Skip to content

Audit 2026-11: public API reference link + E-18 signed records export - #1

Draft
TheDude4224 wants to merge 3 commits into
mainfrom
audit/2026-11-fixes
Draft

TheDude4224 wants to merge 3 commits into
mainfrom
audit/2026-11-fixes

Conversation

@TheDude4224

Copy link
Copy Markdown
Member

Finding → commit → test

1. API reference link (follow-up to infinihash-baas #141, T-1/E-15a), commit 4175187

infinihash-baas #141 puts /api/docs behind auth. The public spec is served at /docs/openapi.public.json, but only when the server has PUBLIC_API_SPEC=true.

file before after
README.md:19 Reference: https://rails-api.infinihash.com/api/docs. Reference: https://rails-api.infinihash.com/docs/openapi.public.json (public OpenAPI spec; the full /api/docs reference needs an API key).
pyproject.toml:20 "API reference" = "https://rails-api.infinihash.com/api/docs" "API reference" = "https://rails-api.infinihash.com/docs/openapi.public.json"

Verified with rg api/docs: the only remaining mention is the "needs an API key" note.

Dependency / deploy order: as of 2026-11-26, GET /docs/openapi.public.json returns 404 and /api/docs returns 200, because #141 isn't deployed and the flag is off. Merge this after #141 ships with PUBLIC_API_SPEC=true, or the new link is dead in the meantime.

2. E-18: signed records export keeps bytes and signature, commit 32c1988

records_export() parsed the body as JSON and dropped X-Infinihash-Export-Signature, so nothing it returned could be verified. The Ed25519 signature covers the exact body bytes (infinihash-baas src/lib/recordsExport.js).

  • New Rails.records_export_signed(from_=None, to=None, format=None) returns {"body": bytes, "signature": str|None, "key_id": str|None, "sha256": str|None}.
  • New parse_export_signature(header) parses ed25519;keyid=<id>;sig=<base64> and returns {} for an unsigned or malformed header.
  • records_export() is unchanged, so existing callers aren't affected. Its docstring now says the parsed result can't be verified.
  • I did not add verify_export(), because cryptography isn't a dependency (only requests). The README documents verification with cryptography and with openssl pkeyutl. I checked the cryptography snippet in a scratch venv against a real Ed25519 signature: it verifies, and a tampered body raises InvalidSignature.

New tests in tests/test_client.py:

  • the raw body, signature, key_id and sha256 are returned, with the right params and auth;
  • an unsigned deployment;
  • 401 raises RailsError, and a missing key refuses before any network call;
  • records_export() still returns parsed JSON;
  • the signature parser, including malformed input.

Tests

  • Before: 7 passed.
  • After the fix: 12 passed.
  • New tests run against the old code: 4 failed, 8 passed.

CI cannot run: GitHub Actions has failed at startup across the org since about 2026-11-15.

Not done / flagged

  • .github/workflows/ci.yml runs import infinihash_kyc (the wrong package), so CI's "Examples import cleanly" step fails even when Actions is working. Not changed here.
  • build/lib/ and infinihash_baas.egg-info/ are committed build artefacts with a stale copy of client.py. Not touched.
  • No version bump or tag. Cut v0.1.1 when you release; the README install line pins @v0.1.0.

🤖 Generated with Claude Code

TheDude4224 and others added 3 commits November 26, 2026 21:24
…json

infinihash-baas #141 puts /api/docs behind auth; the public spec is served
at /docs/openapi.public.json when PUBLIC_API_SPEC=true. README and the
pyproject 'API reference' URL now link the public spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
records_export() parsed the JSON and dropped X-Infinihash-Export-Signature,
so nothing it returned could be verified (the Ed25519 signature covers the
exact body bytes). Add records_export_signed(from_, to, format) returning
{body: bytes, signature, key_id, sha256}, plus parse_export_signature().
records_export() is unchanged. cryptography is not a dependency, so
verification is documented in the README instead of shipped as a helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found by local-ci: `pip install .` packaged the committed, stale
build/lib/infinihash_baas/client.py instead of the source, so the new
records_export_signed() tests failed (4 failed / 8 passed on every matrix
leg). Removes build/ and *.egg-info from git, ignores them, and fixes the
CI step that imported infinihash_kyc instead of infinihash_baas.
Clean install: 12 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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