SPB Git

Repository Public

security.md 25.6 KB

# Security

This document describes what ORIX Sheet does with untrusted input and what its components are allowed to do, as implemented in the repository on 2026-11-21. Every statement names the source file that implements it. Where a protection is absent or has not been verified by a test, the text says so. Nothing here has been reviewed by an external auditor.

Related documents: architecture/python-runtime.md, architecture/data-engine.md, architecture/intelligence.md, architecture/persistence.md, compatibility/formats.md, release/signing.md.

# 1. Process and platform posture

Property Value Source
App Sandbox Off (ENABLE_APP_SANDBOX: NO). The app runs with the user's full file access. project.yml
Hardened runtime On (ENABLE_HARDENED_RUNTIME: YES) project.yml
Entitlements Empty dictionary: no hardened-runtime exception (no JIT, no unsigned executable memory, no disabled library validation, no Apple Events) App/Resources/ORIXSheet.entitlements
Privacy usage strings (NS…UsageDescription), App Transport Security exceptions None declared App/Resources/Info.plist
Accounts, analytics, crash upload, update checker No code for any of them (see section 2) source search
Third-party code linked into the app DuckDB C library only, downloaded at build time from the DuckDB GitHub release v2.0.1 and checked against a pinned SHA-256 before use Scripts/fetch-duckdb.sh
Preferences UserDefaults only App/Sources/AppSettings.swift

Source: the files in the last column.

The app is not sandboxed because it must start a user-installed Python interpreter and read data files chosen by scripts and workflows; the isolation that exists is applied per subsystem (Python restricted mode, DuckDB external-access lock, workflow path authorization) and is described below.

# 2. Network access

The application's own code opens no network connection (no URLSession, no sockets), and one user-confirmed action starts a program that does: installing a Python package with pip (listed below). This was checked on 2026-11-21 by searching Packages/*/Sources, App/Sources and Scripts (Swift, Python, shell, C, headers, plists) for URLSession, URLRequest, NWConnection, NWListener, import Network, CFSocket, CFStream, socket(, getaddrinfo, NSURLConnection, WKWebView, WebKit, NSWorkspace.shared.open, Process(, posix_spawn, launchctl, dlopen, NSAppleScript, httpfs, DuckDB INSTALL/LOAD, enable_external_access, autoinstall, autoload and literal http:///https:// URLs (XML namespace URIs excluded). Every hit is listed here.

Hit Classification
URLSession, URLRequest, Network framework, NWConnection, sockets, CFStream, WKWebView/WebKit No occurrence in any source file.
Packages/SheetUI/Sources/SheetUI/Grid/GridView+Events.swift:149 — NSWorkspace.shared.open(url) Opens a cell hyperlink in the user's default browser or mail client. Only on ⌘-click of a cell that has a hyperlink, only for the schemes http, https and mailto; a target starting with # is an in-workbook jump. The request is made by the other application, not by ORIX Sheet.
…/GridView+Events.swift:373–375 — the literal https:// Placeholder text of the "Link" prompt. No request.
Packages/SheetData/Sources/SheetData/Engine/DataEngine.swift:81–82, 113 — autoinstall_known_extensions=false, autoload_known_extensions=false, SET enable_external_access = false Settings that disable DuckDB's ability to download extensions and to reach files or URLs outside the staging directory (section 5).
Packages/SheetPython/Sources/SheetPython/Spawn.swift — posix_spawn Starts the Python interpreter (section 4). In restricted mode the child is denied all network access by the sandbox profile; in unrestricted mode a script has the user's network access.
Packages/SheetPython/Sources/SheetPython/Environment.swift:95–110 — PythonEnvironmentManager.install Uses the network through a child process. Runs <managed venv>/bin/python3 -I -m pip install --disable-pip-version-check --no-input -- <requirement>, which downloads from the package index and runs third-party installation code outside any sandbox, with a 900 s timeout. The requirement must match a strict pattern (project name, optional extras and version constraints; no options, URLs or paths). It is called only after the confirmation alert "Install … from the internet?" in Python Studio (FeaturePython/Sources/FeaturePython/StudioSheets.swift).
SheetPython — other CapturedProcess.run calls (Environment.swift:43, 73, Sandbox.swift:27, Discovery.swift:56) Local child processes: creating the managed virtual environment, probing interpreters with the bundled probe script, checking once per launch that sandbox-exec can apply a profile. Whether creating the virtual environment contacts the network was not measured for this document; SECURITY.md names a test managedVenvIsCreatedOffline.
Packages/SheetIntelligence/Sources/SheetIntelligence/PythonChecker.swift:23 — Process() Runs python3 -I -c <compile program> to syntax-check suggested code passed on standard input. The code is compiled, not executed. No network.
Packages/FeatureAutomation/Sources/FeatureAutomation/Schedule.swift:127 — Process() running /bin/launchctl Loads or unloads a per-user LaunchAgent when the user installs or removes a schedule (section 7). Local only.
Packages/FeatureAutomation/Sources/FeatureAutomation/Chrome.swift:235 — NSWorkspace.shared.open(URL(fileURLWithPath:)) Opens a local output file of a workflow run in its default application (line 234 reveals it in Finder).
Scripts/fetch-duckdb.sh:9 — curl … https://github.com/duckdb/duckdb/releases/download/v2.0.1/… Build-time download on the developer's machine, verified with shasum -a 256 -c. Not part of the app.

