Skip to content

security

bondiano edited this page Nov 12, 2026 · 1 revision

Security and trust boundaries

Active contributors: Vassiliy Kuzenkov.

Sych treats reviewed source, model output and imported reports as data with explicit provenance, not authority to change the reviewer. This page describes implemented boundaries at the documented revision; it is not a penetration-test result or a guarantee that arbitrary inputs are harmless.

Boundary map

flowchart LR
    Admin["Trusted operator config"] --> Harness["Review harness"]
    Target["Accepted target-tip policy"] --> Harness
    Head["Untrusted reviewed HEAD"] --> Git["Pinned Git observations"]
    Git --> Broker["Bounded context and redaction"]
    Reports["CI and local reports"] --> Trust["Binding, validity and trust checks"]
    Trust --> Broker
    Broker --> Model["Configured model route"]
    Model --> Validate["Typed output and anchor validation"]
    Validate --> Reduce["Deterministic reduction"]
    Reduce --> Store["Partitioned artifacts and fenced finalization"]
    Store --> Outbox["Advisory publication outbox"]
Loading

The orchestration boundary is crates/sych-app/src/review/mod.rs; DTO and evidence checks are in crates/sych-core/src/; external operations live in adapters and storage. See Architecture.

Source and policy

Boundary Implemented control Important limit
Repository versus host Git reads pinned object databases using argv, cleared environment, disabled hooks/replace refs/lazy fetches and ignored system/global config This is not permission to execute repository commands on the host
Accepted policy versus proposed policy Normally target tip supplies .sych/; explicit local --policy-ref is recorded. HEAD policy is diffed but not applied The operator still chooses which ref/server file to trust
Source coordinates versus model claims CodeRef binds snapshot, side, path, blob, inclusive lines and content hash; harness resolves references A valid location alone does not prove the model's interpretation
Materialized source versus host files Scratch workspaces contain raw selected blobs; secret paths, symlinks, submodules and executable tool configs are omitted Omission is a limitation, not evidence of absence

Sources: crates/sych-adapters/src/git/command.rs, crates/sych-adapters/src/git/workspace.rs, crates/sych-app/src/review/mod.rs, crates/sych-core/src/snapshot.rs.

The three source positions are not interchangeable: target tip supplies accepted policy, diff base supplies the comparison, and head is reviewed. Generated claims from HEAD can hide content from models but are reported as unreviewed rather than trusted generated coverage (crates/sych-core/src/manifest.rs).

Model input and output

Prompt::messages separates trusted role/output/rule/task layers from repository/evidence DATA blocks. Data content and labels are redacted at egress, fences derive from content hashes, and line numbers remain stable. Built-in redaction can be extended, not disabled, by trusted configuration. Sources: crates/sych-core/src/model/contract.rs, crates/sych-core/src/secrets.rs, crates/sych-core/src/config/redaction.rs.

Redaction is pattern-based, not a universal data-loss-prevention proof. Review source, paths, findings and trusted policy can still be confidential; send them only to approved model endpoints. Endpoint admission compares parsed origin and path segments, not a deceptive string prefix, and model HTTP redirects are disabled (crates/sych-core/src/config/endpoint.rs, crates/sych-app/src/backend.rs, crates/sych-adapters/src/chat.rs).

Models receive a closed set of context operations, not a shell, arbitrary URL, database or credential tool. Searches are fixed-string and bounded; unsupported/partial results carry limitations. The gateway parses typed JSON, permits a bounded repair, and rejects truncated/refused output. Candidate anchors and evidence must pass engine checks before deterministic reduction. None of these controls makes prompt injection impossible; they restrict what a persuaded model can authorize. Sources: crates/sych-core/src/broker/ops.rs, crates/sych-core/src/model/gateway.rs, crates/sych-core/src/reduce.rs.

Model attempt records contain routing/accounting metadata, not raw prompts or chain-of-thought. Do not add source fragments, credentials or provider response bodies to errors/logs. logging.raw_prompts and logging.raw_responses exist as configuration fields but are not an implemented raw-dump permission path. See Models.

Tools and repository execution

There are three different execution boundaries:

  1. Static tools: semantic/syntax/lint adapters run pinned tools with constrained configuration. Rust build scripts/proc-macros/checks are disabled; Python language-server workspaces are untrusted; linter plugin/hooks/helper execution is suppressed. Ordinary static tool processes are not all promised a network-isolated container.
  2. Dependency preparation: opt-in tooling.dependency_install runs supported installers in bwrap/Docker, with registry networking. Rust fetch does not build project code, pnpm scripts/pnpmfile are disabled, Python installation is refused. Failure follows configured fail/degrade policy; no silent unsandboxed fallback.
  3. Targeted checks: off by default; trusted profiles authorize digest-pinned Docker images, absolute executables and literal/closed-choice argv. Containers have no network, dropped capabilities, no-new-privileges, read-only root and bounded time/memory/CPU/processes. Only scratch source is mounted; credentials are not supplied.

