Skip to content
Tarka Sabha

Tarka SabhaDiligenceSample 01

Public artifact · No customer data

Decision diligence · Public sample dossier

Know what the code decided before you sign.

A source-backed dossier of what the target decided, what proves it, and what remains unresolved — read from a public repository at a single commit.

Sample self-audit. No customer data, personal data, or real credentials are included.

Dossier / 001v0.1

Decision dossier

Provider-credential security

A static review of decisions already embedded in the code.

Sample
Target
github.com/subhajitlucky/tarkaSabha
Snapshot
ebee93f
Reviewed
21 Oct 2026
Scope
Provider credentials
Artifact
Sample self-audit
1 of 3 analyzed8 evidence items

03

Decisions in inventory

2 candidates · 1 verified

1 / 3

Fully analyzed

D-001 has a complete record

08

Evidence items

Pinned to snapshot ebee93f

06

Open questions

5 carry a document request

01Executive brief

The control is real. The key lifecycle is the gap.

D-001 · Verified

Provider API keys are encrypted before storage, masked in API responses, and decrypted only server-side before a provider call.

That is materially better than plaintext. A plaintext store would expose every customer’s provider account and potentially their data.

The control is supported by code, tests, and a checked README claim. The gap is the master-key lifecycle: where the key lives, who can read it, and how it rotates is not visible in the repository.

What a buyer should do

Ask for key-custody and rotation evidence. Consider a reps/warranty on key management, and an integration question if the acquirer requires KMS/HSM-backed keys.

Read the D-001 record
08 evidence items04 claims checked01 unsupported claim05 document requests

02Decision inventory

Three decisions. One full record.

The register ranks decisions by deal impact. Only D-001 is analyzed; D-002 and D-003 are candidates that demonstrate the inventory format.

1 verified · 2 candidates

D-002

Use deterministic round-robin speaker order

Candidate

Listed to show the inventory format. Not analyzed in this sample.

Product / reliabilityImpact Low–MediumEvidence —
Not analyzed
D-003

Run debates through a server-side runner with atomic claims

Candidate

Listed to show the inventory format. Not analyzed in this sample.

ReliabilityImpact MediumEvidence —
Not analyzed

D-002 and D-003 are listed to show the inventory format. They are not analyzed in this sample.

Coverage

One record in full.

1 / 3
Core evidence for D-001
6 items
Supporting artifacts
2 items
Candidates without evidence
2

Evidence mix

08 items
Implementationcrypto · routes · adapter
5
Testscrypto suite
1
Public claimREADME
1
Storage schemaPrisma model
1

Snapshot

ebee93f

Evidence pinned

8 / 8 items

Coverage measures analysis, not cleanliness. Two candidates have no evidence attached.

Exposure map

Where the evidence is thin

Deal impact × evidence
Impact × evidence strength
Deal impactThinPartialStrong
Highimpact
D-001

Key encryption

6 ev.
Mediumimpact
D-003

Server runner

0 ev.
Lowimpact
D-002

Speaker order

0 ev.
High impact, thin evidencePartial evidence or medium impactHigh impact, evidencedLow impact, no evidence

Placement is a diligence judgement from impact and evidence strength, not a probability.

D-002 and D-003 have no evidence attached. They sit in the thin-evidence column until analyzed.

03Decision record — D-001

One decision, read end to end.

The choice, the implementation, and the options that were rejected — with the evidence attached.

Verified

D-001VerifiedSecurityMedium–High impact
E-01 – E-06

Finding

Provider API keys are encrypted before storage, masked in API responses, and decrypted only server-side before a provider call.

A plaintext key store would expose every customer’s provider account and potentially their data. The control is materially better than plaintext, but the master-key lifecycle is not visible in the repository.

Deal impact
Medium–High
Confidence
High / Medium
Implementation / production custody
Owner
Founder / CTO
Self-approved in public repo
Snapshot
ebee93f
20 Oct 2026

Context

