create-workframe 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +22 -22
- package/.gitignore +73 -73
- package/LICENSE +201 -201
- package/NOTICE +12 -12
- package/README.md +40 -40
- package/SECURITY.md +38 -38
- package/bin/create-workframe.js +2816 -2814
- package/bin/workframe.js +329 -329
- package/docs/workspace-instructions/WORKFRAME_DISCORD.md +20 -20
- package/docs/workspace-instructions/WORKFRAME_DOCUMENTS_AND_ARTIFACTS.md +20 -20
- package/docs/workspace-instructions/WORKFRAME_KANBAN.md +20 -20
- package/docs/workspace-instructions/WORKFRAME_ONBOARDING.md +21 -21
- package/docs/workspace-instructions/WORKFRAME_ROUTING.md +29 -29
- package/docs/workspace-instructions/WORKFRAME_TELEGRAM.md +19 -19
- package/package.json +64 -64
- package/profiles/README.md +15 -15
- package/profiles/architect/AGENTS.md +29 -29
- package/profiles/architect/SOUL.md +44 -44
- package/profiles/architect/skills/devops/kanban-worker/SKILL.md +27 -27
- package/profiles/designer/AGENTS.md +26 -26
- package/profiles/designer/SOUL.md +31 -31
- package/profiles/designer/skills/devops/kanban-worker/SKILL.md +27 -27
- package/profiles/dev/AGENTS.md +28 -28
- package/profiles/dev/SOUL.md +31 -31
- package/profiles/dev/skills/devops/kanban-worker/SKILL.md +27 -27
- package/profiles/docs/AGENTS.md +27 -27
- package/profiles/docs/SOUL.md +30 -30
- package/profiles/docs/skills/devops/kanban-worker/SKILL.md +27 -27
- package/profiles/research/AGENTS.md +26 -26
- package/profiles/research/SOUL.md +31 -31
- package/profiles/research/skills/devops/kanban-worker/SKILL.md +27 -27
- package/profiles/visionary/AGENTS.md +25 -25
- package/profiles/visionary/SOUL.md +31 -31
- package/profiles/visionary/skills/devops/kanban-worker/SKILL.md +27 -27
- package/profiles/workframe-agent/AGENTS.md +37 -37
- package/profiles/workframe-agent/SETUP.md +185 -185
- package/profiles/workframe-agent/SOUL.md +61 -61
- package/profiles/workframe-agent/skills/devops/botfather/SKILL.md +85 -85
- package/profiles/workframe-agent/skills/devops/kanban-handoff-pattern/SKILL.md +58 -58
- package/profiles/workframe-agent/skills/devops/workframe-cohort/SKILL.md +54 -54
- package/prompts/WORKFRAME_PROMPT_TEMPLATES.md +16 -16
- package/rules/.hermes.md +11 -11
- package/rules/AGENTS.md +22 -22
- package/rules/workspace-README.md +5 -5
- package/scripts/apply-update-workframe.sh +91 -21
- package/scripts/bundle-workframe-ui.mjs +83 -83
- package/scripts/create_workframe_scaffold.py +648 -648
- package/scripts/ensure-compose-host-paths.mjs +51 -51
- package/scripts/lib/install-identity.mjs +212 -212
- package/scripts/lib/workframe-registry.mjs +290 -290
- package/scripts/new-project.mjs +68 -68
- package/scripts/select_agent_pack.py +31 -31
- package/scripts/set-compose-public-url.mjs +92 -92
- package/scripts/sync-canonical-to-package.mjs +164 -164
- package/shared/WORKFRAME_AGENT_LIBRARY.md +31 -31
- package/shared/WORKFRAME_AGENT_OPERATIONS.md +29 -29
- package/shared/WORKFRAME_AGENT_PACKS.json +64 -64
- package/shared/WORKFRAME_AGENT_PACKS.yaml +20 -20
- package/shared/WORKFRAME_CHAT_PERMISSION_MODEL.md +20 -20
- package/shared/WORKFRAME_HANDOFF_SCHEMA.md +25 -25
- package/shared/WORKFRAME_SKILL_CURATION.md +27 -27
- package/workframe-api/Dockerfile +14 -14
- package/workframe-api/README.md +24 -24
- package/workframe-api/action_proxy.py +131 -131
- package/workframe-api/auth_rate_limit.py +49 -49
- package/workframe-api/credential_vault.py +445 -445
- package/workframe-api/data/avatar-catalog.json +41 -41
- package/workframe-api/data/logo-catalog.json +14 -14
- package/workframe-api/data/user-avatar-catalog.json +18 -18
- package/workframe-api/email_sender.py +220 -220
- package/workframe-api/google_auth.py +90 -90
- package/workframe-api/install_api.py +359 -359
- package/workframe-api/internal_proxy_auth.py +150 -150
- package/workframe-api/llm_proxy.py +280 -280
- package/workframe-api/oidc_jwt.py +108 -108
- package/workframe-api/package.json +12 -12
- package/workframe-api/platform_auth.py +194 -194
- package/workframe-api/profile_secret_policy.py +86 -86
- package/workframe-api/public/assets/index-DPXu_lGn.css +1 -1
- package/workframe-api/public/assets/index-DYnLrCZZ.js +8 -8
- package/workframe-api/public/assets/index-DglUqFB_.js +8 -8
- package/workframe-api/public/index.html +12 -12
- package/workframe-api/requirements.txt +2 -2
- package/workframe-api/server.py +19866 -19774
- package/workframe-api/site_meta.py +271 -271
- package/workframe-api/stack_config.py +427 -427
- package/workframe-api/test_billing_provider.py +24 -0
- package/workframe-api/time-bind-chat.py +99 -99
- package/workframe-api/turn_credentials.py +226 -226
- package/workframe-api/updates.py +506 -506
- package/workframe-api/vault_kek.py +159 -159
- package/workframe-api/zk_auth.py +633 -633
- package/workframe-supervisor/Dockerfile +11 -11
- package/workframe-supervisor/profile_secret_policy.py +76 -76
- package/workframe-supervisor/server.py +860 -860
- package/workframe-ui/docker/nginx.conf +85 -85
- package/workframe-ui/public/assets/{arc-BskqxLmE.js → arc-DoYr2T5c.js} +1 -1
- package/workframe-ui/public/assets/architecture-7EHR7CIX-CmDi28hh.js +1 -0
- package/workframe-ui/public/assets/{architectureDiagram-3BPJPVTR-B3eGdqvq.js → architectureDiagram-3BPJPVTR-Clher08G.js} +1 -1
- package/workframe-ui/public/assets/{blockDiagram-GPEHLZMM-CzFZG7uX.js → blockDiagram-GPEHLZMM-Bdw9txrZ.js} +1 -1
- package/workframe-ui/public/assets/{c4Diagram-AAUBKEIU-BS-gGyCH.js → c4Diagram-AAUBKEIU-DlI_h_uo.js} +1 -1
- package/workframe-ui/public/assets/channel-DZYVoEdD.js +1 -0
- package/workframe-ui/public/assets/{chunk-2J33WTMH-Cjvqf7c9.js → chunk-2J33WTMH-ol-uwoeq.js} +1 -1
- package/workframe-ui/public/assets/{chunk-3OPIFGDE--eUuL8AK.js → chunk-3OPIFGDE-7eDhBen0.js} +1 -1
- package/workframe-ui/public/assets/{chunk-4BX2VUAB-s9lHUFKL.js → chunk-4BX2VUAB-xPORD7Js.js} +1 -1
- package/workframe-ui/public/assets/{chunk-55IACEB6-D1McA5nz.js → chunk-55IACEB6-Cwd7dr1z.js} +1 -1
- package/workframe-ui/public/assets/{chunk-5ZQYHXKU-DIstLfU2.js → chunk-5ZQYHXKU-Ckt4Sjy1.js} +1 -1
- package/workframe-ui/public/assets/{chunk-727SXJPM-Cd0GD2CO.js → chunk-727SXJPM-sMk1op_G.js} +1 -1
- package/workframe-ui/public/assets/{chunk-AQP2D5EJ-gc5Ra6G4.js → chunk-AQP2D5EJ-CMgSvr6H.js} +1 -1
- package/workframe-ui/public/assets/{chunk-BSJP7CBP-Cg5QfihJ.js → chunk-BSJP7CBP-Dx7GN0T4.js} +1 -1
- package/workframe-ui/public/assets/{chunk-CSCIHK7Q-D_gobbhY.js → chunk-CSCIHK7Q--OCu86u0.js} +1 -1
- package/workframe-ui/public/assets/{chunk-FMBD7UC4-B6eLY9_d.js → chunk-FMBD7UC4-CejmwJpz.js} +1 -1
- package/workframe-ui/public/assets/{chunk-KSCS5N6A-BGroAeW2.js → chunk-KSCS5N6A-CvOj2Yvp.js} +1 -1
- package/workframe-ui/public/assets/{chunk-L5ZTLDWV-34xv7WgT.js → chunk-L5ZTLDWV-B0nGBjLU.js} +1 -1
- package/workframe-ui/public/assets/{chunk-LZXEDZCA-XJBctFZw.js → chunk-LZXEDZCA-Bdzvu227.js} +2 -2
- package/workframe-ui/public/assets/{chunk-ND2GUHAM-nTOZpln8.js → chunk-ND2GUHAM-CGR07jTY.js} +1 -1
- package/workframe-ui/public/assets/{chunk-NZK2D7GU-BBrzcaPH.js → chunk-NZK2D7GU-CBojDPNC.js} +1 -1
- package/workframe-ui/public/assets/{chunk-O5CBEL6O-Cntncx6L.js → chunk-O5CBEL6O-DBin5MPF.js} +1 -1
- package/workframe-ui/public/assets/chunk-QZHKN3VN-DwiajAaK.js +1 -0
- package/workframe-ui/public/assets/chunk-WU5MYG2G-Bz8vA5s7.js +1 -0
- package/workframe-ui/public/assets/{chunk-XPW4576I-DSbtd0cg.js → chunk-XPW4576I-TD7I7pcb.js} +1 -1
- package/workframe-ui/public/assets/classDiagram-4FO5ZUOK-DQiq8od0.js +1 -0
- package/workframe-ui/public/assets/classDiagram-v2-Q7XG4LA2-DQiq8od0.js +1 -0
- package/workframe-ui/public/assets/{cose-bilkent-S5V4N54A-lmYstEMQ.js → cose-bilkent-S5V4N54A-Bmm5x5xm.js} +1 -1
- package/workframe-ui/public/assets/{dagre-BM42HDAG-Bdkbdul2.js → dagre-BM42HDAG-zU2r0aq2.js} +1 -1
- package/workframe-ui/public/assets/{diagram-2AECGRRQ-Clb9kSXe.js → diagram-2AECGRRQ-AL01qukm.js} +1 -1
- package/workframe-ui/public/assets/{diagram-5GNKFQAL-BApg0yec.js → diagram-5GNKFQAL-DKi1xSMg.js} +1 -1
- package/workframe-ui/public/assets/{diagram-KO2AKTUF-peZjDRV6.js → diagram-KO2AKTUF-DQJDQ-f-.js} +1 -1
- package/workframe-ui/public/assets/{diagram-LMA3HP47-DZm_1pjc.js → diagram-LMA3HP47-B1oisGUj.js} +1 -1
- package/workframe-ui/public/assets/{diagram-OG6HWLK6-DP_N6fYL.js → diagram-OG6HWLK6-DjpJKffk.js} +1 -1
- package/workframe-ui/public/assets/{dist-CqP43hXK.js → dist-Jk20AnQG.js} +1 -1
- package/workframe-ui/public/assets/{erDiagram-TEJ5UH35-Blfs6kLv.js → erDiagram-TEJ5UH35-Vu8RtLUf.js} +1 -1
- package/workframe-ui/public/assets/eventmodeling-FCH6USID-BXUnTe0c.js +1 -0
- package/workframe-ui/public/assets/{flowDiagram-I6XJVG4X-CcmMOkwH.js → flowDiagram-I6XJVG4X-CHAXEhbR.js} +1 -1
- package/workframe-ui/public/assets/{ganttDiagram-6RSMTGT7-ByoO3dF7.js → ganttDiagram-6RSMTGT7-DhiEkfH8.js} +1 -1
- package/workframe-ui/public/assets/{gitGraph-WXDBUCRP-DCyTpmPs.js → gitGraph-WXDBUCRP-Cuq44XvU.js} +1 -1
- package/workframe-ui/public/assets/{gitGraphDiagram-PVQCEYII-CvLYB55b.js → gitGraphDiagram-PVQCEYII-B7kgReRt.js} +1 -1
- package/workframe-ui/public/assets/index-72-j0sA5.js +129 -0
- package/workframe-ui/public/assets/index-auJ0bLMU.css +1 -0
- package/workframe-ui/public/assets/{info-J43DQDTF-CfSRIfOI.js → info-J43DQDTF-oV4b3M4f.js} +1 -1
- package/workframe-ui/public/assets/{infoDiagram-5YYISTIA-DwS44DS6.js → infoDiagram-5YYISTIA-CthN4b6o.js} +1 -1
- package/workframe-ui/public/assets/{ishikawaDiagram-YF4QCWOH-MRlyodyU.js → ishikawaDiagram-YF4QCWOH-oEGS3TKg.js} +1 -1
- package/workframe-ui/public/assets/{journeyDiagram-JHISSGLW-sq7awk87.js → journeyDiagram-JHISSGLW-CXJsWmKF.js} +1 -1
- package/workframe-ui/public/assets/{kanban-definition-UN3LZRKU-CH6HbcWu.js → kanban-definition-UN3LZRKU-DTPo8yHW.js} +1 -1
- package/workframe-ui/public/assets/{line-DRBjFmUW.js → line-Bm9Pmcnz.js} +1 -1
- package/workframe-ui/public/assets/{linear-BR0LunjE.js → linear-Cn-uD6eX.js} +1 -1
- package/workframe-ui/public/assets/{mermaid-parser.core-Cl1GjHkT.js → mermaid-parser.core-BBVSTQZ4.js} +2 -2
- package/workframe-ui/public/assets/{mermaid.core-DsiKK1kE.js → mermaid.core-DE668nUy.js} +3 -3
- package/workframe-ui/public/assets/{mindmap-definition-RKZ34NQL-DBvi3OpW.js → mindmap-definition-RKZ34NQL-4qVsiwCf.js} +1 -1
- package/workframe-ui/public/assets/{packet-YPE3B663-CPDgtUHg.js → packet-YPE3B663-CqJeoiFG.js} +1 -1
- package/workframe-ui/public/assets/{pie-LRSECV5Y-BXJIPPDm.js → pie-LRSECV5Y-DcOqVssg.js} +1 -1
- package/workframe-ui/public/assets/{pieDiagram-4H26LBE5-CZwLEK-o.js → pieDiagram-4H26LBE5-CosMnpAM.js} +1 -1
- package/workframe-ui/public/assets/{quadrantDiagram-W4KKPZXB-B65bEUIQ.js → quadrantDiagram-W4KKPZXB-DtsnIK98.js} +1 -1
- package/workframe-ui/public/assets/{radar-GUYGQ44K-vXHkZzRK.js → radar-GUYGQ44K-BqLpJuWc.js} +1 -1
- package/workframe-ui/public/assets/{requirementDiagram-4Y6WPE33-BGWdvDfG.js → requirementDiagram-4Y6WPE33-Pb7cuX8_.js} +1 -1
- package/workframe-ui/public/assets/{sankeyDiagram-5OEKKPKP-BT2oC8dV.js → sankeyDiagram-5OEKKPKP-BJBlMM1m.js} +1 -1
- package/workframe-ui/public/assets/{sequenceDiagram-3UESZ5HK-45yj0Wtx.js → sequenceDiagram-3UESZ5HK-i4HnjP39.js} +1 -1
- package/workframe-ui/public/assets/{src-D-P8U2PB.js → src-DIhmc_XG.js} +1 -1
- package/workframe-ui/public/assets/{stateDiagram-AJRCARHV-SBrBJBZG.js → stateDiagram-AJRCARHV-Ba2iClPT.js} +1 -1
- package/workframe-ui/public/assets/stateDiagram-v2-BHNVJYJU-aUpqRAhy.js +1 -0
- package/workframe-ui/public/assets/{timeline-definition-PNZ67QCA-DegmxXXj.js → timeline-definition-PNZ67QCA-CL4X9vSF.js} +1 -1
- package/workframe-ui/public/assets/{treeView-BLDUP644-BVy7CsCj.js → treeView-BLDUP644-BJrjnbMj.js} +1 -1
- package/workframe-ui/public/assets/{treemap-LRROVOQU-BD5Kb74J.js → treemap-LRROVOQU-CN6H54RF.js} +1 -1
- package/workframe-ui/public/assets/{vennDiagram-CIIHVFJN-hwAkNbl3.js → vennDiagram-CIIHVFJN-Cee6sbUy.js} +1 -1
- package/workframe-ui/public/assets/{wardley-L42UT6IY-CBMPT8Y1.js → wardley-L42UT6IY-D0cXq60c.js} +1 -1
- package/workframe-ui/public/assets/{wardleyDiagram-YWT4CUSO-DXqihVlE.js → wardleyDiagram-YWT4CUSO-CaH9XkCx.js} +1 -1
- package/workframe-ui/public/assets/{xychartDiagram-2RQKCTM6-Cbb4LBzj.js → xychartDiagram-2RQKCTM6-BEisgFoI.js} +1 -1
- package/workframe-ui/public/favicon.svg +7 -7
- package/workframe-ui/public/icons.svg +24 -24
- package/workframe-ui/public/index.html +47 -50
- package/workframe-ui/public/manifest.webmanifest +18 -18
- package/workframe-ui/public/workframe-config.json +3 -3
- package/workframe-ui/public/assets/architecture-7EHR7CIX-DOxsUI33.js +0 -1
- package/workframe-ui/public/assets/channel-Baa20pIs.js +0 -1
- package/workframe-ui/public/assets/chunk-QZHKN3VN-B7tPxs4H.js +0 -1
- package/workframe-ui/public/assets/chunk-WU5MYG2G-Dvh2By1o.js +0 -1
- package/workframe-ui/public/assets/classDiagram-4FO5ZUOK-BljHyDzF.js +0 -1
- package/workframe-ui/public/assets/classDiagram-v2-Q7XG4LA2-BljHyDzF.js +0 -1
- package/workframe-ui/public/assets/eventmodeling-FCH6USID-C4xwO6dx.js +0 -1
- package/workframe-ui/public/assets/index-BIfRGM8p.js +0 -133
- package/workframe-ui/public/assets/index-DpoUZAxh.css +0 -1
- package/workframe-ui/public/assets/stateDiagram-v2-BHNVJYJU-B3im3So2.js +0 -1
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
"""Speed bump for cross-profile secret reads — not an ACL. Real isolation = vault + per-profile mount."""
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import re
|
|
5
|
-
|
|
6
|
-
# ponytail: shared by workframe-api and workframe-supervisor (copy in supervisor image)
|
|
7
|
-
_PROFILE_SECRET_PATH = re.compile(
|
|
8
|
-
r"(?:/opt/data/)?profiles/[^/\s]+/(?:\.env|auth\.json|credentials\.json|\.git-credentials|cookies\.txt)",
|
|
9
|
-
re.IGNORECASE,
|
|
10
|
-
)
|
|
11
|
-
_PROFILE_SLUG_REF = re.compile(
|
|
12
|
-
r"(?:/opt/data/)?profiles/([a-z0-9][a-z0-9-]{0,63})(?:/|$|\s)",
|
|
13
|
-
re.IGNORECASE,
|
|
14
|
-
)
|
|
15
|
-
_READ_VERBS = re.compile(
|
|
16
|
-
r"\b(?:cat|head|tail|sed|awk|grep|egrep|rg|less|more|od|xxd|nl|sort|wc|strings|dd|python3?|perl|ruby|node)\b",
|
|
17
|
-
re.IGNORECASE,
|
|
18
|
-
)
|
|
19
|
-
_SHELL_BYPASS = re.compile(
|
|
20
|
-
r"(?:\*|find\b[^\n]*-exec\b|xargs\b|\btar\b|\bbase64\b|\.e''nv|\.e\"\"nv"
|
|
21
|
-
r"|&&\s*(?:cat|head|tail|sed|awk|grep|python3?|perl|dd|od|xxd|nl|sort|wc)\b"
|
|
22
|
-
r"|\|\s*(?:cat|head|tail|sed|awk|grep|python3?|perl|dd|od|xxd|nl|sort|wc)\b)",
|
|
23
|
-
re.IGNORECASE,
|
|
24
|
-
)
|
|
25
|
-
# ponytail: shell var indirection ceiling — catches `P=…profiles/u-bob; cat $P/.env`
|
|
26
|
-
# but NOT python string concat ('pro'+'files/…'). Real fix = per-profile secret broker.
|
|
27
|
-
_VAR_PROFILE_ASSIGN = re.compile(
|
|
28
|
-
r"\b([A-Za-z_][A-Za-z0-9_]*)=(?:[^\s;&|]*\s*)?(?:/opt/data/)?profiles/[a-z0-9][a-z0-9-]{0,63}",
|
|
29
|
-
re.IGNORECASE,
|
|
30
|
-
)
|
|
31
|
-
_VAR_DEREF_SECRET = re.compile(
|
|
32
|
-
r"\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?[^\s;&|]*/(?:\.env|auth\.json|credentials\.json|\.git-credentials|cookies\.txt)",
|
|
33
|
-
re.IGNORECASE,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def _cmd_blob(cmd: list[str] | str) -> str:
|
|
38
|
-
return " ".join(str(part) for part in cmd) if isinstance(cmd, list) else str(cmd)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def referenced_profile_slugs(cmd: list[str] | str) -> set[str]:
|
|
42
|
-
return {m.group(1).lower() for m in _PROFILE_SLUG_REF.finditer(_cmd_blob(cmd))}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def is_secret_read_attempt(cmd: list[str] | str) -> bool:
|
|
46
|
-
blob = _cmd_blob(cmd)
|
|
47
|
-
if _PROFILE_SECRET_PATH.search(blob):
|
|
48
|
-
return True
|
|
49
|
-
if "profiles/" in blob.lower() and _SHELL_BYPASS.search(blob):
|
|
50
|
-
return True
|
|
51
|
-
if _PROFILE_SLUG_REF.search(blob) and _READ_VERBS.search(blob):
|
|
52
|
-
return True
|
|
53
|
-
assigned = {m.group(1) for m in _VAR_PROFILE_ASSIGN.finditer(blob)}
|
|
54
|
-
if assigned:
|
|
55
|
-
for m in _VAR_DEREF_SECRET.finditer(blob):
|
|
56
|
-
if m.group(1) in assigned:
|
|
57
|
-
return True
|
|
58
|
-
return False
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def touches_foreign_profile_secrets(cmd: list[str] | str, allowed_profile: str) -> bool:
|
|
62
|
-
"""True when command references another profile's tree (0022 N2 / 0023 C1)."""
|
|
63
|
-
allowed = str(allowed_profile or "").strip().lower()
|
|
64
|
-
if not allowed:
|
|
65
|
-
return False
|
|
66
|
-
slugs = referenced_profile_slugs(cmd)
|
|
67
|
-
return bool(slugs - {allowed})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def exec_blocked_for_profile(cmd: list[str] | str, acting_profile: str = "") -> bool:
|
|
71
|
-
if is_secret_read_attempt(cmd):
|
|
72
|
-
return True
|
|
73
|
-
if acting_profile and touches_foreign_profile_secrets(cmd, acting_profile):
|
|
74
|
-
return True
|
|
75
|
-
return False
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if __name__ == "__main__":
|
|
79
|
-
assert is_secret_read_attempt(["cat", "profiles/u-alice-dev/.env"])
|
|
80
|
-
assert is_secret_read_attempt("cat profiles/u-bob-dev/*")
|
|
81
|
-
assert is_secret_read_attempt("cd /opt/data/profiles/u-bob && head .env")
|
|
82
|
-
assert is_secret_read_attempt("cd profiles/u-x && python3 -c \"print(open('.env').read())\"")
|
|
83
|
-
assert touches_foreign_profile_secrets("cd profiles/u-bob && head .env", "u-alice-dev")
|
|
84
|
-
assert not touches_foreign_profile_secrets("hermes -p u-alice-dev gateway status", "u-alice-dev")
|
|
85
|
-
assert not is_secret_read_attempt(["hermes", "-p", "dev", "gateway", "run"])
|
|
86
|
-
print("profile_secret_policy ok")
|
|
1
|
+
"""Speed bump for cross-profile secret reads — not an ACL. Real isolation = vault + per-profile mount."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
# ponytail: shared by workframe-api and workframe-supervisor (copy in supervisor image)
|
|
7
|
+
_PROFILE_SECRET_PATH = re.compile(
|
|
8
|
+
r"(?:/opt/data/)?profiles/[^/\s]+/(?:\.env|auth\.json|credentials\.json|\.git-credentials|cookies\.txt)",
|
|
9
|
+
re.IGNORECASE,
|
|
10
|
+
)
|
|
11
|
+
_PROFILE_SLUG_REF = re.compile(
|
|
12
|
+
r"(?:/opt/data/)?profiles/([a-z0-9][a-z0-9-]{0,63})(?:/|$|\s)",
|
|
13
|
+
re.IGNORECASE,
|
|
14
|
+
)
|
|
15
|
+
_READ_VERBS = re.compile(
|
|
16
|
+
r"\b(?:cat|head|tail|sed|awk|grep|egrep|rg|less|more|od|xxd|nl|sort|wc|strings|dd|python3?|perl|ruby|node)\b",
|
|
17
|
+
re.IGNORECASE,
|
|
18
|
+
)
|
|
19
|
+
_SHELL_BYPASS = re.compile(
|
|
20
|
+
r"(?:\*|find\b[^\n]*-exec\b|xargs\b|\btar\b|\bbase64\b|\.e''nv|\.e\"\"nv"
|
|
21
|
+
r"|&&\s*(?:cat|head|tail|sed|awk|grep|python3?|perl|dd|od|xxd|nl|sort|wc)\b"
|
|
22
|
+
r"|\|\s*(?:cat|head|tail|sed|awk|grep|python3?|perl|dd|od|xxd|nl|sort|wc)\b)",
|
|
23
|
+
re.IGNORECASE,
|
|
24
|
+
)
|
|
25
|
+
# ponytail: shell var indirection ceiling — catches `P=…profiles/u-bob; cat $P/.env`
|
|
26
|
+
# but NOT python string concat ('pro'+'files/…'). Real fix = per-profile secret broker.
|
|
27
|
+
_VAR_PROFILE_ASSIGN = re.compile(
|
|
28
|
+
r"\b([A-Za-z_][A-Za-z0-9_]*)=(?:[^\s;&|]*\s*)?(?:/opt/data/)?profiles/[a-z0-9][a-z0-9-]{0,63}",
|
|
29
|
+
re.IGNORECASE,
|
|
30
|
+
)
|
|
31
|
+
_VAR_DEREF_SECRET = re.compile(
|
|
32
|
+
r"\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?[^\s;&|]*/(?:\.env|auth\.json|credentials\.json|\.git-credentials|cookies\.txt)",
|
|
33
|
+
re.IGNORECASE,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _cmd_blob(cmd: list[str] | str) -> str:
|
|
38
|
+
return " ".join(str(part) for part in cmd) if isinstance(cmd, list) else str(cmd)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def referenced_profile_slugs(cmd: list[str] | str) -> set[str]:
|
|
42
|
+
return {m.group(1).lower() for m in _PROFILE_SLUG_REF.finditer(_cmd_blob(cmd))}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def is_secret_read_attempt(cmd: list[str] | str) -> bool:
|
|
46
|
+
blob = _cmd_blob(cmd)
|
|
47
|
+
if _PROFILE_SECRET_PATH.search(blob):
|
|
48
|
+
return True
|
|
49
|
+
if "profiles/" in blob.lower() and _SHELL_BYPASS.search(blob):
|
|
50
|
+
return True
|
|
51
|
+
if _PROFILE_SLUG_REF.search(blob) and _READ_VERBS.search(blob):
|
|
52
|
+
return True
|
|
53
|
+
assigned = {m.group(1) for m in _VAR_PROFILE_ASSIGN.finditer(blob)}
|
|
54
|
+
if assigned:
|
|
55
|
+
for m in _VAR_DEREF_SECRET.finditer(blob):
|
|
56
|
+
if m.group(1) in assigned:
|
|
57
|
+
return True
|
|
58
|
+
return False
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def touches_foreign_profile_secrets(cmd: list[str] | str, allowed_profile: str) -> bool:
|
|
62
|
+
"""True when command references another profile's tree (0022 N2 / 0023 C1)."""
|
|
63
|
+
allowed = str(allowed_profile or "").strip().lower()
|
|
64
|
+
if not allowed:
|
|
65
|
+
return False
|
|
66
|
+
slugs = referenced_profile_slugs(cmd)
|
|
67
|
+
return bool(slugs - {allowed})
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def exec_blocked_for_profile(cmd: list[str] | str, acting_profile: str = "") -> bool:
|
|
71
|
+
if is_secret_read_attempt(cmd):
|
|
72
|
+
return True
|
|
73
|
+
if acting_profile and touches_foreign_profile_secrets(cmd, acting_profile):
|
|
74
|
+
return True
|
|
75
|
+
return False
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == "__main__":
|
|
79
|
+
assert is_secret_read_attempt(["cat", "profiles/u-alice-dev/.env"])
|
|
80
|
+
assert is_secret_read_attempt("cat profiles/u-bob-dev/*")
|
|
81
|
+
assert is_secret_read_attempt("cd /opt/data/profiles/u-bob && head .env")
|
|
82
|
+
assert is_secret_read_attempt("cd profiles/u-x && python3 -c \"print(open('.env').read())\"")
|
|
83
|
+
assert touches_foreign_profile_secrets("cd profiles/u-bob && head .env", "u-alice-dev")
|
|
84
|
+
assert not touches_foreign_profile_secrets("hermes -p u-alice-dev gateway status", "u-alice-dev")
|
|
85
|
+
assert not is_secret_read_attempt(["hermes", "-p", "dev", "gateway", "run"])
|
|
86
|
+
print("profile_secret_policy ok")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--wf-font-sans:"Inter Tight", ui-sans-serif, system-ui, sans-serif;--wf-font-mono:"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--wf-blur:34px;--wf-header-height:56px;--wf-footer-height:28px}[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--wf-bg:#0a0a0f;--wf-text:#e8e8ee;--wf-muted:#727280;--wf-border:#ffffff12;--wf-border-strong:#ffffff1c;--wf-surface:#12121a94;--wf-surface-soft:#12121a61;--wf-primary:#ffffffe6;--wf-primary-foreground:#0a0a0f;--wf-violet:#6d28d9;--wf-violet-glow:#7c3aed;--wf-ring:#6d28d961}[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--wf-bg:#f2f2f7;--wf-text:#1c1c1e;--wf-muted:#8e8e93;--wf-border:#00000014;--wf-border-strong:#0000001f;--wf-surface:#fffc;--wf-surface-soft:#ffffff80;--wf-primary:#000;--wf-primary-foreground:#fff;--wf-violet:#6d28d9;--wf-violet-glow:#7c3aed;--wf-ring:#6d28d961}*{box-sizing:border-box;margin:0;padding:0}body{font-family:var(--wf-font-sans);background:var(--wf-bg);color:var(--wf-text);-webkit-font-smoothing:antialiased;line-height:1.5}.wf-shell{flex-direction:column;min-height:100vh;display:flex}.wf-shell--centered{justify-content:center;align-items:center}.wf-header{height:var(--wf-header-height);border-bottom:1px solid var(--wf-border);background:var(--wf-surface);-webkit-backdrop-filter:blur(var(--wf-blur));backdrop-filter:blur(var(--wf-blur));justify-content:space-between;align-items:center;padding:0 20px;display:flex}.wf-header__brand{letter-spacing:-.02em;color:var(--wf-text);font-size:18px;font-weight:700}.wf-header__actions{gap:8px;display:flex}.wf-auth{background:var(--wf-surface);border:1px solid var(--wf-border);width:100%;max-width:400px;-webkit-backdrop-filter:blur(var(--wf-blur));backdrop-filter:blur(var(--wf-blur));border-radius:16px;padding:32px}.wf-auth__title{letter-spacing:-.02em;margin:0 0 8px;font-size:24px;font-weight:700}.wf-auth__subtitle{color:var(--wf-muted);margin:0 0 24px;font-size:14px}.wf-field{margin-bottom:16px}.wf-field__label{color:var(--wf-muted);margin-bottom:6px;font-size:13px;font-weight:500;display:block}.wf-input{background:var(--wf-surface-soft);border:1px solid var(--wf-border);width:100%;height:40px;color:var(--wf-text);font-size:14px;font-family:var(--wf-font-sans);border-radius:8px;outline:none;padding:0 12px;transition:border-color .15s}.wf-input:focus{border-color:var(--wf-violet);box-shadow:0 0 0 3px var(--wf-ring)}.wf-input::placeholder{color:var(--wf-muted)}.wf-btn{height:40px;font-size:14px;font-weight:500;font-family:var(--wf-font-sans);cursor:pointer;border:none;border-radius:8px;justify-content:center;align-items:center;padding:0 16px;transition:all .15s;display:inline-flex}.wf-btn--primary{background:var(--wf-primary);color:var(--wf-primary-foreground)}.wf-btn--primary:hover{opacity:.9}.wf-btn--secondary{background:var(--wf-surface-soft);color:var(--wf-text);border:1px solid var(--wf-border)}.wf-btn--secondary:hover{background:var(--wf-border)}.wf-btn--ghost{color:var(--wf-text);background:0 0}.wf-btn--ghost:hover{background:var(--wf-surface-soft)}.wf-btn--sm{height:32px;padding:0 12px;font-size:13px}.wf-btn:disabled{opacity:.5;cursor:not-allowed}.wf-error{color:#ef4444;background:#ef44441a;border:1px solid #ef444433;border-radius:8px;margin-bottom:16px;padding:10px 12px;font-size:13px}.wf-success{color:#22c55e;background:#22c55e1a;border:1px solid #22c55e33;border-radius:8px;margin-bottom:16px;padding:10px 12px;font-size:13px}.wf-otp{justify-content:center;gap:8px;margin-bottom:16px;display:flex}.wf-otp__digit{text-align:center;width:44px;height:48px;font-size:20px;font-weight:600;font-family:var(--wf-font-mono);background:var(--wf-surface-soft);border:1px solid var(--wf-border);color:var(--wf-text);border-radius:8px;outline:none;padding:0;transition:border-color .15s}.wf-otp__digit:focus{border-color:var(--wf-violet);box-shadow:0 0 0 3px var(--wf-ring)}.wf-layout{flex:1;display:flex;overflow:hidden}.wf-sidebar{border-right:1px solid var(--wf-border);background:var(--wf-surface);width:200px;padding:16px 0}.wf-sidebar__link{color:var(--wf-muted);cursor:pointer;padding:8px 20px;font-size:14px;text-decoration:none;transition:all .15s;display:block}.wf-sidebar__link:hover{color:var(--wf-text);background:var(--wf-surface-soft)}.wf-sidebar__link--active{color:var(--wf-text);background:var(--wf-surface-soft);font-weight:500}.wf-main{flex:1;padding:24px;overflow-y:auto}.wf-profile{max-width:480px}.wf-profile__avatar{background:var(--wf-violet);color:#fff;border-radius:50%;justify-content:center;align-items:center;width:64px;height:64px;margin-bottom:24px;font-size:24px;font-weight:600;display:flex}.wf-profile__name{margin:0 0 4px;font-size:20px;font-weight:600}.wf-profile__email{color:var(--wf-muted);margin:0 0 24px;font-size:14px}.wf-otp{gap:8px;margin-bottom:16px;display:flex}.wf-otp .wf-input{text-align:center;letter-spacing:4px;font-size:20px;font-weight:600}
|
|
1
|
+
:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--wf-font-sans:"Inter Tight", ui-sans-serif, system-ui, sans-serif;--wf-font-mono:"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--wf-blur:34px;--wf-header-height:56px;--wf-footer-height:28px}[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--wf-bg:#0a0a0f;--wf-text:#e8e8ee;--wf-muted:#727280;--wf-border:#ffffff12;--wf-border-strong:#ffffff1c;--wf-surface:#12121a94;--wf-surface-soft:#12121a61;--wf-primary:#ffffffe6;--wf-primary-foreground:#0a0a0f;--wf-violet:#6d28d9;--wf-violet-glow:#7c3aed;--wf-ring:#6d28d961}[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--wf-bg:#f2f2f7;--wf-text:#1c1c1e;--wf-muted:#8e8e93;--wf-border:#00000014;--wf-border-strong:#0000001f;--wf-surface:#fffc;--wf-surface-soft:#ffffff80;--wf-primary:#000;--wf-primary-foreground:#fff;--wf-violet:#6d28d9;--wf-violet-glow:#7c3aed;--wf-ring:#6d28d961}*{box-sizing:border-box;margin:0;padding:0}body{font-family:var(--wf-font-sans);background:var(--wf-bg);color:var(--wf-text);-webkit-font-smoothing:antialiased;line-height:1.5}.wf-shell{flex-direction:column;min-height:100vh;display:flex}.wf-shell--centered{justify-content:center;align-items:center}.wf-header{height:var(--wf-header-height);border-bottom:1px solid var(--wf-border);background:var(--wf-surface);-webkit-backdrop-filter:blur(var(--wf-blur));backdrop-filter:blur(var(--wf-blur));justify-content:space-between;align-items:center;padding:0 20px;display:flex}.wf-header__brand{letter-spacing:-.02em;color:var(--wf-text);font-size:18px;font-weight:700}.wf-header__actions{gap:8px;display:flex}.wf-auth{background:var(--wf-surface);border:1px solid var(--wf-border);width:100%;max-width:400px;-webkit-backdrop-filter:blur(var(--wf-blur));backdrop-filter:blur(var(--wf-blur));border-radius:16px;padding:32px}.wf-auth__title{letter-spacing:-.02em;margin:0 0 8px;font-size:24px;font-weight:700}.wf-auth__subtitle{color:var(--wf-muted);margin:0 0 24px;font-size:14px}.wf-field{margin-bottom:16px}.wf-field__label{color:var(--wf-muted);margin-bottom:6px;font-size:13px;font-weight:500;display:block}.wf-input{background:var(--wf-surface-soft);border:1px solid var(--wf-border);width:100%;height:40px;color:var(--wf-text);font-size:14px;font-family:var(--wf-font-sans);border-radius:8px;outline:none;padding:0 12px;transition:border-color .15s}.wf-input:focus{border-color:var(--wf-violet);box-shadow:0 0 0 3px var(--wf-ring)}.wf-input::placeholder{color:var(--wf-muted)}.wf-btn{height:40px;font-size:14px;font-weight:500;font-family:var(--wf-font-sans);cursor:pointer;border:none;border-radius:8px;justify-content:center;align-items:center;padding:0 16px;transition:all .15s;display:inline-flex}.wf-btn--primary{background:var(--wf-primary);color:var(--wf-primary-foreground)}.wf-btn--primary:hover{opacity:.9}.wf-btn--secondary{background:var(--wf-surface-soft);color:var(--wf-text);border:1px solid var(--wf-border)}.wf-btn--secondary:hover{background:var(--wf-border)}.wf-btn--ghost{color:var(--wf-text);background:0 0}.wf-btn--ghost:hover{background:var(--wf-surface-soft)}.wf-btn--sm{height:32px;padding:0 12px;font-size:13px}.wf-btn:disabled{opacity:.5;cursor:not-allowed}.wf-error{color:#ef4444;background:#ef44441a;border:1px solid #ef444433;border-radius:8px;margin-bottom:16px;padding:10px 12px;font-size:13px}.wf-success{color:#22c55e;background:#22c55e1a;border:1px solid #22c55e33;border-radius:8px;margin-bottom:16px;padding:10px 12px;font-size:13px}.wf-otp{justify-content:center;gap:8px;margin-bottom:16px;display:flex}.wf-otp__digit{text-align:center;width:44px;height:48px;font-size:20px;font-weight:600;font-family:var(--wf-font-mono);background:var(--wf-surface-soft);border:1px solid var(--wf-border);color:var(--wf-text);border-radius:8px;outline:none;padding:0;transition:border-color .15s}.wf-otp__digit:focus{border-color:var(--wf-violet);box-shadow:0 0 0 3px var(--wf-ring)}.wf-layout{flex:1;display:flex;overflow:hidden}.wf-sidebar{border-right:1px solid var(--wf-border);background:var(--wf-surface);width:200px;padding:16px 0}.wf-sidebar__link{color:var(--wf-muted);cursor:pointer;padding:8px 20px;font-size:14px;text-decoration:none;transition:all .15s;display:block}.wf-sidebar__link:hover{color:var(--wf-text);background:var(--wf-surface-soft)}.wf-sidebar__link--active{color:var(--wf-text);background:var(--wf-surface-soft);font-weight:500}.wf-main{flex:1;padding:24px;overflow-y:auto}.wf-profile{max-width:480px}.wf-profile__avatar{background:var(--wf-violet);color:#fff;border-radius:50%;justify-content:center;align-items:center;width:64px;height:64px;margin-bottom:24px;font-size:24px;font-weight:600;display:flex}.wf-profile__name{margin:0 0 4px;font-size:20px;font-weight:600}.wf-profile__email{color:var(--wf-muted);margin:0 0 24px;font-size:14px}.wf-otp{gap:8px;margin-bottom:16px;display:flex}.wf-otp .wf-input{text-align:center;letter-spacing:4px;font-size:20px;font-weight:600}
|