Source: grep -rnE over the directories named above, run on 2026-11-21; file and line numbers are those of that day.

Consequences and limits of this statement:

  • Network access can still originate from programs the user starts through the app: pip when installing a package (after confirmation), a Python script in unrestricted mode, and the browser or mail client opened by a hyperlink.
  • The first search pattern list did not catch the pip path, because it goes through the package's own CapturedProcess wrapper around posix_spawn; it was found by reading the Python packages. The table is therefore complete for the patterns listed and for every call site of posix_spawn, Process( and CapturedProcess.run.
  • The on-device language model is reached through Apple's Foundation Models framework (SystemLanguageModel.default); the request is served by the operating system. The source never references PrivateCloudComputeLanguageModel (checked with grep). What macOS itself does when it downloads or updates the system model is outside the app.
  • macOS services used implicitly by AppKit (for example autosave to a folder that happens to be in iCloud Drive) are not controlled by the app.
  • The Settings window (Privacy section, App/Sources/AppSettings.swift) states: "ORIX Sheet has no account and no analytics. Calculation, files, Python and AI assistance all run on this Mac. The only network use is installing a Python package, and only when you ask for it in Python Studio." That text agrees with the table above and with the Python Studio alert, which describes the pip installation as "the only part of Python Studio that uses the network". The search above is the evidence; there is no automated test that monitors the network during a session of the app. Only the Python sandbox has such a test (a local TCP listener counting connections, see section 4).

# 3. Untrusted files

Threat: a file received from someone else (XLSX/XLSM, ODS, CSV/TSV, JSON/JSONL, .orixsheet) that tries to exhaust memory, write outside its container, execute code, contact a server, or mislead the user.

# 3.1 ZIP containers (XLSX, XLSM, ODS)

SheetIO has its own read-only ZIP reader over an in-memory buffer; nothing is extracted to disk.

Check Default limit or behaviour Source
Number of entries 100 000 ZipLimits.maxEntries, Zip/ZipArchive.swift
Declared uncompressed size of one entry 1 GiB (1 << 30) ZipLimits.maxEntrySize
Sum of declared uncompressed sizes 4 GiB (4 << 30) ZipLimits.maxTotalSize
Compression ratio 500:1, checked for entries larger than 32 MiB (ratioFloor) ZipLimits.maxCompressionRatio
Inflation The inflater stops and fails when the stream would produce more bytes than the limit it was given, instead of growing Zip/Deflate.swift (decompress(_:limit:…))
Overlapping entry data (non-recursive ZIP bombs) Rejected: entry spans are sorted and compared ZipArchive.init
Entry names Must be non-empty, at most 1 024 UTF-8 bytes, relative (no leading /, no X: drive prefix), without backslash, NUL or control characters, without .. or . components and without // ZipArchive.validate(name:)
Encrypted entries Rejected with "password-protected files cannot be opened" ZipArchive.init
Truncated central directory, entry data beyond the end of the file, invalid ZIP64 fields Rejected as corrupted ZipArchive.init

Source: Packages/SheetIO/Sources/SheetIO/Zip/ZipArchive.swift, Zip/Deflate.swift.

The format-detection path (WorkbookIO.swift) opens archives with the size limits lifted because it only lists entry names and expands nothing.

# 3.2 XML

