Skip to content

Fix schema-controlled storage path safety - #122

Merged
0xLeif merged 6 commits into
mainfrom
leif/issue-111-safe-schema-paths
Jul 27, 2026
Merged

Fix schema-controlled storage path safety#122
0xLeif merged 6 commits into
mainfrom
leif/issue-111-safe-schema-paths

Conversation

@0xLeif

@0xLeif 0xLeif commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • add one portable SchemaStoragePath abstraction for schema-controlled filesystem access
  • reject root aliases, absolute/traversing paths, APS-reserved paths, Windows-reserved names, portable case/Unicode collisions, directories, symlinks, and special files
  • route dynamic reads, writes, reset, purge, and encrypted stores through repeated canonical containment checks
  • delete only verified regular-file leaves and preserve missing paths as safe no-ops
  • document the v1.1.0 safety contract and accept SpecSync requirements REQ-aps-cli-027 and REQ-state-store-020

Root cause

Schema validation previously used string checks and destructive operations appended the schema path directly to the state root. An EncryptedFile path of . could therefore resolve to the root itself, and key remove --purge could recursively delete it.

User impact

Invalid or dangerous storage paths now fail during registration/schema load and again at operation time. Valid nested paths continue to round-trip. The original root-deletion attack is covered in Unix and PowerShell smoke contracts with a sentinel file.

Test plan

  • 94 Swift tests pass
  • four-worker parallel suite passes
  • Unix smoke passes
  • PowerShell smoke regression added for Windows CI
  • specsync change verify passes with 100% ownership coverage
  • fledge trust verify passes after the Linux XCTest compatibility fix; Augur verdict proceed, risk 30

Closes #111

@0xLeif
0xLeif marked this pull request as ready for review July 27, 2026 00:08
@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0311653428

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/aps/SchemaStoragePath.swift
Comment thread Sources/aps/UserSchema.swift Outdated
Comment thread Sources/aps/SchemaStoragePath.swift
Comment thread Sources/aps/SchemaStoragePath.swift

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ad552733c

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/aps/SchemaStoragePath.swift Outdated
Comment thread Sources/aps/SchemaStoragePath.swift Outdated
Comment thread Sources/aps/SecretStore.swift Outdated
@0xLeif
0xLeif merged commit 512c307 into main Jul 27, 2026
5 checks passed
@0xLeif
0xLeif deleted the leif/issue-111-safe-schema-paths branch July 27, 2026 01:16
@0xLeif 0xLeif mentioned this pull request Jul 27, 2026
6 tasks
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.

Prevent schema paths from deleting or escaping the APS state root

1 participant