Skip to content

feat(records): OCCRP Aleph and UK Companies House sources - #154

Merged
JordanCoin merged 5 commits into
mainfrom
claude/open-prs-merge-review-e6z0ep
Nov 19, 2026
Merged

JordanCoin merged 5 commits into
mainfrom
claude/open-prs-merge-review-e6z0ep

Conversation

@JordanCoin

Copy link
Copy Markdown
Owner

Adds two international records sources, OCCRP Aleph and UK Companies House. Both are reachable through records search/fetch, and openfoia search picks them up automatically. Part of #55.

OCCRP Aleph (now "Aleph Pro")

  • What's in it: cross-border corporate registries, leaks and court records from 139 countries, as FollowTheMoney entities.

  • Anonymous search no longer works. This was checked live on 2026-11-19: anonymous calls get 401, even though Aleph's FAQ still describes a public API.

    • A personal key is needed, read from OPENFOIA_ALEPH_API_KEY (env only). It is withheld over Tor.
    • Accounts come from an OCCRP registration form, reviewed by hand.
  • Terms (updated 2026-03-12):

    • public-interest journalism only;
    • no KYC or due-diligence use;
    • no "automated or high-volume" access.

    OpenFOIA applies its own cap of 30 requests a minute and 500 a day; OPENFOIA_ALEPH_IGNORE_BUDGET=1 lifts it. The docs say the cap is ours, not OCCRP's.

  • Fetching: a fetch stores the entity and its expanded relations (2 requests). The people and companies are imported as FtM entities into the entity graph, with links.

UK Companies House

  • What's in it: companies, officers (directors), persons with significant control (owners) and filing history.
  • Key: free, but required. It's read from OPENFOIA_COMPANIES_HOUSE_API_KEY, sent as HTTP Basic, and withheld over Tor.
  • Rate limit: the documented limit is 600 requests per 5 minutes, and requests are counted locally against it.
  • Fetching: fetching a company gets its profile, officers, owners and filings (4 requests); officer:<id> gets a person's appointments. Both feed the entity graph.

Both sources

  • Tor: keys are personal, so they're never sent over Tor. unavailable_reason() makes openfoia search skip the source with a reason, and the CLI stops before sending anything.
  • The provider sees who you are: each notice says the key identifies you to the provider.
  • Requests:
    • Redirects are refused, and responses are capped (20 MB for Aleph, 10 MB for Companies House).
    • A 429 is waited out once if its Retry-After is short. A longer block is remembered and nothing more is sent.
    • Transport retries are off, so every attempt counts against the provider's limit.
  • Untrusted input:
    • Ids are validated before they go into a URL (no ..).
    • Response links are allowlisted: Aleph next links are never followed, and Companies House officer and Document API links must match exact paths and hosts.
    • Hostile strings are cleaned with termsafe.
  • Errors: an error is never shown as an empty result. Review added a fix here: Companies House returning a non-zero total with no result list now counts as an error.

What's verified and what isn't

  • Checked live: both access models (401s, auth headers, terms, rate limits), with links in the CHANGELOG and docs.
  • Not checked: I had no key for either service, so the authenticated response shapes come from Aleph's open-source API and the Companies House Swagger spec. Someone with keys should spot-check them.
  • Not built: document downloads (Companies House filing PDFs, Aleph original files). Both need a redirect step to an allowlisted host.

Checks


Generated by Claude Code

Both need the user's personal API key (env only), withheld over Tor, with a
local request budget, no redirects, capped responses and cleaned strings.
Fetched entities are imported through ftm_import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LaGpHLuSRHzGARb38X7YS
…es House

read_capped turns off transport retries so every try is counted against the
provider's limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LaGpHLuSRHzGARb38X7YS
…el, changelog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LaGpHLuSRHzGARb38X7YS
…ot empty

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LaGpHLuSRHzGARb38X7YS
@JordanCoin
JordanCoin merged commit ae5a31c into main Nov 19, 2026
9 checks passed
@JordanCoin JordanCoin mentioned this pull request Nov 19, 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.

2 participants