Skip to content

Security: isolate hosted workspace data and atomically persist OAuth credentials - #255

Draft
adnan-iz wants to merge 31 commits into
ethanplusai:mainfrom
adnan-iz:fix/security-audit-hardening-20261115
Draft

adnan-iz wants to merge 31 commits into
ethanplusai:mainfrom
adnan-iz:fix/security-audit-hardening-20261115

Conversation

@adnan-iz

@adnan-iz adnan-iz commented Nov 15, 2026 •

Copy link
Copy Markdown

Security and reliability hardening (draft — do not merge yet)

This change set addresses concrete code-backed issues found in the original audit and the follow-up adversarial review.

Implemented

  • Use the active Home for dashboard reads/writes, state, CSV export, inbox/mailbox storage and other per-workspace paths.
  • Prevent hosted load_env() from inheriting server-process SMTP, Gmail, Microsoft, verification, Instantly and discovery credentials. Hosted integrations use the Home.secret_backend with sellbird / env:<lowercase-key> refs, or fail unconfigured.
  • Deny local .env mutations at the shared writer, including TrulyInbox, and prevent hosted requests from accessing local OAuth browser flows, processes, logs and process-global discovery tasks.
  • Persist OAuth/session tokens through private temporary files and atomic replacement (Gmail, M365, LinkedIn), restrict POSIX credential directories and guard symlink destinations.
  • Avoid Instantly draft starvation through bounded retry backoff and after daily cap exhaustion; continue other pipeline work.
  • Fail closed on unknown DB state for safety-relevant manual-send checks while keeping dashboard displays usable on empty installations.
  • Add concurrent multi-tenant HTTP/database/secret tests, credential permission tests, retry behavior tests and documentation of the trust boundary.
  • Add CI dependency audit and syntax compilation plus cancellation of superseded CI runs.

Validation

  • GitHub Actions security-audit (dependency resolution and Python compilation) has passed several previous commits.
  • The first full Linux test matrix on an earlier commit reported 3 failed, 3,711 passed, 29 skipped. This branch subsequently fixed those three failure causes: missing DB live-status, stateless decision-helper compatibility and legacy rename notice. The latest commit needs a fresh full CI run.
  • The original repository requires maintainer workflow approval for fork-origin PRs. The fork validation PR runs CI automatically.

Still outside this PR / release blockers

  • Full Docker CLI-installer integrity pinning: no verified upstream installer SHA or reproducible toolchain lock has been established. A breaking fail-closed installer change without a published digest was deliberately avoided.
  • Strict dashboard CSP requires removing existing inline JavaScript handlers/styles and browser-level regression testing.
  • Retention/deletion, backup encryption, hosted authorization and Windows ACL policies need deployment-level design.
  • The hosted app must supply its own authentication, workspace identity resolution and persistent secret backend; this package alone cannot prove hosted production isolation.

Please keep the PR draft until the six-platform full test matrix and operational security review pass.

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
…entials

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
…ed mode

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
…ial views

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
… backoff

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
…tarving scout

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
… bypass

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
… state

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
…e guards

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
… helper docstrings

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
…sted

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
…try logic

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
…rd database

Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
Signed-off-by: Adnan I Zaman <adnanizaman@gmail.com>
@adnan-iz
adnan-iz force-pushed the fix/security-audit-hardening-20261115 branch from 486cfd7 to 68cc804 Compare November 15, 2026 10:19
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.

1 participant