@davoodmehraban89 / Aram-2 Mirror · read-only / commits / 38b1e65
Fork 0

Mirrored from https://github.com/davoodmehraban89/Aram.git

Synced Dec 4, 10:30 UTC

Tooling: pre-commit guards, detect-secrets baseline gate, Dependabot, Repo Hygiene workflow

- .pre-commit-config.yaml: pre-commit-hooks v6.0.0 + ruff-pre-commit v0.17.6 (revs verified via GitHub API); ruff scopes mirror Backend CI exactly. end-of-file-fixer deliberately omitted (14 pre-existing EOF violations incl. governance-frozen files = unrelated churn); trailing-whitespace kept (zero pre-existing violations). - .secrets.baseline: 9 files / 18 reviewed false-positive findings. - scripts/check_secrets_baseline.py: churn-free CI gate — fails only on new (file, type, line-hash) triples; pragma allowlist escape hatch; negative- tested with a staged fake secret (exit 1) and pragma variant (exit 0). - .github/workflows/repo-hygiene.yml: pre-commit --all-files + secret gate on every PR and accepted-branch push. - .github/dependabot.yml: weekly github-actions/npm/pip updates (npm minors grouped; majors stay individual). Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>

davoodmehraban89 committed Dec 4, 2026 at 09:56 UTC 38b1e658ea1d74089786fdb543d0e2a7eda6b6ff
5 files changed +495
.github/dependabot.yml new
+31
@@ -0,0 +1,31 @@
1 +# Automated dependency update PRs — complements the existing scan gates
2 +# (pip-audit in Backend CI, prod-dependency npm audit in Frontend CI):
3 +# those detect vulnerabilities, Dependabot turns them into reviewed updates.
4 +#
5 +# Known limitation: Dependabot does not manage .pre-commit-config.yaml hook
6 +# revisions; bump those deliberately (see the header of that file).
7 +version: 2
8 +updates:
9 + - package-ecosystem: github-actions
10 + directory: /
11 + schedule:
12 + interval: weekly
13 +
14 + - package-ecosystem: npm
15 + directory: /frontend
16 + schedule:
17 + interval: weekly
18 + open-pull-requests-limit: 5
19 + groups:
20 + # Batch low-risk updates; majors (e.g. the pending vitest/vite upgrade
21 + # tracked after this tooling PR) stay individual and reviewable.
22 + npm-minor-and-patch:
23 + update-types:
24 + - minor
25 + - patch
26 +
27 + - package-ecosystem: pip
28 + directory: /backend
29 + schedule:
30 + interval: weekly
31 + open-pull-requests-limit: 5
.github/workflows/repo-hygiene.yml new
+30
@@ -0,0 +1,30 @@
1 +name: Repo Hygiene
2 +
3 +# Repo-wide tooling gate: the same pre-commit hooks developers run locally,
4 +# plus the churn-free detect-secrets baseline gate. Runs on every PR and on
5 +# pushes to the accepted branch (no path filter — hygiene covers everything).
6 +
7 +on:
8 + pull_request:
9 + push:
10 + branches:
11 + - source-data-cleanup
12 +
13 +permissions:
14 + contents: read
15 +
16 +jobs:
17 + hygiene:
18 + name: pre-commit + secret gate
19 + runs-on: ubuntu-latest
20 + steps:
21 + - uses: actions/checkout@v4
22 + - uses: actions/setup-python@v5
23 + with:
24 + python-version: "3.12"
25 + - name: Install tooling
26 + run: python -m pip install pre-commit detect-secrets
27 + - name: pre-commit (all files)
28 + run: pre-commit run --all-files --show-diff-on-failure
29 + - name: New-secret gate (detect-secrets baseline)
30 + run: python scripts/check_secrets_baseline.py
.pre-commit-config.yaml new
+50
@@ -0,0 +1,50 @@
1 +# Local pre-commit hygiene for the Aram repository.
2 +#
3 +# Role: catch issues *before* commit. CI remains the enforcement point —
4 +# .github/workflows/repo-hygiene.yml runs the same hooks via
5 +# `pre-commit run --all-files`, plus the churn-free new-secret gate
6 +# (scripts/check_secrets_baseline.py against .secrets.baseline).
7 +#
8 +# Hook revisions are pinned to tags verified via the GitHub API on 2026-12-04
9 +# (pre-commit-hooks v6.0.0, ruff-pre-commit v0.17.6 — satisfies the backend
10 +# pyproject constraint ruff>=0.8,<1). Dependabot does not manage this file;
11 +# bump revisions deliberately with `pre-commit autoupdate` and re-run the
12 +# suites (one focused PR, per AGENTS.md).
13 +#
14 +# detect-secrets is intentionally NOT a pre-commit hook here: its baseline
15 +# mode rewrites .secrets.baseline line numbers (exit code 3) whenever a file
16 +# holding a baselined false positive is edited, which conflicts with this
17 +# repo's strict diff discipline. Secret enforcement lives in the CI gate.
18 +repos:
19 + - repo: https://github.com/pre-commit/pre-commit-hooks
20 + rev: v6.0.0
21 + hooks:
22 + - id: check-added-large-files
23 + args: [--maxkb=1024]
24 + # data/ and samples/ hold the protected canonical sources (largest:
25 + # ~31 MB XLSX); they are read-only per AGENTS.md and are never
26 + # grown through tooling.
27 + exclude: '^(data|samples)/'
28 + - id: check-merge-conflict
29 + - id: check-toml
30 + - id: check-yaml
31 + - id: detect-private-key
32 + # trailing-whitespace only: the repo currently has zero trailing-whitespace
33 + # violations (verified 2026-12-04), so this hook adds churn-free value.
34 + # end-of-file-fixer is deliberately NOT enabled: 14 pre-existing files
35 + # (including governance-frozen docs/handoff and docs/archive files) lack
36 + # the convention, and normalizing them repo-wide is unrelated churn
37 + # against AGENTS.md's focused-diff rule. PR diffs stay clean via the
38 + # existing `git diff --check` CI steps.
39 + - id: trailing-whitespace
40 + - repo: https://github.com/astral-sh/ruff-pre-commit
41 + rev: v0.17.6
42 + hooks:
43 + # Mirrors Backend CI: `ruff check src tests` (run from backend/).
44 + # Ruff discovers backend/pyproject.toml by walking up from each file.
45 + - id: ruff-check
46 + files: ^backend/(src|tests)/.*\.py$
47 + args: [--fix]
48 + # Mirrors the Backend CI format gate: domain, services, migrations only.
49 + - id: ruff-format
50 + files: ^backend/(src/aram_backend/(domain|services)|migrations)/.*\.py$
.secrets.baseline new
+272
@@ -0,0 +1,272 @@
1 +{
2 + "version": "1.5.0",
3 + "plugins_used": [
4 + {
5 + "name": "ArtifactoryDetector"
6 + },
7 + {
8 + "name": "AWSKeyDetector"
9 + },
10 + {
11 + "name": "AzureStorageKeyDetector"
12 + },
13 + {
14 + "name": "Base64HighEntropyString",
15 + "limit": 4.5
16 + },
17 + {
18 + "name": "BasicAuthDetector"
19 + },
20 + {
21 + "name": "CloudantDetector"
22 + },
23 + {
24 + "name": "DiscordBotTokenDetector"
25 + },
26 + {
27 + "name": "GitHubTokenDetector"
28 + },
29 + {
30 + "name": "GitLabTokenDetector"
31 + },
32 + {
33 + "name": "HexHighEntropyString",
34 + "limit": 3.0
35 + },
36 + {
37 + "name": "IbmCloudIamDetector"
38 + },
39 + {
40 + "name": "IbmCosHmacDetector"
41 + },
42 + {
43 + "name": "IPPublicDetector"
44 + },
45 + {
46 + "name": "JwtTokenDetector"
47 + },
48 + {
49 + "name": "KeywordDetector",
50 + "keyword_exclude": ""
51 + },
52 + {
53 + "name": "MailchimpDetector"
54 + },
55 + {
56 + "name": "NpmDetector"
57 + },
58 + {
59 + "name": "OpenAIDetector"
60 + },
61 + {
62 + "name": "PrivateKeyDetector"
63 + },
64 + {
65 + "name": "PypiTokenDetector"
66 + },
67 + {
68 + "name": "SendGridDetector"
69 + },
70 + {
71 + "name": "SlackDetector"
72 + },
73 + {
74 + "name": "SoftlayerDetector"
75 + },
76 + {
77 + "name": "SquareOAuthDetector"
78 + },
79 + {
80 + "name": "StripeDetector"
81 + },
82 + {
83 + "name": "TelegramBotTokenDetector"
84 + },
85 + {
86 + "name": "TwilioKeyDetector"
87 + }
88 + ],
89 + "filters_used": [
90 + {
91 + "path": "detect_secrets.filters.allowlist.is_line_allowlisted"
92 + },
93 + {
94 + "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
95 + "min_level": 2
96 + },
97 + {
98 + "path": "detect_secrets.filters.heuristic.is_indirect_reference"
99 + },
100 + {
101 + "path": "detect_secrets.filters.heuristic.is_likely_id_string"
102 + },
103 + {
104 + "path": "detect_secrets.filters.heuristic.is_lock_file"
105 + },
106 + {
107 + "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
108 + },
109 + {
110 + "path": "detect_secrets.filters.heuristic.is_potential_uuid"
111 + },
112 + {
113 + "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
114 + },
115 + {
116 + "path": "detect_secrets.filters.heuristic.is_sequential_string"
117 + },
118 + {
119 + "path": "detect_secrets.filters.heuristic.is_swagger_file"
120 + },
121 + {
122 + "path": "detect_secrets.filters.heuristic.is_templated_secret"
123 + }
124 + ],
125 + "results": {
126 + ".github/workflows/backend-ci.yml": [
127 + {
128 + "type": "Secret Keyword",
129 + "filename": ".github/workflows/backend-ci.yml",
130 + "hashed_secret": "947f6c13826812af1df6a3fba06092a9b6c6b082",
131 + "is_verified": false,
132 + "line_number": 67
133 + },
134 + {
135 + "type": "Basic Auth Credentials",
136 + "filename": ".github/workflows/backend-ci.yml",
137 + "hashed_secret": "947f6c13826812af1df6a3fba06092a9b6c6b082",
138 + "is_verified": false,
139 + "line_number": 96
140 + }
141 + ],
142 + "backend/tests/conftest.py": [
143 + {
144 + "type": "Secret Keyword",
145 + "filename": "backend/tests/conftest.py",
146 + "hashed_secret": "a761ce3a45d97e41840a788495e85a70d1bb3815",
147 + "is_verified": false,
148 + "line_number": 55
149 + }
150 + ],
151 + "backend/tests/test_auth_r1.py": [
152 + {
153 + "type": "Secret Keyword",
154 + "filename": "backend/tests/test_auth_r1.py",
155 + "hashed_secret": "a761ce3a45d97e41840a788495e85a70d1bb3815",
156 + "is_verified": false,
157 + "line_number": 147
158 + },
159 + {
160 + "type": "Secret Keyword",
161 + "filename": "backend/tests/test_auth_r1.py",
162 + "hashed_secret": "a4b48a81cdab1e1a5dd37907d6c85ca1c61ddc7c",
163 + "is_verified": false,
164 + "line_number": 195
165 + },
166 + {
167 + "type": "Secret Keyword",
168 + "filename": "backend/tests/test_auth_r1.py",
169 + "hashed_secret": "a0f4ea7d91495df92bbac2e2149dfb850fe81396",
170 + "is_verified": false,
171 + "line_number": 244
172 + }
173 + ],
174 + "backend/tests/test_desktop.py": [
175 + {
176 + "type": "Secret Keyword",
177 + "filename": "backend/tests/test_desktop.py",
178 + "hashed_secret": "a761ce3a45d97e41840a788495e85a70d1bb3815",
179 + "is_verified": false,
180 + "line_number": 42
181 + }
182 + ],
183 + "backend/tests/test_editing.py": [
184 + {
185 + "type": "Secret Keyword",
186 + "filename": "backend/tests/test_editing.py",
187 + "hashed_secret": "a761ce3a45d97e41840a788495e85a70d1bb3815",
188 + "is_verified": false,
189 + "line_number": 124
190 + }
191 + ],
192 + "backend/tests/test_phase7_admin.py": [
193 + {
194 + "type": "Secret Keyword",
195 + "filename": "backend/tests/test_phase7_admin.py",
196 + "hashed_secret": "a761ce3a45d97e41840a788495e85a70d1bb3815",
197 + "is_verified": false,
198 + "line_number": 33
199 + },
200 + {
201 + "type": "Secret Keyword",
202 + "filename": "backend/tests/test_phase7_admin.py",
203 + "hashed_secret": "6809ffccad03b80fa1fbc32c17e7e054805ec30b",
204 + "is_verified": false,
205 + "line_number": 42
206 + },
207 + {
208 + "type": "Secret Keyword",
209 + "filename": "backend/tests/test_phase7_admin.py",
210 + "hashed_secret": "7b4a96a03e149bc7e60c4be90af2ac8d0263c9b8",
211 + "is_verified": false,
212 + "line_number": 47
213 + },
214 + {
215 + "type": "Secret Keyword",
216 + "filename": "backend/tests/test_phase7_admin.py",
217 + "hashed_secret": "a0f4ea7d91495df92bbac2e2149dfb850fe81396",
218 + "is_verified": false,
219 + "line_number": 51
220 + },
221 + {
222 + "type": "Secret Keyword",
223 + "filename": "backend/tests/test_phase7_admin.py",
224 + "hashed_secret": "76272dc4faf660733711f58c736830d27159fb55",
225 + "is_verified": false,
226 + "line_number": 190
227 + }
228 + ],
229 + "docs/PR_TRIAGE.md": [
230 + {
231 + "type": "Secret Keyword",
232 + "filename": "docs/PR_TRIAGE.md",
233 + "hashed_secret": "7cf7e45529afc6745661299b9e474962735edee3",
234 + "is_verified": false,
235 + "line_number": 29
236 + }
237 + ],
238 + "docs/booklet/MANIFEST.json": [
239 + {
240 + "type": "Hex High Entropy String",
241 + "filename": "docs/booklet/MANIFEST.json",
242 + "hashed_secret": "23aaf83e5af5fa7a72a3b7e983b67cf750450759",
243 + "is_verified": false,
244 + "line_number": 8
245 + },
246 + {
247 + "type": "Hex High Entropy String",
248 + "filename": "docs/booklet/MANIFEST.json",
249 + "hashed_secret": "6b4fe462cfda805c0db69cf79b56c59172e1edee",
250 + "is_verified": false,
251 + "line_number": 20
252 + },
253 + {
254 + "type": "Hex High Entropy String",
255 + "filename": "docs/booklet/MANIFEST.json",
256 + "hashed_secret": "e5f276510250c95ab38a93f3eb15da24fab10c48",
257 + "is_verified": false,
258 + "line_number": 25
259 + }
260 + ],
261 + "frontend/e2e/helpers.ts": [
262 + {
263 + "type": "Secret Keyword",
264 + "filename": "frontend/e2e/helpers.ts",
265 + "hashed_secret": "a761ce3a45d97e41840a788495e85a70d1bb3815",
266 + "is_verified": false,
267 + "line_number": 3
268 + }
269 + ]
270 + },
271 + "generated_at": "2026-12-04T09:54:41Z"
272 +}
scripts/check_secrets_baseline.py new
+112
@@ -0,0 +1,112 @@
1 +#!/usr/bin/env python3
2 +"""Churn-free secret gate: fail only on secrets that are NOT baselined.
3 +
4 +Runs `detect-secrets scan` (respects .gitignore) over the working tree and
5 +compares every finding — as a (file, plugin type, hashed line) triple — with
6 +the committed `.secrets.baseline`. Only *new* triples fail the gate, so
7 +editing a file that already holds a reviewed false positive (test fixtures,
8 +the CI PostgreSQL dummy password, documentation SHA-256 hashes) never
9 +produces churn. Line-number drift is deliberately ignored.
10 +
11 +False positives in *new* code are escaped inline with the native detect-secrets
12 +marker: # pragma: allowlist secret (or: # pragma: allowlist nextline secret)
13 +
14 +After an intentional, reviewed change to what is allowed, regenerate:
15 + detect-secrets scan > .secrets.baseline
16 +and review the diff before committing (never blanket-regenerate to silence
17 +a real secret).
18 +
19 +Usage (local or CI):
20 + pip install detect-secrets
21 + python scripts/check_secrets_baseline.py
22 +
23 +Exit codes: 0 = no new secrets, 1 = new secrets found, 2 = setup problem.
24 +"""
25 +
26 +from __future__ import annotations
27 +
28 +import json
29 +import subprocess
30 +import sys
31 +from pathlib import Path
32 +from typing import Any
33 +
34 +ROOT = Path(__file__).resolve().parent.parent
35 +BASELINE = ROOT / ".secrets.baseline"
36 +
37 +
38 +def _triples(results: dict[str, Any]) -> set[tuple[str, str, str]]:
39 + return {
40 + (filename, secret["type"], secret["hashed_secret"])
41 + for filename, secrets in results.items()
42 + for secret in secrets
43 + }
44 +
45 +
46 +def main() -> int:
47 + if not BASELINE.exists():
48 + print(
49 + "ERROR: .secrets.baseline is missing.\n"
50 + "Generate it with: detect-secrets scan > .secrets.baseline\n"
51 + "and commit the reviewed baseline.",
52 + file=sys.stderr,
53 + )
54 + return 2
55 + try:
56 + baseline = json.loads(BASELINE.read_text(encoding="utf-8"))
57 + except json.JSONDecodeError as exc:
58 + print(f"ERROR: .secrets.baseline is not valid JSON: {exc}", file=sys.stderr)
59 + return 2
60 +
61 + try:
62 + scan = subprocess.run(
63 + ["detect-secrets", "scan"],
64 + cwd=ROOT,
65 + capture_output=True,
66 + text=True,
67 + check=False,
68 + )
69 + except FileNotFoundError:
70 + print(
71 + "ERROR: detect-secrets is not installed. Run: pip install detect-secrets",
72 + file=sys.stderr,
73 + )
74 + return 2
75 + if scan.returncode != 0:
76 + print(f"ERROR: detect-secrets scan failed:\n{scan.stderr}", file=sys.stderr)
77 + return 2
78 +
79 + fresh = json.loads(scan.stdout)
80 + known = _triples(baseline.get("results", {}))
81 + current = _triples(fresh.get("results", {}))
82 + new = sorted(current - known)
83 +
84 + if not new:
85 + print(
86 + f"Secret gate OK: {len(current)} baselined finding(s), 0 new."
87 + )
88 + return 0
89 +
90 + print(f"ERROR: {len(new)} new secret finding(s) not in .secrets.baseline:", file=sys.stderr)
91 + results = fresh.get("results", {})
92 + for filename, secret_type, hashed in new:
93 + line = next(
94 + (
95 + s.get("line_number", "?")
96 + for s in results.get(filename, [])
97 + if s["type"] == secret_type and s["hashed_secret"] == hashed
98 + ),
99 + "?",
100 + )
101 + print(f" {filename}:{line} [{secret_type}]", file=sys.stderr)
102 + print(
103 + "\nFix: remove the secret, or mark a reviewed false positive inline with\n"
104 + "`# pragma: allowlist secret`. Do not regenerate the baseline to silence\n"
105 + "a real secret.",
106 + file=sys.stderr,
107 + )
108 + return 1
109 +
110 +
111 +if __name__ == "__main__":
112 + sys.exit(main())