connor / loot

connor/loot
publisheda1652e32 · 125 lines · 4255 byteshistory
# loot

A from-scratch source-control system.

**Thesis:** visibility and permissions belong to *content and changes*, not to
the *repository*. Commit your `.env`. Keep files private inside a shared repo.
Embargo a security fix: merge it, cut the release, reveal the source later.

## Security

loot's cryptography is written from scratch and has never been independently
reviewed. What each reader (a relay, a forge, a collaborator, the anonymous
internet, the git mirror, anyone holding your `.loot/` directory) can read is
stated tier by tier at **<https://loot.build/trust>**. Read it before you put
anything in a loot repo whose disclosure would hurt you. In particular, the
default tier is one a relay reads by design, and path names are never encrypted
at any tier.

**Report a vulnerability to <security@loot.build>**, not to the public Discord.
One maintainer, best effort, expect days rather than hours. This repo is
private (ADR 0045/0064), so `/trust` is the published route.

## What works today

The CLI's full verb list, from `loot --help` (one line per verb; `loot <verb> --help` has the detail, `loot help --json` the same index as data):

```text
abandon absorb adopt apply apply-patch archive attest bisect blame bundle buoy
burn cat
cherry-pick clean clone completions config conflicts converge count-objects
describe diff doctor duplicate edit embargo-status evolog explain ferry
fetch format-patch gates gc grant grant-status grants grep heads id init keygen
lane lanes lock log login manifest maroon merge migrate move new notes op peer pipeline
propose pull
pull-grants purges push range-diff rehome relay remote resolve restore revert runner runners seek serve
shortlog show split squash status surface tag telemetry ticket tickets tutorial undo unlock verify
view whoami
```

`loot <verb> --help` prints any verb's usage without running it.

### Try it: private `.env` in a shared repo

```bash
cargo build --release
export PATH="$PWD/target/release:$PATH"

cd $(mktemp -d)
printf 'TOKEN=supersecret\n' > .env
printf '# My Project\n'      > README.md
printf '.env restricted=alice\n*.md public\n' > .lootattributes

loot init --identity alice
loot status -m "initial work"
loot surface              # alice: restores both README.md and .env

# switch to a non-keyholder to prove it
printf mallory > .loot/identity
rm -f .env README.md
loot surface              # mallory: README.md appears; .env stays sealed
```

The `.env` ciphertext stays in `.loot/`. Mallory cannot decrypt it, and if she
snapshots and re-syncs, the sealed file is carried forward untouched.

### Sync over a relay

A relay stores and forwards ciphertext it cannot read. Restricted keys never
travel in a sync bundle (ADR 0003).

```bash
# Terminal 1: run a relay
loot serve --dir /tmp/relay --addr 127.0.0.1:4000

# Terminal 2: alice pushes
loot remote add origin http://127.0.0.1:4000
loot push

# Terminal 3: bob pulls (bob only sees public content)
loot clone http://127.0.0.1:4000 ./bob-repo --identity bob
```

### Grants: sharing a content key

```bash
# alice knows bob's public key (from `loot whoami` on bob's machine)
loot peer add bob "ssh-ed25519 AAAA..."

# deliver a sealed grant via the relay
loot grant --relay origin .env bob

# bob fetches and applies it
loot pull-grants           # verifies alice's signature, checks peer registry
loot surface               # now bob can read .env
```

### Embargo: timed reveals

```bash
# mark a file as embargoed until unix timestamp 1800000000
echo "VULN_DETAILS=CVE-2025-XXXX" > security-fix.txt
printf 'security-fix.txt embargoed=1800000000\n' >> .lootattributes

loot status -m "patch for CVE-2025-XXXX"
loot push                  # relay holds the ciphertext; key withheld until reveal_at
```

At `reveal_at`, the next read promotes the key out of escrow, so anyone who
pulls can read it.

## Layout

The engine is `crates/loot-core`, the `loot` binary is `crates/loot-cli`, and
the relay and forge deployables are `crates/loot-relayd` and
`crates/loot-forge`. [CONTEXT.md](CONTEXT.md) is the domain glossary and
`docs/adr/` holds the decisions.

## Build & test

```bash
cargo build
cargo test                # includes HTTP relay integration tests
cargo test -p loot-core   # fast, no I/O
```