fix(security+agents): GAP-57 fail-loud PAPERCLIP_DB_URL + FU-13 analyst tool alignment
GAP-57 (אבטחה, CWE-798 / INV-ENV4): ה-default הקשיח postgresql://paperclip:paperclip@... הוסר מ-3 קבצי web/. נוסף resolver משותף require_paperclip_db_url() ב-paperclip_api.py שנכשל בקול אם PAPERCLIP_DB_URL לא מוגדר — במקום ליפול בשקט ל-creds ידועים. Coolify מגדיר את המשתנה (אומת), אז הייצור לא נפגע. (2 מופעים בסקריפטים מקומיים נותרו ל-FU-15 המלא.) FU-13 (INV-AG3, GAP-46): יישור הרשאות-סוכן. התברר שהפער שמופה ב-31.5 היה רחב מדי — יוחס לפי תיאור-תפקיד, לא ההוראות בפועל. הכרעת-יו"ר "היבריד": - legal-analyst: נוסף aggregate_claims_to_arguments (frontmatter + שלב 7) — הכלי שמקבץ את הטענות שהוא חילץ לטיעונים משפטיים. - extract_references/extract_internal_citations הם מטלת-researcher (שכבר מחזיק אותם), לא analyst — הוסרו מרשימת "החסרים". - legal-researcher: כבר היה תקין; ה-spec היה מיושן. עודכנו X4-agents.md (§2א, INV-AG3) ו-gap-audit.md (FU-13 ✅, FU-15 חלקי). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,25 @@ PAPERCLIP_BOARD_API_KEY = os.environ.get("PAPERCLIP_BOARD_API_KEY", "")
|
||||
DEFAULT_TIMEOUT = 15.0
|
||||
|
||||
|
||||
def require_paperclip_db_url() -> str:
|
||||
"""Return ``PAPERCLIP_DB_URL`` or fail loud — never fall back to a default.
|
||||
|
||||
INV-ENV4 / GAP-57: a credential must not live in source as a default value.
|
||||
The Coolify container and local tooling supply this explicitly; its absence
|
||||
is a misconfiguration we surface immediately rather than silently connecting
|
||||
with a well-known default credential (CWE-798). Mirrors the fail-loud guard
|
||||
on ``PAPERCLIP_BOARD_API_KEY`` in ``_build_headers``.
|
||||
"""
|
||||
url = os.environ.get("PAPERCLIP_DB_URL", "")
|
||||
if not url:
|
||||
raise RuntimeError(
|
||||
"PAPERCLIP_DB_URL not set — refusing hard-coded credential fallback "
|
||||
"(INV-ENV4 / GAP-57). Set PAPERCLIP_DB_URL in the environment "
|
||||
"(Coolify for the container, or your shell/.env for local tooling)."
|
||||
)
|
||||
return url
|
||||
|
||||
|
||||
def _build_headers(run_id: str | None, has_body: bool) -> dict[str, str]:
|
||||
if not PAPERCLIP_BOARD_API_KEY:
|
||||
raise RuntimeError("PAPERCLIP_BOARD_API_KEY not set — cannot call Paperclip API")
|
||||
|
||||
Reference in New Issue
Block a user