Skip to content

Add the LogicSRC OpenCreds specification - #140

Merged
ralyodio merged 4 commits into
masterfrom
opencreds
Aug 29, 2026
Merged

Add the LogicSRC OpenCreds specification#140
ralyodio merged 4 commits into
masterfrom
opencreds

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Leaving a password manager means writing every secret you own to disk in the clear, and losing whatever the spreadsheet had no column for. A CSV is plaintext by construction, lossy by omission, and carries no integrity: nothing in it says which rows were meant to be there, so a truncated import looks exactly like a complete one.

The same gap showed up inside LogicSRC. logicsrc credentials moves .env secrets and SSH keys through end-to-end-encrypted team vaults, but it can only model a key/value pair. A card, a passport, a login with a TOTP seed, or an OAuth account with a refresh token are all things people already keep in a vault, and none of them are a key/value pair.

OpenCreds defines three things: the item, the vault, and the database.

  • Six item types (login, card, identity, note, key, account) as one record with a type and a named field group, so everything the user typed lives in a single encrypted blob — which is what makes password history free rather than a second table someone can forget to protect. Codes 1–4 match MarkSyncr's deployed vault and are not renumbered; compatibility is cheaper than elegance.
  • One envelope: AES-256-GCM with the item id bound as AAD. Without it, anyone with storage write access could move a low-value login's ciphertext into a high-value row and watch what the user does next.
  • One key hierarchy: the user key is random, not derived, so a password change re-wraps 32 bytes rather than re-encrypting a vault. The auth hash comes out of a different HKDF label than the wrap key, which is what lets it reach a server at all.
  • One file: a portable .opencreds database, encrypted by default, whose header is bound as AAD over the payload — so the manifest is authenticated by the same tag as the data and a truncated import fails rather than reporting success.

Namespaces are carried as data, not fixed by the spec: labels are compiled into every ciphertext a vault has written, so editing one does not migrate a vault, it makes it undecryptable. MarkSyncr's deployed vault is conformant by declaring marksyncr, with nothing re-encrypted.

What ships

  • prd/0004-add-logicsrc-opencreds-spec.md and nine spec pages under docs/opencreds/
  • Six JSON Schemas in @logicsrc/schemas
  • @logicsrc/opencreds — the reference implementation, with CSV importers for Bitwarden, 1Password, Chrome, LastPass and KeePass
  • logicsrc vault … and the standalone opencreds binary, from one module so they cannot drift
  • The spec page at logicsrc.com/opencreds
  • opencreds conformance — the requirement list as code, plus a generated fixture set (--emit-fixtures)

Notes for review

  • The command is logicsrc vault, not logicsrc creds: creds is already an alias of logicsrc credentials, and the two are genuinely different — one moves a pair between providers, the other stores a record. They meet at the key item.
  • @logicsrc/validators now registers every schema by $id before compiling, so the database schema can $ref the item and manifest schemas rather than restating them. Existing validator tests unchanged and passing.
  • The plaintext export exists deliberately, because people move to products that read nothing else. It is opt-in, confirmed, 0600, and writes "protected": false into its own header.

Verification

  • 127 tests, including CLI end-to-end coverage of the masking rules, exit codes and the manifest-mismatch path
  • opencreds conformance: 29 passed, 0 failed, 1 skipped (C19, the team profile, whose key management lives in the credential-sharing plugin)
  • 75 web contract tests pass; the site builds
  • Verified interoperable against @marksyncr/vault in both directions, item records byte-identical — see profullstack/marksyncr.com#opencreds-vault

🤖 Generated with Claude Code

https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5

ralyodio and others added 2 commits August 29, 2026 10:00
Leaving a password manager means writing every secret you own to disk in
the clear, and losing whatever the spreadsheet had no column for. A CSV
is plaintext by construction, lossy by omission, and carries no
integrity: nothing in it says which rows were meant to be there, so a
truncated import looks exactly like a complete one.

The same gap showed up inside LogicSRC. `logicsrc credentials` moves
.env secrets and SSH keys through end-to-end-encrypted team vaults, but
it can only model a key/value pair. A card, a passport, a login with a
TOTP seed, or an OAuth account with a refresh token are all things
people already keep in a vault, and none of them are a key/value pair.

OpenCreds defines three things: the item, the vault, and the database.

- Six item types (login, card, identity, note, key, account) as one
  record with a type and a named field group, so everything the user
  typed lives in a single encrypted blob. Codes 1-4 match MarkSyncr's
  deployed vault and are not renumbered; compatibility is cheaper than
  elegance.
- AES-256-GCM over that record with the item id bound as AAD. Without
  it, anyone with storage write access could move a low-value login's
  ciphertext into a high-value row and watch what the user does next.
- A key hierarchy where the user key is random, not derived, so a
  password change re-wraps 32 bytes rather than re-encrypting a vault.
  The auth hash comes out of a different HKDF label than the wrap key,
  which is what lets it reach a server at all.
- A portable .opencreds file, encrypted by default, whose header is the
  AAD over the payload -- so the manifest is authenticated by the same
  tag as the data and a truncated import fails rather than reporting
  success. The plaintext form exists because people move to products
  that read nothing else; it is opt-in, confirmed, 0600, and labelled
  "protected": false in its own header.

Namespaces are carried as data, not fixed by the spec: labels are
compiled into every ciphertext a vault has written, so editing one does
not migrate a vault, it makes it undecryptable. MarkSyncr's deployed
vault is conformant by declaring `marksyncr`.