All XML is parsed with Foundation's XMLParser in streaming mode through SheetIO/XML/SAX.swift: shouldResolveExternalEntities = false, and any internal entity, external entity, unparsed entity, element or attribute declaration aborts parsing with "the XML contains a document type definition, which is not allowed". No DOM is built.

# 3.3 Macros

VBA is never executed and there is no VBA interpreter in the code base. The XLSX reader detects a vbaProject relationship or a part named vbaProject.bin, reports hasMacros, and keeps the part as opaque bytes (PreservedParts.vbaProject) only so that an explicit export to .xlsm can write it back; an export to .xlsx drops it (XLSX/XLSXReader.swift, XLSX/XLSXWriter.swift). The import report tells the user: "ORIX Sheet never runs macros; they are kept only if you export as .xlsm" (App/Sources/WorkbookDocument.swift).

Relationships marked external are skipped when the reader resolves parts (!$0.external on every relationship lookup in XLSXReader.swift). External-link parts are preserved as bytes and flagged (hasExternalLinks); the import report says "ORIX Sheet does not fetch external data; cached values are shown". There is no code that could fetch them (section 2). Formulas that reference other workbooks are not evaluated against those workbooks; see compatibility/excel.md.

# 3.5 Formula injection from CSV

  • Reading. CSVReadOptions.parseFormulas is false by default, and the application opens CSV and TSV files with default options (WorkbookReader.load(url:format:) in WorkbookDocument.readOnMain). A field beginning with = is therefore loaded as text, not as a formula (CSV/CSVReader.swift: the formula branch requires options.parseFormulas). Fields beginning with +, - or @ are never treated as formulas by the CSV reader.
  • Writing. The CSV writer exports the displayed text of each cell. It does not prefix or otherwise neutralize text that begins with =, +, - or @: a CSV exported from ORIX Sheet and opened in another spreadsheet program can be interpreted there as formulas. This protection is not implemented.
  • Typing. Text typed or pasted into a cell follows the normal input rules (a leading = starts a formula); that is user input, not file import.

# 3.6 Native .orixsheet packages

The manifest records a SHA-256 and a size for every part, and the reader compares both when it loads a part (Native/NativeFormat.swift). This detects corruption and accidental modification; it is not a signature — someone who edits a part can also rewrite the manifest. Cell chunks are inflated with a hard size limit (Native/NativeCells.swift). Feature payloads stored in a workbook (Python scripts, workflows, chart specifications, transform pipelines) are data: opening a file decodes them and runs none of them (sections 4 and 7).

# 3.7 Size limits

Rows and columns beyond the grid limits raise SheetIOError.tooLarge in the CSV and JSON readers (CSVReadOptions.maxRows/maxColumns, JSON/JSONIO.swift). Files are read on the main actor (canConcurrentlyReadDocuments is false), so a very large file blocks the interface while it loads; there is no time limit on parsing.

A hyperlink is followed only on ⌘-click and only for http, https and mailto targets (GridView.openHyperlink). Other schemes (file:, custom URL schemes) are ignored. The app does not display a confirmation with the destination before handing the URL to the system.

# 4. Python

Full description and the test that backs each claim: Packages/SheetPython/SECURITY.md, summarized in architecture/python-runtime.md. The points that matter for the application-wide threat model:

  • No auto-execution. Scripts are stored in the workbook as JSON attachments. Opening a workbook, showing Python Studio or selecting a script starts no interpreter on that script; the only path is the Run command, after consent.
  • Consent is bound to the exact text. A script that arrived with a workbook shows the full code, interpreter, mode, time limit and SHA-256 before its first run. "Always trust" stores the hash of the text together with the workbook identifier and the mode in ~/Library/Application Support/ORIX Sheet/python-trust.json (mode 0600); any change of text, workbook or mode asks again.
  • Restricted mode is the default at every launch. The interpreter runs under /usr/bin/sandbox-exec with a profile that denies network, writes outside the run directory, reads of the home directory, execution of other programs and signals to other processes. If the sandbox cannot be applied, the run is refused; it never falls back to unrestricted.
  • Isolation of writes. A script talks to the app over two pipes with newline-delimited JSON. Writes are buffered and applied as one undoable step only if the run succeeds.
  • Resource limits in both modes: wall-clock timeout, CPU time, file size, open files, output size, a memory watchdog, and termination of the whole process tree.

