# Falkenblick — Dual-Model Adversarial Security Review Report

- **Product:** Falkenblick (`de.whitebalance.falkenblick`) — Native Swift 6 / AppKit macOS Git Client (`Falkenblick`, `FalkenblickAskpass`, `FalkenblickSSHAskpass`, `FalkenblickSequenceEditor`)
- **Audited Baseline:** `0.2.2` (Build `4`, Commit `c65ad99`)
- **Hardened Release:** `0.2.3` (Build `5`, Commit `9314e56`)
- **Review Date:** `2026-12-01`
- **Methodology:** 4-Phase Dual-Model Adversarial Review (**Claude Fable 5.2** vs. **Gemini 4 Neon**) + Deterministic Build/Signature/SBOM Verification
- **Standards Referenced:** OWASP ASVS (Level 2), CWE, CVSS v3.1, PTES Report Structure, CycloneDX 1.5 SBOM, RFC 9116 (`/.well-known/security.txt`)
- **Publisher:** white balance – projects pool agency GmbH, Bremen, Germany

> **Scope & Transparency Disclaimer:** This report documents an internal, AI-assisted adversarial code review combined with automated regression tests and deterministic macOS signature/notarization checks. It is **not** an external third-party penetration test certificate or formal regulatory certification. Its purpose is verifiable technical transparency for a closed-source product.

---

## 1. Executive Summary

Two independent frontier models (**Claude Fable 5.2** and **Gemini 4 Neon**) audited the entire Falkenblick codebase (Swift core, AppKit UI, askpass helpers, CLI launcher, license system, build scripts, and website configuration) without seeing each other's findings. In Phase 2, both models challenged each other's reports to remove false positives and lock down consensus CVSS v3.1 scores. In Phase 3, all 11 findings were remediated with comprehensive regression tests (`SecurityAuditRegressionTests`). In Phase 4, Claude Fable 5.2 independently re-verified the diff against Apple Git 2.54, discovered six subtle allowlist/submodule/hook bypasses in the initial denylist-based repository trust scanner and an inline-script CSP regression on `/activate/`, all of which were fixed immediately by migrating to an explicit safe-key allowlist, scanning submodule configs, hashing executable hook bytes, globally enforcing `protocol.ext.allow=never`, and extracting `/activate.js`.

| Severity (CVSS v3.1) | Catalogued | Fixed & Verified | Open |
|---|---:|---:|---:|
| Critical (9.0–10.0) | 0 | 0 | 0 |
| High (7.0–8.9) | 2 | 2 | 0 |
| Medium (4.0–6.9) | 2 | 2 | 0 |
| Low (0.1–3.9) | 4 | 4 | 0 |
| Informational / Hardening | 3 | 3 | 0 |
| **Total** | **11** | **11** | **0** |

---

## 2. Deterministic Verification & Build Integrity

Every macOS release binary can be independently verified by users on their own Mac:

| Check | Verified Value |
|---|---|
| Apple Developer ID | `Developer ID Application: white balance - projects pool agency GmbH (3E892L97V2)` |
| Apple Notarization (`spctl`) | `accepted (source=Notarized Developer ID)` (`Notarization Ticket=stapled`) |
| Hardened Runtime | Enabled (`flags=0x10000(runtime)`) |
| Extra Entitlements | None (zero unnecessary entitlements) |
| External Runtime Dependencies | **1** (`Sparkle 2.10.1`, commit `ab7d71291238df6e0492143b120c9b696a35f603`) |
| Sparkle EdDSA Public Key | `2nucZjrVx7qoAMRa+DhwuV1iHqlMLS+hiazd7JtkmiM=` |
| CycloneDX 1.5 SBOM | `site/security/sbom.cdx.json` (1 external component) |
| Security Disclosure Policy | `https://getfalkenblick.com/.well-known/security.txt` (RFC 9116) |

### Release Verification History (Append-Only)

| Release | Build | Date | Commit | Artifact | SHA-256 | Notes |
|---|---:|---|---|---|---|---|
| `0.2.2` | 4 | 2026-12-01 | `c65ad99` | `Falkenblick-0.2.2.dmg` | `c8ddfead5d6eb699d0cafd677f344ae748577fb2037f14e95c256e160c4d53a0` | Audited baseline build |
| `0.2.3` | 5 | 2026-12-01 | `9314e56` | `Falkenblick-0.2.3.dmg` | `24e933d81b0b1e7730b33908fc02b4ff99ef07f59aaba7b148c836aec4cd0dd8` | Hardened release (all 11 findings fixed & re-verified) |

