Skip to content

zn-gate 1.13.1

Latest

Choose a tag to compare

@github-actions github-actions released this 20 Oct 17:09
· 20 commits to main since this release

zn-gate 1.13.1 is a security patch for the Python package. The LangChain callback handler now stops a run when it blocks a tool call, and the new guard_langchain_tool wrapper checks tool arguments and masks secrets in tool output before the model reads them. Upgrade with pip install -U zn-gate. The npm package has no code changes in this release.

Changed

  • Upgrade note, Python, LangChain: ZnGuardCallbackHandler(on_block="return") now raises ValueError. It let blocked calls through, like "ignore". Use guard_langchain_tool(tool, on_block="return") to give the model a block message instead.
  • Upgrade note, Python, LangChain: with mask_secrets=True (default) a secret in a tool output now stops the run with GuardBlockError. If you wrap your tools with guard_langchain_tool, create the handler with mask_secrets=False so the wrapper hides the secret and the run goes on.

Fixed

  • Python, LlamaIndex: ZnLlamaGuard(on_block="return") let a blocked query through, like "ignore". check_query and on_query_start now return a short block message, or the new fallback, in place of the query. sanitize_response now also hides secrets in a LlamaIndex Response object, not only in text.

Security

  • Python, LangChain: ZnGuardCallbackHandler now stops the run when it blocks something (GHSA-q7p5-7x6r-fm4r). Before, LangChain caught the GuardBlockError raised inside the callback and only logged a warning, so a blocked tool call still ran and a blocked prompt or tool output still reached the model. The handler now sets raise_error = True, which tells LangChain to let the error through.
  • Python, LangChain: the handler could not hide secrets or replace an injected tool output, because LangChain ignores what a callback returns, so the secret still reached the model. With mask_secrets=True (default) a tool output that contains a secret now stops the run. The new guard_langchain_tool(tool) wraps a LangChain tool: it checks the arguments before the tool runs and the output before the model reads it, and hides secrets in that output.

How to verify these files: docs/verify-release.md