fix(sanitize): prevent looksLikePromptInjection from being tree-shaken#191
Open
kbob3687-hub wants to merge 1 commit into
Open
fix(sanitize): prevent looksLikePromptInjection from being tree-shaken#191kbob3687-hub wants to merge 1 commit into
kbob3687-hub wants to merge 1 commit into
Conversation
Signed-off-by: xiaosuantongkk <kbob3687@gmail.com>
Collaborator
|
Good catch on the tree-shaking issue! The build-time integration test is a nice addition to prevent regression. We'll review it soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description | 描述
Uncommented line 153 in
src/utils/sanitize.tsto re-enable thelooksLikePromptInjectioncall, restoring prompt injection detection.Verified that the bundler (
tsdown) properly preserves the function inside the build artifact (dist/index.mjs).Added a build-time integration test
src/utils/sanitize-tree-shaking.test.tsto assert that the function is not tree-shaken out of the final package.取消了
src/utils/sanitize.ts第 153 行的注释,恢复对looksLikePromptInjection的正常调用,修复了原本存在的 prompt 注入检测失效 bug。确认在重新编译打包后,产物
dist/index.mjs中已经正确保留并包含了该函数。新增了构建验证测试
src/utils/sanitize-tree-shaking.test.ts,防止后续因打包工具 Tree-shaking 机制导致此函数再次丢失。Related Issue | 关联 Issue
Fix #158
Change Type | 修改类型