Skip to content

feat(deep-link): Phase 1 — parser, config, cwd validation#5041

Merged
bug-ops merged 2 commits into
mainfrom
deep-link-phase-1
Jun 7, 2026
Merged

feat(deep-link): Phase 1 — parser, config, cwd validation#5041
bug-ops merged 2 commits into
mainfrom
deep-link-phase-1

Conversation

@bug-ops

@bug-ops bug-ops commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

What changed

Area Change
Cargo.toml New deep-link feature; added to desktop bundle
zeph-common parse_deep_link — sync/panic-free URI parser; C0 control-char rejection; proptest fuzz
zeph-config DeepLinkConfig (confirm_before_prompt = true secure default); migration step 61
src/url_scheme validate_deep_link_cwd following INV-CWD; expanded denylist (Linux/macOS/Windows)
specs/066-deep-link-scheme INV-TRUST ref corrected; DeferredHost removed; PromptContainsControlChars added
CHANGELOG.md Updated [Unreleased] section

Test plan

  • cargo nextest run -p zeph-common -p zeph-config --features deep-link — 1191/1191 pass
  • cargo nextest run --features deep-link -p zeph — 498/498 pass
  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace -- -D warnings — clean
  • RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps -p zeph-common — clean
  • RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps -p zeph-config — clean
  • Security audit: H-1 (control chars), M-1 (denylist expansion) addressed

Deferred to Phase 2

  • CLI subcommands (zeph url-open, zeph url-scheme register/unregister)
  • Bootstrap integration (runner.rs dispatch arm, INV-TRUST enforcement at enqueue time)
  • TUI status message (Opened via zeph://new-session)
  • OS registration (Linux .desktop, Windows registry, macOS LaunchAgent)

Closes #5011
Closes #5030

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes dependencies Dependency updates enhancement New feature or request size/XL Extra large PR (500+ lines) labels Jun 7, 2026
@bug-ops
bug-ops enabled auto-merge (squash) June 7, 2026 18:19
@bug-ops
bug-ops force-pushed the deep-link-phase-1 branch 2 times, most recently from 4770727 to 67d0a7b Compare June 7, 2026 18:51
bug-ops added 2 commits June 7, 2026 21:00
Add the deep-link feature foundation per spec-066 and fix the INV-TRUST
type reference in the spec (closes #5030).

New `deep-link` Cargo feature; included in the `desktop` bundle, excluded
from `default`.

- `parse_deep_link(uri)` — sync, panic-free, no I/O, no zeph-* deps
- Percent-decodes all query params via the `url` crate
- Enforces 8192-byte prompt cap (post-decode)
- Rejects C0 control chars / ESC / NUL in prompt (H-1)
- Drops `auto`/`-y` params with WARN log (INV-NOAUTO)
- 13 unit tests + proptest fuzz (100k inputs, no panics)

- `DeepLinkConfig` with explicit `Default` (`confirm_before_prompt = true`)
- `AcpPreference` enum (`never` / `auto` / `always`)
- Added to top-level `Config` with `#[serde(default)]`
- Migration step 61: injects `[deep_link]` advisory block into existing
  configs; idempotent

- `validate_deep_link_cwd` in `src/url_scheme/validate.rs`
- Follows INV-CWD step order exactly: absolute → canonicalize → case-fold
  → denylist → allowlist → is_dir
- Expanded denylist: Linux (+`/etc`, `/root`, `/boot`, `/run`);
  macOS (+`/System`, `/Library/Keychains`); Windows (`SystemRoot`/`WINDIR`)
- Gated under `#[cfg(feature = "deep-link")]` in main.rs

Replace non-existent `TrustLevel::Untrusted` with
`ContentTrustLevel::ExternalUntrusted` from `zeph-sanitizer` in spec §6.
Add Phase 1 deferral note: `QueuedMessage` trust enforcement is wired in
Phase 2 (runner.rs dispatch arm). Remove `DeferredHost` error variant;
unknown hosts (including future deferred actions) map to `UnknownHost`.

Closes #5011
Closes #5030
MIGRATIONS registry now contains 62 steps: 61 (knowledge) added in
main via #5040, plus 62 (deep_link) from this branch.
@bug-ops
bug-ops force-pushed the deep-link-phase-1 branch from 67d0a7b to 715e94a Compare June 7, 2026 19:01
@bug-ops
bug-ops merged commit 8b05e06 into main Jun 7, 2026
35 checks passed
@bug-ops
bug-ops deleted the deep-link-phase-1 branch June 7, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependency updates documentation Improvements or additions to documentation enhancement New feature or request rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spec(deep-link): INV-TRUST references non-existent TrustLevel enum feat(deep-link): Phase 1 — foundation: parser, config, cwd validation

1 participant