---

## 3. Verified Core Security Controls (Positive Findings)

Both models independently verified the following defensive controls already present in Falkenblick:

- **Minimal Dependency Surface:** Pure native Swift 6 / AppKit binary with only one external runtime framework (`Sparkle 2.10.1`). No Electron, no embedded browser/WebView, no telemetry or analytics SDKs.
- **Zero Cloud Proxy / Local-Only Repositories:** All Git operations execute directly against the user's installed Git binary; bookmarks, undo journals, and settings stay strictly local.
- **macOS Keychain Credential Storage:** Hosting tokens and Git credentials are stored in the local macOS Keychain (`this-device-only`, accessible while unlocked).
- **Offline Ed25519 Licensing:** License keys (`FB1-…`) are verified completely offline using Ed25519 with no phone-home checks.
- **Git Environment Hardening:** `GitRunner` strips ambient repo-redirecting Git variables (`GIT_DIR`, `GIT_WORK_TREE`, `GIT_INDEX_FILE`, `GIT_COMMON_DIR`, etc.), enforces `GIT_TERMINAL_PROMPT=0`, `GIT_LITERAL_PATHSPECS=1`, and globally injects protected `safe.bareRepository=explicit` and `protocol.ext.allow=never`.

---

## 4. Finding Ledger (Sanitized Post-Fix)