Ships: prd/0004, nine spec pages under docs/opencreds/, six JSON
Schemas, the @logicsrc/opencreds reference implementation with CSV
importers for five products, `logicsrc vault` and the standalone
`opencreds` binary, and the spec page at logicsrc.com/opencreds.

`vault` rather than `creds` because `creds` is already an alias of
`logicsrc credentials`, and the two are different: one moves a pair
between providers, the other stores a record.

@logicsrc/validators now registers every schema by $id before
compiling, so the database schema can $ref the item and manifest
schemas rather than restating them.

120 tests, including CLI end-to-end coverage of the masking rules,
exit codes, and the manifest-mismatch path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5
The conformance page described a fixture suite and an `opencreds
conformance` command that did not exist. A specification that documents
a conformance surface it cannot run is a specification nobody can hold
to, including us.

`opencreds conformance` now runs the requirement list as code -- one
check per C-number, carrying its own id and level -- and emits the
report shape the spec publishes. It exits 2 when a MUST does not pass,
so it can gate CI directly. The reference implementation reports 29
passed, 0 failed, 1 skipped; the skip is C19, because key management for
the team profile lives in @logicsrc/plugin-credential-sharing rather
than in this package, and a skipped MAY does not affect conformance.

Fixtures are generated (`--emit-fixtures <dir>`) rather than
hand-written. A vector produced by an implementation and then verified
by it is worth more than a JSON file someone typed: the typed file
drifts silently when the format moves, and the generated one cannot.
Fourteen files, including an invalid/ set every conforming reader must
reject -- a wrong field group, a weak KDF, an unregistered namespace, a
short payload and a tampered manifest.

The CLI requirements stay with the end-to-end tests that drive the real
binary through a child process; a command cannot meaningfully check its
own exit codes, and a masked value that is only masked in the library is
not masked.

conformance.md and cli.md now describe what ships.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5
Comment thread docs/opencreds/item-model.md Fixed
Comment thread packages/opencreds/src/conformance.ts Fixed
Comment thread packages/opencreds/src/conformance.ts Fixed
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown

ThreatCrush Security Scan

25 finding(s)

HIGH/CRITICAL: 3 | MEDIUM: 12 | LOW: 10

Severity Rule Location
HIGH secret-private-key plugins/credential-sharing/src/providers/ssh.ts:129
HIGH js-host-header-trust apps/commandboard-web/server.js:27
HIGH js-ssrf-outbound-request apps/pwa/public/sw.js:45
MEDIUM js-unescaped-html-sink apps/commandboard-web/src/main.ts:19
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/[[...slug]]/page.tsx:73
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/blog/[slug]/page.tsx:120
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/layout.tsx:83
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/pricing/page.tsx:46
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/components/site-shell.tsx:47
MEDIUM redos-nested-quantifier packages/opencontext/src/ids.ts:10
MEDIUM redos-nested-quantifier packages/opencontext/src/ids.ts:11
MEDIUM redos-nested-quantifier packages/opencontext/src/validate.ts:104
MEDIUM js-timing-unsafe-mac-compare packages/opencontext/src/validate.ts:208
MEDIUM redos-nested-quantifier packages/openontology/src/ids.ts:20
MEDIUM redos-nested-quantifier packages/openprd/src/validate.ts:41
LOW js-unescaped-html-sink apps/logicsrc-web/src/app/docs/[slug]/page.tsx:55
LOW secret-generic-credential apps/pwa/test/appbar.test.mjs:10
LOW secret-aws-access-key packages/opencontext/src/permissions.test.ts:260
LOW secret-private-key packages/opencontext/src/permissions.test.ts:261
LOW secret-stripe-key packages/opencontext/src/permissions.test.ts:262
LOW secret-aws-access-key packages/opencontext/src/security.test.ts:228
LOW secret-private-key plugins/credential-sharing/src/providers/ssh.test.ts:7
LOW secret-database-url plugins/credential-sharing/src/rekey.test.ts:33
LOW secret-openai-key plugins/credential-sharing/src/vault-encryption.test.ts:21
LOW secret-generic-credential plugins/credential-sharing/src/vault-encryption.test.ts:21

Snippets are redacted; ThreatCrush never prints matched credential material.

ralyodio and others added 2 commits August 29, 2026 10:19
`npm ci` refuses a lockfile that does not match package.json, and the
new workspace package plus the CLI's dependency on it were never
recorded: the worktree was bootstrapped by hardlinking node_modules
rather than installing, so npm was never asked to update the lock.

Adds the workspace link and the package entry. No dependency versions
move.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5
Two CI failures, both mine.

`prd/README.md` is generated by `logicsrc prd index --write` and the
scaffold test asserts it is current, so adding a PRD without
regenerating it leaves the repo's own conformance check failing.
Regenerated. The MCP test asserts the next free PRD id against the live
prd/ directory — its comment says it advances with every PRD added — so
it moves to 0005.

ThreatCrush flagged three of the example strings: a PEM header in the
item-model docs and in the conformance fixture, and an `sk_live_`
prefixed token. All placeholders, none real, but the finding is the
scanner working. A fixture only has to exercise the field, and a
real-looking private key header or live-key prefix sitting in the tree
trains both the scanner and the people reading its output to shrug at
exactly the shape that matters. Replaced with obvious placeholders
rather than suppressing the rule.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5
@ralyodio
ralyodio merged commit 80a3626 into master Aug 29, 2026
6 checks passed
@ralyodio
ralyodio deleted the opencreds branch August 29, 2026 11:21
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