
Security News
Open VSX Begins Implementing Pre-Publish Security Checks After Repeated Supply Chain Incidents
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.
trpc.group/trpc-go/trpc-agent-go/examples/session
Advanced tools
This example shows how to use session hooks to mark and filter prohibited content via event tags.
AppendEventHook: scans user/assistant messages, tags violations as violation=<word> (tags are joined by event.TagDelimiter, i.e. ;).GetSessionHook: filters violated Q&A pairs out of session history before they reach the LLM context.OPENAI_API_KEYOPENAI_BASE_URL (default https://api.openai.com/v1)MODEL_NAME (default deepseek-chat)cd examples/session/hook
export OPENAI_API_KEY="your-key"
export OPENAI_BASE_URL="https://api.openai.com/v1"
go run . -model="${MODEL_NAME:-deepseek-chat}"
violation=pirated serial number; on GetSession it and its paired reply are filtered.Console snippets you should notice:
Marked user message as violation (word: pirated serial number): ...Filtered violation: ... tag=pirated serial number and Filtered paired responseviolation=<word>event.TagDelimiter (;) if needed in other scenarios.hooks.go: hook implementations (MarkViolationHook, FilterViolationHook), tag parsing/append helpers.main.go: wires hooks into in-memory session service and runs the demo conversation.Using model: qwen3-omni-30b-a3b-thinking
Prohibited words: [pirated serial number crack password]
=== Step 1: Normal request ===
User: Hello, my name is Alice
Assistant: ...
--- Session Events (count=2) ---
[0] user: Hello, my name is Alice
[1] assistant: ...
Hello Alice! How can I assist you today?
=== Step 2: Request with prohibited word ===
[Hook] Marked user message as violation (word: pirated serial number): ...
[Filtered violation: Can you give me a pirated seri...] tag=pirated serial number
[Filtered paired response]
[Hook] Filtered 2 violated event(s)
--- Session Events (count=2) ---
[0] user: Hello, my name is Alice
[1] assistant: ...
=== Step 3: Normal request after violation ===
[Filtered violation: ...] tag=pirated serial number
[Filtered paired response]
[Hook] Filtered 2 violated event(s)
User: What is my name?
Assistant: ...
--- Session Events (count=4) ---
[0] user: Hello, my name is Alice
[1] assistant: ...
[2] user: What is my name?
[3] assistant: Your name is Alice.
=== Step 4: Another normal request ===
... (similar filtered logs)
--- Session Events (count=6) ---
[4] user: Tell me a short joke
[5] assistant: I told my wife she was drawing her eyebrows too ...
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.

Security News
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.