T01 · Skill Instruction Hijacking
- Location
scripts/context_gatekeeper.py:41- Finding
Untrusted Conversation Content Is Reintroduced as Active Model Context
- Content
View full analysis
list[str]: sentences = [] for entry in entries: sentences.extend(split_sentences(entry["text"])) if not sentences: return [] if limit <= 0: return [] if len(sentences) <= limit: return sentences half = limit // 2 first_chunk = sentences[:half] last_chunk = sentences[-(limit - half) :] return first_chunk + last_chunk ``` ```python def format_recent(entries: list[dict], count: int) -> list[str]: recent = entries[-count:] if count > 0 else [] formatted = [f"{entry['role']}: {entry['text']}" for entry in recent] return formatted def build_markdown(summary: list[str], pendings: list[str], recent: list[str]) -> str: catalyst = datetime.now(timezone.utc).isoformat(timespec="seconds") sections = ["# Context Gatekeeper", f"_Gerado: {catalyst}_", ""] if summary: sections.append("## Resumo compacto") sections.extend(f"- {sent}" for sent in summary) sections.append("") else: sections.append("## Resumo compacto") sections.append("- Sem conteúdo suficiente para resumir.") sections.append("") if pendings: sections.append("## Pendências e próximos passos") sections.extend(f"- {task}" for task in pendings) sections.append("") else: sections.append("## Pendências e próximos passos") sections.append("- Nenhuma pendência identificada no histórico recente.") sections.append("") if recent: sections.append("## Últimos turnos") sections.extend(f"- {line}" for line in recent) else: sections.append("## Últi ...[truncated 3296 chars]- Remediation
View remediation
