+
    lHàjµ  ã                   óú   € R t ^ RIt^ RIt^ RIHt ]P                  ! R4      t. ROt]R,          t	Rt
R]
 2R3R]
 2R	3R
]
 2R3R]
 2R3R]
 R2R3.tRtRtR R ltR R ltR R ltR R ltR R ltR R ltR# ) z£Cron prompt threat scanning: the small user-authored prompt gets the strict pattern set;
the assembled prompt (with skill bodies) gets only prose-proof directives.N)ÚINVISIBLE_CHARSztools.cronjob_tools:Né   Nz:\$\{?\w*(?:KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL|API)\w*\}?z curl\s+[^\n]*https?://[^\s"\'`]*Úexfil_curl_urlz wget\s+[^\n]*https?://[^\s"\'`]*Úexfil_wget_urlzIcurl\s+[^\n]*(?:--data(?:-raw|-binary|-urlencode)?|-d|--form|-F)\s+[^\n]*Úexfil_curl_dataz(wget\s+[^\n]*--post-(?:data|file)=[^\n]*Úexfil_wget_postzHcurl\s+[^\n]*(?:-H|--header)\s+["\']Authorization:\s*(?:Bearer|token)\s+z["\']Úexfil_curl_auth_headeriþ  c                ó<   € V ^8„  d   QhR\         R\        R\        /# )é   ÚtextÚidxÚreturn)ÚstrÚintÚbool)Úformats   "Ú>/home/ubuntu/.hermes/hermes-agent/tools/cronjob_prompt_scan.pyÚ__annotate__r   ;   s!   € ÷ ñ ¤3ð ¬Sð ´Tñ ó    c                ó˜  a € V^,
          pV^ 8¼  d'   \        S V,          4      \        8X  d   V^,          pK-  V^,           pV\        S 4      8  d'   \        S V,          4      \        8X  d   V^,          pK6  V^ 8  g   V\        S 4      8¼  d   R# \        ;QJ d     V 3R lW#3 4       F  '       d   K   R# 	  R# ! V 3R lW#3 4       4      # )zMTrue when the ZWJ at text[idx] sits between emoji codepoints (skipping VS16).Fc              3   ó®   <a"  € T FI  o\         ;QJ d$    VV3R  l\         4       F  '       g   K   RM	  RM! VV3R  l\         4       4      x € KK  	  R# 5i)c              3   ót   <"  € T F-  w  rV\        SS,          4      u;8*  ;'       d    V8*  Mu x € K/  	  R # 5i)N)Úord)Ú.0ÚloÚhiÚposr   s   &  €€r   Ú	<genexpr>Ú5_zwj_has_emoji_neighbour.<locals>.<genexpr>.<genexpr>F   s-   øé € ÐPÑ5O©6¨2ˆB”#�d˜3•i“.×&Ô& B×&Ñ&Ó5Oùs   ƒ58TFN)ÚanyÚ_EMOJI_NEIGHBOUR_CP_RANGES)r   r   r   s   &@€r   r   Ú+_zwj_has_emoji_neighbour.<locals>.<genexpr>E   s6   ùé € ð Ù\iÐUX�‹ÕPÕ5OÓP��ŠÕPÕ5OÓP×PÐPÓ\iùs   „A”A°%AT)r   Ú_VARIATION_SELECTOR_CPÚlenÚall)r   r   ÚleftÚrights   f&  r   Ú_zwj_has_emoji_neighbourr'   ;   s±   ø€ à��7€DØ
�!Œ)œ˜D �J›Ô+AÔAØ��	ŠØ�!�G€EØ
”#�d“)Ô
¤ D¨¥KÓ 0Ô4JÔ JØ��
ŠØˆa„x�5œC ›IÔ%Ùß‹3ô Ø]aÑ\ió�3Œ3ð Š3ð ˆ3ô Ø]aÑ\ióó ð r   c                ó0   € V ^8„  d   QhR\         R\         /# ©r
   Úpromptr   ©r   )r   s   "r   r   r   J   s   € ÷ ñ ¬ð ´ñ r   c                ób   € \         P                  ! R\         R2RV \         P                  R7      # )u÷  Scrub the bundled GitHub skill's `Authorization: token $GITHUB_TOKEN` + api.github.com
