mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 01:14:47 +00: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
129 lines
4.5 KiB
Markdown
129 lines
4.5 KiB
Markdown
# Importing from other products
|
|
|
|
OpenCreds is meant to be arrived at, not just left from. This page specifies the
|
|
mappings from the exports people actually have.
|
|
|
|
Every source below exports CSV, so the work is one correct CSV reader plus a
|
|
column mapping per product. The reader matters more than the mappings: a naive
|
|
`split(',')` mangles any export containing a note with a comma in it, which is
|
|
most of them.
|
|
|
|
## The reader
|
|
|
|
A conforming CSV reader MUST handle quoted fields, escaped quotes (`""`),
|
|
embedded newlines inside quotes, embedded commas, both CRLF and LF, and a
|
|
leading UTF-8 BOM. Chrome and Excel both emit a BOM, and unhandled it becomes
|
|
part of the first header name and breaks every column lookup in the file.
|
|
|
|
Header names are compared lowercased and trimmed, because column casing differs
|
|
between versions of the same product.
|
|
|
|
## Detection
|
|
|
|
An importer SHOULD identify the source from the header row so a person can drop
|
|
in a file without first telling us where it came from. Detection is ordered
|
|
most-specific first: Chrome's columns are a subset of 1Password's, so asking in
|
|
the wrong order misidentifies every Chrome export.
|
|
|
|
Order: `bitwarden`, `lastpass`, `keepass`, `onepassword`, `chrome`.
|
|
|
|
## Mappings
|
|
|
|
### Bitwarden
|
|
|
|
Header contains `login_uri` or `login_password`. Row `type` selects the item type.
|
|
|
|
| Bitwarden column | OpenCreds |
|
|
| --- | --- |
|
|
| `name` | `name` |
|
|
| `notes` | `notes` |
|
|
| `folder` | folder by name |
|
|
| `favorite` | `favorite` (`1` → true) |
|
|
| `login_username` | `login.username` |
|
|
| `login_password` | `login.password` |
|
|
| `login_totp` | `login.totp` |
|
|
| `login_uri` | `login.uris[0].uri`, `match: "domain"` |
|
|
| `card_*` | `card.*` |
|
|
| `identity_*` | `identity.*` |
|
|
| `type: securenote` | `note` |
|
|
|
|
### 1Password
|
|
|
|
Header contains `url`, `username` and `type`.
|
|
|
|
| 1Password column | OpenCreds |
|
|
| --- | --- |
|
|
| `title` | `name` |
|
|
| `url`/`website` | `login.uris[0].uri` |
|
|
| `username`, `password` | `login.*` |
|
|
| `otpauth` | `login.totp` |
|
|
| `notes` | `notes` |
|
|
|
|
### Chrome
|
|
|
|
Header contains `url`, `username`, `password`. Logins only.
|
|
|
|
| Chrome column | OpenCreds |
|
|
| --- | --- |
|
|
| `name` | `name`, falling back to the URL host |
|
|
| `url` | `login.uris[0].uri` |
|
|
| `username`, `password` | `login.*` |
|
|
| `note` | `notes` |
|
|
|
|
### LastPass
|
|
|
|
Header contains `url` and `grouping`. LastPass writes `http://sn` in `url` for
|
|
secure notes, which is the only reliable way to tell one from a login.
|
|
|
|
| LastPass column | OpenCreds |
|
|
| --- | --- |
|
|
| `name` | `name` |
|
|
| `grouping` | folder by name |
|
|
| `url` | `login.uris[0].uri`, unless `http://sn` |
|
|
| `username`, `password` | `login.*` |
|
|
| `totp` | `login.totp` |
|
|
| `extra` | `notes` |
|
|
| `fav` | `favorite` |
|
|
|
|
### KeePass (CSV export)
|
|
|
|
Header contains `account` and `login name`, or `group` and `password`.
|
|
|
|
| KeePass column | OpenCreds |
|
|
| --- | --- |
|
|
| `account`/`title` | `name` |
|
|
| `login name`/`user name` | `login.username` |
|
|
| `password` | `login.password` |
|
|
| `web site`/`url` | `login.uris[0].uri` |
|
|
| `comments`/`notes` | `notes` |
|
|
| `group` | folder by name |
|
|
|
|
## Rules that apply to every importer
|
|
|
|
**Report, never drop.** A row that cannot be mapped is returned in a `skipped`
|
|
list with its row number and a reason. An import that silently loses credentials
|
|
is worse than one that says what it could not read — the person still has the
|
|
source file, and only knows to go back for it if they are told.
|
|
|
|
**Name from the host when the export had none.** Chrome in particular writes
|
|
rows with an empty name; `github.com` is a better label than a blank line.
|
|
|
|
**An empty row is not a failure.** A login with no username, no password and no
|
|
name is a trailing blank line. It is skipped with the reason `Empty row`, which
|
|
is different from `could not map` and should read differently in a report.
|
|
|
|
**Nothing here touches crypto or the network.** An importer turns text into
|
|
plain item objects. The caller encrypts them. That separation is what lets the
|
|
same importer run in a browser extension's service worker and in a CLI.
|
|
|
|
## Going the other way
|
|
|
|
`opencreds export --format bitwarden-csv` writes a Bitwarden-shaped CSV, because
|
|
that is the format most other products import best. It is a plaintext export and
|
|
carries every warning that implies — see
|
|
[database.md](./database.md#the-plaintext-form).
|
|
|
|
The lossy fields are named in the output rather than discovered later: password
|
|
history, custom fields, attachments, URI match rules, `key` items and `account`
|
|
items have no column in any product's CSV. The CLI prints what it dropped and
|
|
the count for each.
|