| ID | Summary | Severity / CVSS | CWE | Discovered / Cross-Checked | Status |
|---|---|---|---|---|---|
| **FB-2026-001** | Single askpass binary served both `GIT_ASKPASS` and `SSH_ASKPASS` with unanchored substring matching, allowing a malicious SSH server (`keyboard-interactive`) to elicit HTTPS Keychain passwords or Hub PATs | High (`7.4`) | CWE-346, CWE-522 | Fable 5.2 (confirmed by Gemini) | **Fixed & Re-Verified** — Split into separate signed binaries (`FalkenblickAskpass` `.git` vs. `FalkenblickSSHAskpass` `.ssh`); anchored `hasPrefix` parsing; `(`-prefixed SSH interactive prompts always classify as `.unknown` (never auto-answered); Hub tokens restricted strictly to `.git` mode |
| **FB-2026-002** | `falkenblick://open?path=` opened arbitrary directories without confirmation, and opening untrusted repos could execute repo-local `.git/config` commands or hooks | High (`7.5`) | CWE-829, CWE-78 | Fable 5.2 (confirmed by Gemini; hardened again after Phase 4 bypasses) | **Fixed & Verified** — External `falkenblick://open` confirmation dialog for unknown folders; allowlist-based `RepositoryTrustScanner` scans local, worktree, and submodule configs (allowing built-in boolean `core.fsmonitor=true`, flagging Git 2.54 `hook.*.command`, `tar.*.command`, `gpg.ssh.defaultKeyCommand`, `ext::`, etc.), SHA-256 hashes executable hooks, fails closed on scan errors; `quickSummary` disables `fsmonitor`/`hooksPath`; global `safe.bareRepository=explicit` & `protocol.ext.allow=never` |
| **FB-2026-003** | Option injection via Git ref/tag/branch/remote names starting with `-` (e.g. remote tag `--output=…`) across history, diff, and ref operations | Medium (`6.5`) | CWE-88 | Both | **Fixed & Re-Verified** — `--end-of-options` added before ref arguments in `CommitLogStreamer`, `reflog`, `createTag`, `deleteTag`, `exportArchive`, `reset` diff; strict leading-`-` validation (`validateOptionSafeRef`) across `merge`, `rebase`, `reset`, `stashBranch`, `checkoutPullRequest`, `createBranch`, `publishBranch`, `pushBranch`, `push`, `fetchRemote`, `deleteRemoteBranch`, `renameBranch`, `checkoutRemoteBranch`, `checkoutDetached`, `pushTag`, `cherryPick`, `revertCommit`, plus `--` in `worktree` |
| **FB-2026-004** | Askpass automatically answered plaintext `http://` prompts with HTTPS Keychain passwords / Hub PATs and ignored port differences when matching Hub accounts | Medium (`5.7`) | CWE-319, CWE-522 | Both | **Fixed & Re-Verified** — Plaintext non-loopback `http://` never maps to HTTPS Keychain items, never receives automatic credentials, shows an explicit warning, and disables Keychain saving; Hub matching enforces exact `host:port` equality |
| **FB-2026-005** | Authenticated hosting API calls used `URLSession.shared` without a redirect guard, allowing custom headers such as GitLab's `PRIVATE-TOKEN` to cross origins on HTTP redirects | Low (`4.8`) | CWE-200, CWE-601 | Both | **Fixed & Re-Verified** — Shared `CredentialTransportPolicy.apiSession` with `SameOriginRedirectDelegate` blocks cross-origin and HTTP-downgrade redirects whenever `Authorization` or `PRIVATE-TOKEN` is present |
| **FB-2026-006** | Pull request view passed remote API URLs (`pr.url`, `comment.url`, `check.detailsURL`) directly to `NSWorkspace.shared.open` without scheme validation | Low (`4.7`) | CWE-20 | Both | **Fixed & Re-Verified** — Enforced `CredentialTransportPolicy.isSafeWebURL` (`http`/`https` + non-empty host) on all 4 call sites in `PullRequestsWorkspaceView.swift` |
| **FB-2026-007** | CLI launcher script queried Spotlight (`mdfind`) before fixed `/Applications` install paths | Low (`3.6`) | CWE-426 | Gemini 4 Neon (refined in Phase 4) | **Fixed & Re-Verified** — Fixed `/Applications/Falkenblick.app`, `$HOME/Applications/Falkenblick.app`, and `$FALLBACK_APP` checked first; safe `while IFS= read -r` loop handles spaces; `--` terminators and quote escaping added; marker bumped to `v3` |
| **FB-2026-008** | Website `.htaccess` lacked HTTP security headers and directory-listing protection | Low (`3.1`) | CWE-693 | Both | **Fixed & Verified** — Added `Options -Indexes`, HSTS, `nosniff`, `X-Frame-Options: DENY`, `Referrer-Policy`, `Permissions-Policy`, and strict CSP in `site/.htaccess`, and extracted `/activate/` inline script into `/activate.js` |
| **FB-2026-009** | Hardening: `discardFiles` and `saveConflictResolution` lacked explicit worktree containment checks | Info | CWE-22 | Gemini 4 Neon | **Fixed & Re-Verified** — Added `validatedWorktreePath` (standardized + symlink-parent containment) before deleting untracked files or writing conflict resolutions |
| **FB-2026-010** | Hardening: missing `FBReleaseDate` in `Info.plist` fell back to `.development` license state | Info | CWE-636 | Fable 5.2 | **Fixed & Re-Verified** — `.development` fallback gated behind `#if DEBUG`; Release builds fall back to a compiled-in release day constant |
| **FB-2026-011** | Hardening: `clone` lacked explicit `protocol.ext.allow=never`; unredacted clone URL in status bar and unredacted stderr in `streamStdout` transcript | Info | CWE-214, CWE-532 | Both | **Fixed & Re-Verified** — Added `-c protocol.ext.allow=never` (both globally and on `clone`) and `GitTranscriptEntry.redactCredentials` on clone status and `streamStdout` stderr |

---

## 5. Documented Network Endpoints

Falkenblick connects ONLY to:
1. **Your configured Git remotes & Services Hub accounts** (GitHub, GitLab, Forgejo, Codeberg, Gitea, Bitbucket, Azure DevOps, or your self-hosted servers).
2. **`getfalkenblick.com`** — Signed Sparkle update checks (can be disabled in Settings).
3. **`api.brieftaube.workers.dev`** — Only via the website when purchasing or resending a license key (never contacted by the macOS app for license checks).

---

## 6. Automated Verification Executed Post-Fix

- **Build (`swift build`):** `Falkenblick`, `FalkenblickAskpass`, `FalkenblickSSHAskpass`, and `FalkenblickSequenceEditor` all compile cleanly under Swift 6 strict concurrency with zero warnings.
- **Test Suite (`swift test`):** 190/190 tests passed (0 failures), including `SecurityAuditRegressionTests` covering SSH keyboard-interactive spoofing, plaintext HTTP refusal, port-aware matching, Git 2.54 config hooks, submodule config scanning, hook content-hash invalidation, `quickSummary` safety, `--output=` ref option injection, cross-origin redirect blocking, URL scheme filtering, CLI path priority, and worktree traversal rejection.
