on this page ▾
[ ARCHITECTURE ] SECURITY MODEL

Security model#

ResearchVC stores unpublished research; confidentiality and integrity are core requirements.

Integrity#

  • Content addressing (SHA-256) with verification on every read, pack receipt, upload completion, bundle import and fetch. Non-canonical structured objects are rejected.
  • Strict schema validation on receipt; manifests cannot contain absolute paths, .., or paths inside .rvc//.git/. Checkout refuses paths whose parent resolves outside the worktree (symlink escape). Bundles are read as data, never extracted to paths.
  • Refs move only by compare-and-swap; the server refuses refs to incomplete history, non-fast-forward updates (unless forced and permitted) and changes to tags/releases.

Access control (server)#

  • Roles: owner > admin > researcher > reviewer > viewer, at org and project level. Actions: read (viewer), comment/review (reviewer), write/push (researcher), admin (admin), delete (owner).
  • Projects a user cannot see return 404 (no existence oracle). Org-visibility grants read to org members; private projects require membership.
  • API tokens: rvc_pat_…, SHA-256 hashed at rest, scopes read/write/admin, optional project restriction and expiry, revocable; tokens cannot mint tokens.
  • Sessions: httpOnly SameSite=Lax cookie + double-submit CSRF header for unsafe requests; Bearer requests are not cookie-based and therefore not CSRF-exposed.
  • Optional external identity: HS256 JWT verification (Supabase-compatible) with audience, issuer, expiry checks.
  • Branch protection: minimum role, force-push and deletion control per branch pattern.
  • Rate limiting (Redis or in-memory), stricter on auth endpoints; security events are written to audit_logs (login, failed login, token create/revoke, push, membership, integrations).

Secrets#

  • Run capture records environment variables only from an allowlist and drops names that look secret; captured stdout/stderr, Git diffs and command lines pass through redaction (OpenAI/Anthropic/GitHub/HF/AWS/Slack/Google keys, bearer headers, URL credentials, private key blocks, --*token* arguments).
  • Default ignore rules keep .env, keys and credential files out of the repository.
  • rvc config set ai.*key* is refused; keys come from environment variables (CLI) or are stored AES-GCM-encrypted per project (server, write-only in the UI).
  • Webhooks: GitHub X-Hub-Signature-256 HMAC verification, delivery-id replay protection, 5 MiB body limit, identical response for unknown connections and bad signatures.
  • Signed blob URLs: HMAC over (repository, object, expiry); expired or mismatched → 403.

Code execution#

  • rvc run and rvc reproduce --execute run the researcher's own command with their own privileges on their machine; ResearchVC adds no sandbox. reproduce --execute requires explicit confirmation and recommends an isolated environment for untrusted code.
  • The server never executes repository code and never compiles LaTeX: manuscripts are parsed by a pure-Python tokenizer with include-depth limits and project-root containment.

AI-specific risks#

See docs/ai-privacy.md: AI is off by default, external providers need explicit opt-in, research content is wrapped as untrusted data, model citations and quotes are validated against real sources, and the assistant has no write access.

Known gaps (not yet implemented)#

SSO/SAML, MFA for local accounts, per-object encryption at rest (rely on disk/S3 encryption), malware scanning of uploaded artifacts, automated data-retention purge jobs (RVC_DATA_RETENTION_DAYS is defined but not enforced yet), and outbound webhooks. Report vulnerabilities per SECURITY.md.

docs/security.md