Skip to content

Commit 879ac64

Browse files
committed
security: remove tracked Chrome debug profile
1 parent 3f2286f commit 879ac64

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dist/
1111
build/
1212
*.egg-info/
1313
.debug/
14+
.chrome-debug-profile/
1415
tools
1516
.planning/
1617
plan/

tests/test_repository_hygiene.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Repository hygiene checks for local-only runtime artifacts."""
2+
3+
import subprocess
4+
from pathlib import Path
5+
6+
7+
ROOT = Path(__file__).resolve().parents[1]
8+
PROFILE_DIR = ".chrome-debug-profile"
9+
PROFILE_SAMPLE = f"{PROFILE_DIR}/Default/Cookies"
10+
11+
12+
def _git(*args: str) -> subprocess.CompletedProcess[str]:
13+
return subprocess.run(
14+
["git", *args],
15+
cwd=ROOT,
16+
capture_output=True,
17+
check=False,
18+
text=True,
19+
)
20+
21+
22+
def test_chrome_debug_profile_is_untracked_and_ignored() -> None:
23+
tracked = _git("ls-files", "--", PROFILE_DIR)
24+
assert tracked.returncode == 0
25+
assert not tracked.stdout, f"{len(tracked.stdout.splitlines())} profile paths are still tracked"
26+
27+
ignored = _git("check-ignore", "--no-index", "-v", PROFILE_SAMPLE)
28+
assert ignored.returncode == 0, f"{PROFILE_SAMPLE} is not covered by .gitignore"
29+
source = ignored.stdout.split(":", 1)[0]
30+
assert source == ".gitignore", f"{PROFILE_SAMPLE} is ignored by {source!r}, not the repository .gitignore"

0 commit comments

Comments
 (0)