Sources: crates/sych-adapters/src/semantic/profiles.rs, crates/sych-adapters/src/lint/mod.rs, crates/sych-core/src/config/tooling.rs, crates/sych-core/src/config/execution.rs, crates/sych-adapters/src/sandbox.rs, crates/sych-adapters/src/execution.rs.

Sandboxing is scoped isolation, not a blanket hostile-host defense: bwrap dependency preparation sees the host root read-only while hiding selected credential-bearing directories. Keep unrelated secrets outside the worker's accessible filesystem and restrict worker egress/privileges at deployment level. Docker images and downloaded tools remain trusted executable supply-chain inputs. See Dependencies and Facts.

Evidence is not an oracle

Evidence separates validity, completeness and trust class. Local CI imports remain AUTHOR_CLAIM, even with a sidecar manifest. Authenticated CI proves origin and source binding, not independence of assertions from the author. Changed tests, skipped tests, line coverage and stale/unbound reports must not be silently upgraded into proof. Sources: crates/sych-core/src/evidence.rs, crates/sych-core/src/ci.rs.

Server CI acquisition binds trusted workflow/job/artifact selectors to the source under review. Artifact redirect hosts are explicitly allowed and redirected downloads do not carry credentials. External inputs freeze before analysis; late CI requires a successor rather than rewriting frozen input. Sources: crates/sych-app/src/server/ci.rs, crates/sych-core/src/config/scm.rs, crates/sych-core/src/freeze.rs.

Human facts and waivers have their own provenance. Follow-up exchanges do not rewrite results. Feedback-driven policy suggestions are deterministic proposals, not instructions executed from rationale text: a directory exception needs at least five adverse judgments and a 60% adverse share in its 90-day window; demotion needs at least ten judgments and 50% false positives. A maintainer applies policy through a separate PR. Source: crates/sych-core/src/suggest.rs.

Credentials, callers and browser trust

Configuration holds environment variable names, not secret values. GitHub App private key, webhook HMAC and OAuth client secret have separate references. API clients have tenant/repository/role scopes; outbound SCM credentials are resolved from configured connections, never a webhook-selected URL. Sources: crates/sych-core/src/config/server.rs, crates/sych-core/src/config/scm.rs, crates/sych-app/src/server/mod.rs.

Webhook signature and bounded raw body are verified before parsing/admission. Slack signatures bind the raw request and timestamp; Slack reads as the configured workspace scope, not a separately authorized GitHub person. Browser sessions use random tokens with only SHA-256 stored, OAuth state binding and same-origin writes. Public serving needs a real TLS proxy; marking configuration as proxied does not encrypt traffic. Details and exact roles are in API.

The UI adds CSP, nosniff, same-origin referrer policy and anti-framing rules. Its CSP deliberately permits inline styles and GitHub avatars, so do not describe it as a no-exception CSP. Sources: crates/sych-app/src/server/caller.rs, crates/sych-app/src/server/auth.rs, crates/sych-app/src/server/ui.rs.

Storage, publication and self-review

Artifact keys include tenant/access partition and content hash; reads verify the bytes. Partitioning is not encryption, and knowing a digest is not authorization. HTTP handlers must check repository access before using internal storage IDs. Protect database, artifact store, mirrors and backups as sensitive review data. Source: crates/sych-storage/src/artifacts.rs; see Storage.

Leases, epochs, desired generation and fences prevent stale workers from committing protected writes. Final result completion and publication intent commit durably; publication itself is separate external work. A lost SCM reply becomes UNCERTAIN, not a safe automatic retry. Recreating an unknown remote write requires an audited reason and accepts duplicate risk. Sources: crates/sych-storage/src/jobs.rs, crates/sych-storage/src/publish.rs, crates/sych-storage/src/recreate.rs.

Publication remains advisory, never approval or a merge action. Current-source checks, safe rendering and exact head/diff positioning constrain outgoing comments. Transport success and result relevance remain different dimensions. See Workers and publication.

For Sych's production self-review, configuration requires a full trusted reviewer commit and startup compares it with the running build identity. The deployed digest is controlled outside the reviewed PR; changing reviewer models/budgets in a PR is not a way to change that PR's reviewer. Sources: crates/sych-core/src/config/scm.rs, crates/sych-app/src/server/build.rs, AGENTS.md.

Key source files and change entry points

File Security-sensitive change
crates/sych-app/src/server/caller.rs Every new resource authorization, bearer/session precedence and origin check
crates/sych-core/src/model/contract.rs Trusted/data prompt separation and redaction egress
crates/sych-core/src/broker/ops.rs Model-accessible operation surface
crates/sych-adapters/src/git/command.rs Repository-to-host boundary
crates/sych-adapters/src/sandbox.rs Installer/check isolation and mounts
crates/sych-core/src/freeze.rs Evidence acceptance before/after freeze
crates/sych-storage/src/publish.rs Unknown external-write outcomes

Change these with explicit cross-tenant/repository, stale-fence, malformed-output and uncertain-write tests, not only happy-path examples. See Testing.

Clone this wiki locally