curl so it doesn't trip the auth-header exfil rule.

re.sub scrubs EVERY occurrence. The trailing ``[^\s;&|$`]*`` consumes only the URL path â€”
never separators or subshell openers â€” so a payload smuggled onto the same line still gets
scanned. Host must be exactly api.github.com followed by ``/``, whitespace, quote, or end:
lookalike authorities (api.github.com.evil.com, api.github.com@evil.com) fall through.
zBcurl\s+[^\n;&|$`]*(?:-H|--header)\s+["\']Authorization:\s*token\s+zJ["\']\s+["\']?https://api\.github\.com(?::\d+)?(?:/|\s|$|["\'])[^\s;&|$`]*z curl https://api.github.com/user)Úflags)ÚreÚsubÚ_CRON_SECRET_VAR_REÚ
IGNORECASE)r*   s   &r   Ú_strip_cron_safe_constructsr2   J   s8   € ô �6Š6ØMÔNaÐMbð cQð 	Qà*ØÜ�m‰môð r   c                óh   € V ^8„  d   QhR\         R\        \         \        \         ,          3,          /# r)   )r   ÚtupleÚlist)r   s   "r   r   r   \   s'   € ÷ -ñ -¤Sð -¬U´3¼¼S½	°>Õ-Bñ -r   c                ó:  € V '       g   V . 3# \        4       p. p\        V 4       FY  w  r4V\        9   d9   VR8X  d   \        W4      '       g!   VP	                  R\        V4      R 24       KH  VP                  V4       K[  	  RP                  V4      \        V4      3# )zóStrip invisible-unicode chars, keeping ZWJ inside legitimate emoji.

Returns ``(cleaned, sorted U+XXXX labels removed)``. The skills-attached path sanitizes
(a stray zero-width space in vetted skill content must not permanently kill the job).
u   â€�úU+Ú04XÚ )	ÚsetÚ	enumerateÚ_CRON_INVISIBLE_CHARSr'   Úaddr   ÚappendÚjoinÚsorted)r*   ÚremovedÚcleanedr   Úchs   &    r   Ú_strip_invisible_unicoderD   \   s‹   € ÷ Ø�rˆzÐÜ›€GØ€GÜ˜VÖ$‰ˆØÔ&Ô&°°h´ÔC[Ð\b×ChÒChØ�K‰K˜"œS ›W S˜MÐ*Ô+ÙØ�‰�rÖñ	 %ð
 �7‰7�7ÓœV G›_Ð,Ð,r   c                ó0   € V ^8„  d   QhR\         R\         /# )r
   r   r   r+   )r   s   "r   r   r   n   s   € ÷ ñ œsð ´cñ r   c                 ó˜   € V FC  pV F:  w  r4\         P                  ! W0\         P                  4      '       g   K2  R V R2u u # 	  KE  	  R# )z(Blocked: prompt matches threat pattern 'zD'. Cron prompts must not contain injection or exfiltration payloads.r9   )r.   Úsearchr1   )r   Úpattern_setsÚpatternsÚpatternÚpids   &*   r   Ú_first_pattern_errorrL   n   sK   € Û ˆÛ$‰LˆGÜ�yŠy˜¬¯©×6Ô6à>¸s¸eð DBð Bôó %ñ !ñ r   c                ó0   € V ^8„  d   QhR\         R\         /# r)   r+   )r   s   "r   r   r   y   s   € ÷ 	eñ 	eœcð 	e¤cñ 	er   c                óÞ   € \        V 4      p\        \        V4      ^,          4      p\         F)  pR\	        V4      R 2V9   g   K  R\	        V4      R R2u # 	  \        V\        \        4      # )zßStrict scan of the USER-SUPPLIED prompt (create/update + runtime defense-in-depth).