Tarka lets users bring their own LLM provider credentials. The server stores those keys so it can make provider calls on the user’s behalf. A plaintext store would expose paid provider accounts, usage, and potentially customer content if a key were abused.

The decision addresses credential confidentiality at rest, safe display in the UI, server-side-only use, and backward compatibility with earlier ciphertext.

Decision

Store provider keys encrypted with AES-256-GCM. New ciphertext uses a versioned format:

enc:v2:<salt>:<iv>:<authTag>:<ciphertext>
Salt
Random 16 bytes, generated per encryption
Key derivation
scrypt(masterKey, salt) → 32-byte key
IV
Random 16 bytes, generated per encryption
Key source
ENCRYPTION_KEY, at least 32 characters
  • The authentication tag is stored with the ciphertext.
  • Legacy iv:authTag:ciphertext values remain decryptable with a fixed-salt key.
  • API responses never return the plaintext key; reads use a placeholder, and writes mask the stored value.

Options considered

Plaintext storage

Simplest implementation. Rejected because a database leak exposes every key.

Rejected

One-way hash

Protects the secret. Rejected because the server must recover the key to call the provider.

Rejected

Application-level AES-256-GCM

Reversible, authenticated encryption with no external dependency.

Chosen

KMS / envelope encryption

Stronger key custody and rotation. Not implemented; this is the residual gap.

Not implemented

04Evidence ledger

Eight pieces of evidence. Every claim has coordinates.

Six core items support D-001. Two supporting artifacts check the public claim and the storage shape. Each is tied to a file, a line range, and a SHA-256 hash at the snapshot commit.

Pinned to ebee93f

  1. E-01

    src/lib/crypto.ts

    L31–L36, L60–L78 · ebee93f

    AES-256-GCM; random salt and IV; versioned ciphertext format.

    a5694781…

  2. E-02

    src/lib/crypto.ts

    L84–L108 · ebee93f

    Versioned and legacy decryption paths are both present.

    same file as E-01

  3. E-03

    src/app/api/providers/route.ts

    L48–L56 · ebee93f

    GET excludes apiKey and returns a placeholder.

    f08cce81…

  4. E-04

    src/app/api/providers/route.ts

    L120–L121, L147–L149 · ebee93f

    POST encrypts before storage and masks the response.

    same file as E-03

  5. E-05

    src/lib/llm-provider.ts

    L944–L960 · ebee93f

    Keys are decrypted only server-side before a provider call.

    69d2cc33…

  6. E-06

    src/lib/__tests__/crypto.test.ts

    L19–L55 · ebee93f

    Round-trip, random ciphertext, legacy support, malformed input, and masking tests.

    cc52878c…

  7. E-07

    README.md

    L191–L198 · ebee93f

    Public security claim: keys are encrypted before storage and masked when displayed.

    430f77fe…

  8. E-08

    prisma/schema.prisma

    L72–L88 · ebee93f

    Provider.apiKey is a string field; the application stores ciphertext there.

    23539b24…

Evidence hashes are SHA-256 of the file at snapshot ebee93f. Line numbers are from that snapshot.

Claim check

What the README claims — and what the code shows.

No contradiction with the README claim was found. The claim is supported by the code and tests.

Claim support

3 / 4
Verified by code
3
Not supported or not claimed
1

“API keys are encrypted before storage.”

README.md L193

Code encrypts before prisma.provider.create.

Verified

“Masked when displayed.”

README.md L193

GET returns a placeholder; POST masks the stored value.

Verified

“Provider calls stay server-side.”

README.md L194

getLLMResponse runs server-side; no client provider call found in scope.

Verified

Key rotation is supported.

Not claimed

No key ID or rotation path found.

Unsupported

05What remains unresolved

The honest list of what the code cannot prove.

Residual risks stay attached to the record. The diligence requests turn each gap into a document a buyer can ask for.

5 risks · 6 questions

Residual risk register

