Decision dossier
Provider-credential security
A static review of decisions already embedded in the code.
- Target
- github.com/subhajitlucky/tarkaSabha
- Snapshot
- ebee93f
- Reviewed
- 21 Oct 2026
- Scope
- Provider credentials
- Artifact
- Sample self-audit
Tarka SabhaDiligenceSample 01
Public artifact · No customer data
Decision diligence · Public sample dossier
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.
Decision dossier
Provider-credential security
A static review of decisions already embedded in the code.
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
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 record02Decision inventory
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
Reversible, authenticated encryption; masked in responses; decrypted only server-side.
Listed to show the inventory format. Not analyzed in this sample.
Listed to show the inventory format. Not analyzed in this sample.
D-002 and D-003 are listed to show the inventory format. They are not analyzed in this sample.
Coverage
Evidence mix
08 itemsSnapshot
ebee93f
Evidence pinned
8 / 8 items
Coverage measures analysis, not cleanliness. Two candidates have no evidence attached.
Exposure map
| Deal impact | Thin | Partial | Strong |
|---|---|---|---|
| Highimpact | D-001 Key encryption 6 ev. | ||
| Mediumimpact | D-003 Server runner 0 ev. | ||
| Lowimpact | D-002 Speaker order 0 ev. |
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
The choice, the implementation, and the options that were rejected — with the evidence attached.
Verified
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.
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>iv:authTag:ciphertext values remain decryptable with a fixed-salt key.Options considered
Plaintext storage
Simplest implementation. Rejected because a database leak exposes every key.
One-way hash
Protects the secret. Rejected because the server must recover the key to call the provider.
Application-level AES-256-GCM
Reversible, authenticated encryption with no external dependency.
KMS / envelope encryption
Stronger key custody and rotation. Not implemented; this is the residual gap.
04Evidence ledger
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
src/lib/crypto.ts
L31–L36, L60–L78 · ebee93f
AES-256-GCM; random salt and IV; versioned ciphertext format.
SHA-256
a5694781…
src/lib/crypto.ts
L84–L108 · ebee93f
Versioned and legacy decryption paths are both present.
SHA-256
same file as E-01
src/app/api/providers/route.ts
L48–L56 · ebee93f
GET excludes apiKey and returns a placeholder.
SHA-256
f08cce81…
src/app/api/providers/route.ts
L120–L121, L147–L149 · ebee93f
POST encrypts before storage and masks the response.
SHA-256
same file as E-03
src/lib/llm-provider.ts
L944–L960 · ebee93f
Keys are decrypted only server-side before a provider call.
SHA-256
69d2cc33…
src/lib/__tests__/crypto.test.ts
L19–L55 · ebee93f
Round-trip, random ciphertext, legacy support, malformed input, and masking tests.
SHA-256
cc52878c…
README.md
L191–L198 · ebee93f
Public security claim: keys are encrypted before storage and masked when displayed.
SHA-256
430f77fe…
prisma/schema.prisma
L72–L88 · ebee93f
Provider.apiKey is a string field; the application stores ciphertext there.
SHA-256
23539b24…
Evidence hashes are SHA-256 of the file at snapshot ebee93f. Line numbers are from that snapshot.
Claim check
No contradiction with the README claim was found. The claim is supported by the code and tests.
Claim support
3 / 4“API keys are encrypted before storage.”
README.md L193
Code encrypts before prisma.provider.create.
“Masked when displayed.”
README.md L193
GET returns a placeholder; POST masks the stored value.
“Provider calls stay server-side.”
README.md L194
getLLMResponse runs server-side; no client provider call found in scope.
Key rotation is supported.
Not claimed
No key ID or rotation path found.
05What remains unresolved
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 itemsENCRYPTION_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.
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.
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.
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.
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
Where is the master key stored?
Why it matters
A database dump plus the key defeats the control.
Request
KMS / config inventory, IAM policy
Is there a rotation plan?
Why it matters
The ciphertext has no key ID.
Request
Runbook, migration plan
Are backups encrypted?
Why it matters
Backups are a common leak path.
Request
Backup policy, access list
Is legacy ciphertext still active?
Why it matters
The fixed-salt legacy format is weaker.
Request
Migration status, record counts
Why does POST mask ciphertext?
Why it matters
The response semantics are confusing.
Request
Confirm client expectations
Revisit D-001 when
5 triggers06Method & limits
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 + historyOut of scope
7 areasMethod
StaticLimitation
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 rulesThe 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.1Next deal
Design-partner diligence sprints are scoped per deal. Start with the sample, then tell us what you need to know before signing.