diff options
| author | Christopher Warner <cwarner@kernelcode.com> | 2026-10-10 18:49:42 -0400 |
|---|---|---|
| committer | Christopher Warner <cwarner@kernelcode.com> | 2026-10-10 18:49:42 -0400 |
| commit | b65227445c2fb36c04c034ed27a82790b27e3d9f (patch) | |
| tree | d0d0654a937c7483d74c32cc9eec6dcacbfc01e0 | |
| parent | be0d09e2cb91ef391d7455334fc5ed15d6f5649a (diff) | |
| download | iphone-notes-b65227445c2fb36c04c034ed27a82790b27e3d9f.tar.gz iphone-notes-b65227445c2fb36c04c034ed27a82790b27e3d9f.tar.bz2 iphone-notes-b65227445c2fb36c04c034ed27a82790b27e3d9f.tar.xz iphone-notes-b65227445c2fb36c04c034ed27a82790b27e3d9f.zip | |
chore(security): document and guard against committing iCloud sessions
Confirm the public tree has no Apple credentials, harden .gitignore, add
SECURITY.md, and fail CI-style tests if session/secret files are tracked.
Co-authored-by: Cursor <cursoragent@cursor.com>
| -rw-r--r-- | .gitignore | 31 | ||||
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | SECURITY.md | 38 | ||||
| -rwxr-xr-x | tests/run.sh | 3 | ||||
| -rwxr-xr-x | tests/secrets-guard.test.sh | 39 |
5 files changed, 114 insertions, 4 deletions
@@ -1,12 +1,39 @@ # Rust /target/ -# Local runtime (lives under ~/.config/icloud-notes — never commit) +# Never commit Apple/iCloud session material (lives under ~/.config/icloud-notes/) browser-profile/ +**/browser-profile/ storage-state.json +**/storage-state.json session.ok +**/session.ok +cookies.json +**/cookies.json +Cookies +**/Cookies +Local Storage/ +**/Local Storage/ +Session Storage/ +**/Session Storage/ +IndexedDB/ +**/IndexedDB/ + +# Generic secrets / env +.env +.env.* +!.env.example +*.pem +*.key +*.p12 +*.pfx +credentials.json +secrets.yaml +secrets.yml + +# Node (legacy / Chromium install under XDG config — not this repo) node_modules/ package-lock.json -.env + *.log .DS_Store @@ -35,14 +35,17 @@ tests/ cargo test + CLI dry-run + Conventional Commits legacy/nodejs/ Previous Playwright implementation (reference only) ``` -Runtime config (not in git): +Runtime config (**never commit** — see [SECURITY.md](SECURITY.md)): ```text ~/.config/icloud-notes/ - browser-profile/ Chromium user-data (private) + browser-profile/ Chromium user-data / cookies (private) session.ok Marker after successful login ``` +This public repo contains **no** Apple account credentials. Auth stays in that +local XDG directory after `icloud-note login`. + Optional: `ICLOUD_NOTES_CHROME=/path/to/chrome` Tests: `ICLOUD_NOTES_DRY_RUN=1` diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..6d26796 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,38 @@ +# Security + +This repository is **public**. It must never contain Apple ID credentials or +iCloud session material. + +## What stays local only + +All auth state is under XDG config (default `~/.config/icloud-notes/`): + +| Path | Contents | +|---|---| +| `browser-profile/` | Chromium user-data (cookies, local storage) | +| `storage-state.json` | Playwright-era cookie export (if present) | +| `session.ok` | Login marker | + +These paths are gitignored. Mode should stay private (`700` on the config dir, +`600` on session files). + +## What is in this repo + +- Source code that **drives** `icloud.com/notes` after *you* sign in locally +- Docs / tests / skill text +- **No** Apple passwords, 2FA codes, cookies, or account identifiers + +## Agent / operator rules + +- Never commit, paste, or upload `~/.config/icloud-notes/**` +- Never put an Apple ID or password in `SKILL.md`, issues, or commit messages +- `icloud-note login` opens a local browser for you to authenticate; the session + stays on disk under that XDG path + +## If session material were ever committed + +1. Treat it as compromised: sign out other sessions / change Apple ID password / + revoke app-specific passwords as appropriate. +2. Remove the files from git history (filter-repo / BFG) and force-push only with + explicit operator approval. +3. Delete the local profile and run `icloud-note login` again. diff --git a/tests/run.sh b/tests/run.sh index f34fd3e..a1f6fd3 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -12,4 +12,7 @@ echo "== cli ==" echo "== conventional commits ==" ./tests/conventional-commits.test.sh +echo "== secrets guard ==" +./tests/secrets-guard.test.sh + echo "All tests passed." diff --git a/tests/secrets-guard.test.sh b/tests/secrets-guard.test.sh new file mode 100755 index 0000000..338206a --- /dev/null +++ b/tests/secrets-guard.test.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Fail if tracked files look like Apple/iCloud session material or secrets. +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +cd "$ROOT" + +fail() { echo "FAIL: $*" >&2; exit 1; } +pass() { echo "ok: $*"; } + +# Filenames that must never be tracked +BAD_NAME_RE='(storage-state\.json|session\.ok|cookies\.json|(^|/)Cookies$|\.env$|\.pem$|\.key$|credentials\.json|secrets\.ya?ml|browser-profile/)' + +mapfile -t TRACKED < <(git ls-files) +[[ "${#TRACKED[@]}" -gt 0 ]] || fail "no tracked files" + +for f in "${TRACKED[@]}"; do + if [[ "$f" =~ $BAD_NAME_RE ]]; then + fail "tracked forbidden path: $f" + fi +done +pass "no forbidden secret filenames tracked" + +# Content heuristics on tracked text (skip lockfile binary-ish noise) +CONTENT_RE='X-APPLE-WEBAUTH|X-APPLE-DS-WEB-SESSION|myacinfo|BEGIN (RSA |OPENSSH )?PRIVATE KEY|appleidpassword|ICLOUD_PASSWORD\s*=' +hits="$(git grep -nI -E "$CONTENT_RE" -- . ':(exclude)Cargo.lock' ':(exclude)SECURITY.md' ':(exclude)tests/secrets-guard.test.sh' || true)" +if [[ -n "$hits" ]]; then + echo "$hits" >&2 + fail "tracked content matches secret heuristics" +fi +pass "no secret-like content in tracked files" + +# Ensure session dir is outside the repo by default +if [[ -e "$ROOT/browser-profile" || -e "$ROOT/storage-state.json" || -e "$ROOT/session.ok" ]]; then + fail "session material present in repo working tree (use ~/.config/icloud-notes/)" +fi +pass "no session material in repo working tree" + +echo "All secrets-guard checks passed." |