05 items
  1. 01

    Single master key, no key ID or rotation

    ENCRYPTION_KEY is one environment value. There is no key version in the ciphertext, no KMS/HSM integration, and no rotation procedure. Rotating the key would require decrypting and re-encrypting every record.

  2. 02

    Legacy ciphertext remains decryptable

    The legacy format derives the key with a fixed salt ("salt"), which is weaker than the per-record salt in v2. Supporting it is reasonable for migration, but the migration end date is not documented.

  3. 03

    Build-time dummy key

    getEncryptionKey() returns a fixed placeholder during the Next.js production build if ENCRYPTION_KEY is missing. Runtime calls fail closed, but a build can succeed without the production key. This is an operational footgun, not a plaintext leak.

  4. 04

    POST response masks ciphertext

    cryptoService.maskKey(newProvider.apiKey) is applied to the encrypted value, so the last four characters are ciphertext, not the plaintext key. This is not a leak, but the response semantics are misleading.

  5. 05

    Database and backup access

    The control protects against a database dump that contains only ciphertext. It does not protect against an attacker who obtains both the database and the master key. Backup encryption and key custody sit outside the repository.

Diligence requests

Five requests for the data room.

High → Low
  1. High

    Where is the master key stored?

    Why it matters

    A database dump plus the key defeats the control.

    Request

    KMS / config inventory, IAM policy

  2. High

    Is there a rotation plan?

    Why it matters

    The ciphertext has no key ID.

    Request

    Runbook, migration plan

  3. Medium

    Are backups encrypted?

    Why it matters

    Backups are a common leak path.

    Request

    Backup policy, access list

  4. Medium

    Is legacy ciphertext still active?

    Why it matters

    The fixed-salt legacy format is weaker.

    Request

    Migration status, record counts

  5. Low

    Why does POST mask ciphertext?

    Why it matters

    The response semantics are confusing.

    Request

    Confirm client expectations

Revisit D-001 when

5 triggers
  • A key-rotation requirement from a customer or auditor.
  • A move to KMS/HSM or per-tenant keys.
  • A provider-key incident.
  • A new provider that needs a different credential shape.
  • A compliance requirement for key-custody evidence.

06Method & limits

A static review. The limits are part of the record.

The dossier is only useful if a buyer can see exactly what was reviewed, what was not, and how the evidence was pinned.

Snapshot ebee93f · 21 Oct 2026

In scope

6 files + history
  • src/lib/crypto.ts
  • src/app/api/providers/route.ts
  • src/lib/llm-provider.ts
  • src/lib/__tests__/crypto.test.ts
  • prisma/schema.prisma
  • README.md
  • Relevant Git history

Out of scope

7 areas
  • Runtime infrastructure
  • Production key management
  • Database backups and access controls
  • Cloud IAM
  • Provider-side logging
  • Incident history
  • Customer interviews

Method

Static
  • Static review of the public repository at one commit.
  • Read the crypto module, provider route, provider adapter, tests, schema, and README.
  • Checked Git history for the original implementation and later hardening.
  • Did not execute the application.
  • Did not access production infrastructure, databases, or backups.
  • Did not interview the founder. Used no customer data.

Limitation

This is a static review of a public repository at one commit. It does not prove runtime behavior, key custody, backup encryption, or production configuration. It is a sample of the artifact, not a full diligence engagement.

Redaction & sharing

03 rules
  • No personal data, customer names, or proprietary code is included.
  • A real dossier would remove secrets, PII, and customer identifiers before sharing.
  • Share links should expire after seven days, be watermarked, and log access.

The sample uses the public test string sk-live-super-secret-api-key from the test suite. It is not a real credential.

Artifact record

v0.1
Artifact type
Sample self-audit
Prepared
21 Oct 2026
Snapshot
ebee93f
Revision
Initial sample for schema validation
Download the full Markdown dossier

Next deal

Bring the evidence pack to the next deal. Not just a code review.

Design-partner diligence sprints are scoped per deal. Start with the sample, then tell us what you need to know before signing.