fix: export ToolSanitizationRule and add tier2Fields option#15
Conversation
Allows consumers to properly type custom toolRules passed via PromptDefenseOptions.config without importing from internal modules. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR exports the ToolSanitizationRule type from the package's public API (src/index.ts), so that consumers who pass custom toolRules via PromptDefenseOptions.config can now type them using import type { ToolSanitizationRule } from '@stackone/defender' without reaching into internal modules.
Changes:
ToolSanitizationRuleis added to the public re-export list insrc/index.ts
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
LGTM — straightforward type-only re-export, no runtime changes.
Extended reasoning...
Overview
This PR adds a single type export (ToolSanitizationRule) to src/index.ts. The type is already defined in src/types.ts and used extensively throughout the internal codebase (sanitizer, field-detection, config). This change simply makes it available to external consumers of the package.
Security risks
None. This is a type-only export — it has zero runtime impact. No new code paths, no behavioral changes, no new dependencies.
Level of scrutiny
Minimal scrutiny warranted. This is a one-line change adding a type re-export to the public barrel file. The type already exists and is stable. The change follows the exact same pattern as the existing RiskLevel and Tier1Result exports on the same line.
Other factors
No outstanding reviewer comments. No CODEOWNERS concerns. The bug hunting system found no issues. The change is self-contained and mechanical.
|
Superseded by PR from fix/tier2-fields-and-exports which includes this change plus tier2Fields support. |
Summary
ToolSanitizationRulefrom the package's public APItoolRulesviaPromptDefenseOptions.configcan now properly type them without reaching into internal modulesTest plan
import type { ToolSanitizationRule } from '@stackone/defender'🤖 Generated with Claude Code
Summary by cubic
Exported
ToolSanitizationRulefrom the public API so consumers can type customtoolRulesinPromptDefenseOptions.configwithout importing internal modules. You can nowimport type { ToolSanitizationRule } from '@stackone/defender'.Written for commit 9ad0318. Summary will update on new commits.