Returns an error string when blocked, else "". Invisible unicode is reported first, in
``_CRON_INVISIBLE_CHARS`` order (emoji ZWJ allowed).r7   r8   z-Blocked: prompt contains invisible unicode U+z (possible injection).)r2   r:   rD   r<   r   rL   Ú_CRON_THREAT_PATTERNSÚ_CRON_EXFIL_COMMAND_PATTERNS)r*   Úprompt_to_scanrA   Úchars   &   r   Ú_scan_cron_promptrS   y   sk   € ô 1°Ó8€NÜÔ*¨>Ó:¸1Õ=Ó>€Gß%ˆØ”�D“	˜#ˆÐ 7Ö*ØBÄ3ÀtÃ9ÈSÀ/ÐQgÐhÒhñ &ô   Ô0EÔGcÓdÐdr   c                óR   € V ^8„  d   QhR\         R\        \         \         3,          /# )r
   Ú	assembledr   )r   r4   )r   s   "r   r   r   …   s&   € ÷ oñ o¬#ð o´%¼¼S¸µ/ñ or   c                óÀ   € \        V 4      w  rV'       d0   \        P                  R\        V4      RP	                  V4      4       V\        \        V4      \        4      3# )u  Loose scan of the ASSEMBLED prompt (skill content included). Invisible unicode is
SANITIZED (stripped + logged), not blocked â€” the hard block stays on raw user prompts,
the actual injection surface. Returns ``(cleaned_prompt, error)``, error "" when passed.zaCron skill-assembled prompt: stripped %d invisible-unicode char(s) (%s) from vetted skill contentz, )rD   ÚloggerÚwarningr#   r?   rL   r2   Ú_CRON_SKILL_ASSEMBLED_PATTERNS)rU   rB   rA   s   &  r   Ú_scan_cron_skill_assembledrZ   …   sS   € ô 0°	Ó:Ñ€GßÜ�‰ð5ä�‹L˜$Ÿ)™) GÓ,ô	
ð
 Ô(Ô)DÀWÓ)MÔOmÓnÐnÐnr   ))zJignore\s+(?:\w+\s+)*(?:previous|all|above|prior)\s+(?:\w+\s+)*instructionsÚprompt_injection)zdo\s+not\s+tell\s+the\s+userÚdeception_hide)zsystem\s+prompt\s+overrideÚsys_prompt_override)z<disregard\s+(your|all|any)\s+(instructions|rules|guidelines)Údisregard_rules)zKcat\s+[^\n]*(\.env|credentials|\.netrc|\.pgpass|id_rsa|id_ed25519|id_ecdsa)Úread_secrets)Úauthorized_keysÚssh_backdoor)z/etc/sudoers|visudoÚsudoers_mod)zrm\s+-rf\s+/Údestructive_root_rm))i ð iÿÿ )i &  i¿'  )i #  iÿ#  )iæñ iÿñ )éã   rd   )Ú__doc__Úloggingr.   Útools.threat_patternsr   r<   Ú	getLoggerrW   rO   rY   r0   rP   r    r"   r'   r2   rD   rL   rS   rZ   © r   r   Ú<module>rj      sä   ðñNó Û 	õ Kð 
×	Ò	Ð0Ó	1€òÐ ð "7°rÕ!:Ð àSÐ ð 	)Ð)<Ð(=Ð>Ð@PÐQØ(Ð)<Ð(=Ð>Ð@PÐQØQÐReÐQfÐgÐizÐ{Ø0Ð1DÐ0EÐFÐHYÐZØPÐQdÐPeÐejÐkð  nFð  Gð Ð ð |Ð ØÐ õõõ$-õ$õ	e÷or   