Stated non-guarantees (from the package document): the sandbox is Apple's deprecated Seatbelt launcher, not a virtual machine; system directories remain readable; a restricted script can read the whole open workbook (but cannot send it anywhere); memory is enforced by sampling, so a script can overshoot between samples; unrestricted mode has no sandbox and gives the script the user's file and network access; the trust store and audit log are ordinary user files that an unrestricted script could edit.

Interpreter discovery executes the Python interpreters found at standard locations with a bundled probe script (not workbook content). An attacker able to place an executable named python3 in one of those locations already has the user's privileges.

# 5. DuckDB data engine

DuckDB runs in-process (Packages/SheetData). DataEngine.init configures every database before any user SQL runs (Engine/DataEngine.swift):

Setting Value Effect
autoinstall_known_extensions, autoload_known_extensions false No extension is downloaded or loaded on demand
allow_community_extensions, allow_unsigned_extensions false —
extension_directory A private, empty directory named extensions-disabled Nothing to load from
allow_persistent_secrets false No credential storage
allowed_directories Set to the engine's staging directory; DuckDB appends its temp_directory (the engine's private spill directory) itself, so the effective list is staging + spill The only two file-system locations SQL may read or write. Both are private to the engine; the spill directory holds only DuckDB's temporary files. Asserted by spillingWorksAndTheAllowListIsStagingPlusSpill (Packages/SheetData/Tests)
enable_external_access false, set after the allow-list SQL cannot read or write other files, nor reach URLs
lock_configuration true, set last None of the above can be changed by a later statement
memory_limit Half of physical memory unless overridden (minimum 64 MiB); spill to the private spill directory Bounded memory

Source: Packages/SheetData/Sources/SheetData/Engine/DataEngine.swift, Packages/SheetData/README.md.

SQL typed by the user in the data tools, SQL compiled from transform pipelines and SQL in a workflow's "Run SQL" step all execute under this configuration. What the package tests assert about it, and what they do not, is documented in architecture/data-engine.md. DuckDB itself is a large C++ library parsing untrusted files (CSV, Parquet, JSON); a memory-safety defect in it would run inside the app process, which is not sandboxed.

# 6. On-device assistance

Source of truth: Packages/SheetIntelligence/PRIVACY.md; architecture in architecture/intelligence.md.

  • Inference uses the system's on-device model only. There is no fallback to any other model or service; when the model is unavailable the controls are disabled and no request is made.
  • The model never receives the workbook. A bounded context is built deterministically (6 000 characters per request by default) and shown to the user before it is sent; sample cell values can be switched off.
  • Prompt injection. Sheet content is presented to the model as data, with an instruction that text from the sheet is never an instruction. The defence that does not depend on the model is output validation: a suggested formula is parsed by the real parser, checked against the function registry and evaluated on a private clone of the workbook; it is inserted only when the user clicks Insert, as one undoable step. Review items must reference an existing auditor finding. Chart and transform suggestions are restricted to fixed vocabularies and existing columns. Suggested Python is text that is syntax-checked (compiled, never executed) and can only be run by the user in Python Studio, under the consent rules of section 4.
  • The model's prose can still be wrong or misleading. Numbers in prose that match nothing computed by the engine are labelled unverified; the measured quality is reported in Packages/SheetIntelligence/EVALUATION.md.

# 7. Automation workflows and schedules

