Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ aisync is **agent-agnostic at its core**. It provides native hooks for Claude Co
[![Homebrew](https://img.shields.io/badge/Homebrew-maxont%2Ftap-FBB040?logo=homebrew&logoColor=white)](https://github.com/MaxonT/homebrew-tap)
[![GHCR](https://img.shields.io/badge/GHCR-container-2496ED?logo=docker&logoColor=white)](https://github.com/MaxonT/aisync/pkgs/container/aisync)
[![GitHub stars](https://img.shields.io/github/stars/MaxonT/aisync.svg?style=social)](https://github.com/MaxonT/aisync/stargazers)
[![MaxonT/aisync MCP server](https://glama.ai/mcp/servers/MaxonT/aisync/badges/score.svg)](https://glama.ai/mcp/servers/MaxonT/aisync)

**English** · [中文](README.zh-CN.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Español](README.es.md) · [Français](README.fr.md) · [Deutsch](README.de.md) · [Português](README.pt.md) · [Русский](README.ru.md) · [Website](https://maxont.github.io/aisync/) · [Demo status board](https://maxont.github.io/aisync/board/)

Expand Down
18 changes: 18 additions & 0 deletions tests/test_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,24 @@ def test_history_skips_a_host_rewritten_committer_but_not_an_author(self):
GIT_COMMITTER_NAME=name, GIT_COMMITTER_EMAIL="a@example.com")
self.assertTrue(self.ps.scan_files(self.ps.history_items(Path(d))))

def test_history_exempts_a_contributor_author_already_on_main_only(self):
import subprocess, tempfile
with tempfile.TemporaryDirectory() as d:
env = {**os.environ, "GIT_CONFIG_GLOBAL": os.devnull, "GIT_CONFIG_NOSYSTEM": "1"}
git = lambda *a, **e: subprocess.run(["git", "-C", d, *a], check=True, capture_output=True, env={**env, **e})
git("init", "-q", "-b", "main")
git("commit", "-q", "--allow-empty", "-m", "base", GIT_AUTHOR_NAME="a", GIT_AUTHOR_EMAIL="a@example.com",
GIT_COMMITTER_NAME="a", GIT_COMMITTER_EMAIL="a@example.com")
git("tag", "v0")
who = dict(GIT_AUTHOR_NAME="Contrib", GIT_AUTHOR_EMAIL="contrib@" + "uni.edu",
GIT_COMMITTER_NAME="a", GIT_COMMITTER_EMAIL="a@example.com")
git("checkout", "-q", "-b", "pr")
git("commit", "-q", "--allow-empty", "-m", "contributor change", **who)
self.assertTrue(self.ps.scan_files(self.ps.history_items(Path(d)))) # not on main yet: scanned
git("checkout", "-q", "main")
git("merge", "-q", "--ff-only", "pr")
self.assertEqual(self.ps.scan_files(self.ps.history_items(Path(d))), []) # merged to main: author is public

def test_no_private_strings_in_tree(self):
self.assertEqual(self.ps.scan_files(self.ps.tree_items(ROOT)), [])

Expand Down
14 changes: 14 additions & 0 deletions tools/privacy_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ def build(root: Path, out: Path) -> list[Path]:
return sorted(out.glob("*.whl")) + sorted(out.glob("*.tar.gz"))


def published_commits(root: Path) -> set[str]:
"""Commits already reachable from main: public, so only a history rewrite could change them. Empty when there is no main ref."""
for ref in ("origin/main", "main"):
r = subprocess.run(["git", "-C", str(root), "rev-list", ref], capture_output=True, text=True)
if r.returncode == 0:
return set(r.stdout.split())
return set()


def history_items(root: Path, everything: bool = False):
"""Commit messages and authors since the newest tag (all of them with everything=True): what a
push would publish now. Older commits are already public and can only change by a history rewrite."""
Expand All @@ -119,6 +128,7 @@ def history_items(root: Path, everything: bool = False):
log = subprocess.run(["git", "-C", str(root), "log", *rng, "--no-merges",
"--format=%x00%H%x01%an%x01%ae%x01%cn%x01%ce%n%B"],
capture_output=True, text=True, check=True).stdout
published = published_commits(root)
for entry in filter(str.strip, log.split("\0")):
head, _, body = entry.partition("\n")
sha, an, ae, cn, ce = head.split("\x01")
Expand All @@ -129,6 +139,10 @@ def history_items(root: Path, everything: bool = False):
# name (same address, different name). That name comes from the host, not from what we push.
if not (ce == ae and cn != an):
people.append(f"<{ce}>" if public(cn) else f"{cn} <{ce}>")
if sha in published:
# owner decision 2026-11-26: a contributor's author address on a commit already on main is public and cannot change
# without a history rewrite: exempt it for every such commit. Committers and messages stay scanned.
people = people[1:]
if any(sha.startswith(k) for k in PUBLIC_COMMIT_MESSAGES):
# only the lines that name the public npm scope are exempt; the rest of the message is scanned
body = "\n".join(l for l in body.splitlines() if "mingyang2026" not in l.lower())
Expand Down
Loading