SheetAutomation (engine and the orix-sheet command-line tool) and FeatureAutomation (the Automation studio, schedules and App Intents) are built into the application (project.yml, App/Sources/Features.swift); the release build embeds the tool at Contents/MacOS/orix-sheet (Scripts/sign.sh). Architecture: architecture/automation.md.

  • Workflows are data. A workflow is JSON (.orixflow), stored in the user's library or as a workbook attachment. AutomationFeature.register() only registers a pane and a command; workflows stored in a workbook are listed and never run when the workbook opens (Store/Store.swift, AutomationFeature.swift).
  • No step starts a program or uses the network (Engine/WorkflowEngine.swift). The step vocabulary is closed (25 kinds). The Python step runs only a script stored in the workbook whose exact text the user already approved for restricted mode in Python Studio (PythonTrust.isTrusted(…, restricted: true)), and always in restricted mode; a workflow cannot approve a script (Steps/PythonStep.swift). SQL steps run under the DuckDB configuration of section 5.
  • Approval. WorkflowTrust stores the SHA-256 of the workflow's JSON in ~/Library/Application Support/ORIX Sheet/workflow-trust.json (mode 0600). In the studio, an unapproved workflow first shows every file and folder it reads and writes (WorkflowValidator.fileAccesses); the run host is then limited to those locations (StandardWorkflowHost.isAuthorized, paths standardized with symbolic links resolved). Any edit made outside the studio changes the hash and removes the approval.
  • Atomic outputs. Outputs are written to a private staging folder and moved to their destinations only if the run ends without a stopping failure or cancellation (Engine/Host.swift, OutputStage). Static validation errors prevent the run.
  • Command line. orix-sheet run <workflow.orixflow> builds StandardWorkflowHost(baseDirectory:, unrestricted: true, …): isAuthorized returns true for every path, and the command never calls WorkflowTrust (Sources/orix-sheet/RunCommand.swift). This is the design stated in the source: "the user typed this command: every location they named, or that the workflow names, is theirs to use" — typing the command is the explicit act that the studio's confirmation sheet replaces. The consequence is not softened by anything else in the tool: a workflow file received from someone else and run from the command line can read and write any path it names with the user's privileges, within the closed step vocabulary (no program is started, no network; a Python step still requires a script already approved for restricted mode). orix-sheet run --validate-only checks a workflow without running it.
  • Schedules. Nothing is scheduled implicitly. Only a workflow saved in the user's library can be scheduled (AutomationModel.scheduleWorkflowFile). When the user clicks Install schedule, WorkflowSchedule writes a LaunchAgent property list in ~/Library/LaunchAgents (label prefix ai.spboucher.orix.sheet.workflow.), with RunAtLoad false and a calendar interval, and loads it with /bin/launchctl bootstrap gui/<uid>; removal uses bootout and deletes the file. The agent's program is the orix-sheet run … command line above, shown in full in the schedule panel before installation. A scheduled workflow therefore runs with the unrestricted host and without any WorkflowTrust check, neither when the schedule is installed (AutomationModel.installSchedule does not consult it) nor at run time. The explicit act is installing the schedule. Logs go to ~/Library/Logs/ORIX Sheet/. The agent names the workflow file in the library (~/Library/Application Support/ORIX Sheet/Workflows/<id>.orixflow), an ordinary user file: anything able to modify it, including a later edit in the studio, changes what the schedule does.
  • App Intents (Shortcuts): the Run ORIX Workflow intent builds a host that can read the given input file and write only into its output directory (Intents.swift).

# 8. Other local surfaces

  • Clipboard. Copy and paste use the general pasteboard; pasted text follows the normal input rules.
  • Launch arguments. The -ORIX… arguments (open a file, select a range, write a screenshot or a menu dump to a given path, then quit) exist for tests and screenshots (App/Sources/AppDelegate.swift, LaunchArguments). They are processed in all builds, including Release. They require the ability to start the app with chosen arguments, which already implies the user's privileges.
  • Temporary files. DuckDB spill and staging directories, Python run directories (removed after each run; stale ones are removed at launch by PythonRunner.removeStaleRunDirectories) and workflow staging folders live under the user's temporary directory.
  • Secrets in the repository. Scripts/secret-scan.sh scans tracked and untracked, non-ignored files for private keys, common token formats and credential-like assignments, and for key/certificate file extensions; .gitignore excludes *.p8, *.p12, *.cer, *.mobileprovision, .env files and asc.env. Notarization credentials are referenced by keychain profile, see release/notarization.md.

# 9. Known gaps

Collected from the sections above so that they are not overlooked:

  1. The app is not sandboxed; a memory-safety defect in a parser or in DuckDB would have the user's privileges.
  2. CSV export does not neutralize cells that begin with =, +, - or @.
  3. Unrestricted Python mode has no isolation by design. Package installation (pip) uses the network and runs third-party installation code unsandboxed, after one confirmation.
  4. orix-sheet run (and therefore scheduled workflows) does not check workflow approval and uses an unrestricted file host. This is by design (a command the user types or schedules explicitly), and it means the approval list protects runs started in the studio only.
  5. The native format's hashes detect corruption, not tampering.
  6. No automated test observes the network during a whole app session; the "no network request" statement rests on the absence of networking code.
  7. Hyperlinks open without showing the destination first.
  8. File loading has no time limit and runs on the main actor.
  9. Sheet protection is not a security boundary: there is no password, and the only check found in the sources is in WorkbookSession.beginEdit (typing into a locked cell of a protected sheet). Other edit paths were not found to consult the flag.
Files main
Menu

Theme