Repository navigation
fix(security): remove the no-op input sanitization step - #191
Open
rahul05ranjan wants to merge 1 commit into
Open
rahul05ranjan wants to merge 1 commit into
rahul05ranjan wants to merge 1 commit into
Conversation
The sanitizeInput result was computed and then discarded: the request always continued with the original input, while the log line claimed 'Input was sanitized'. Drop the dead step and its misleading warning. The allowlist, per-command Joi schemas and blocked-pattern rules remain the real validation pipeline; wiring validator.escape in instead would corrupt legitimate code text (HTML entity escaping) before the prompt is built. sanitizeInput stays on the class for API compatibility. Fixes #190 Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
This branch has not been deployed
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.
Fixes #190
Root cause
The final step of
validateInputcomputedthis.sanitizeInput(input)and only used it for a comparison that triggered a misleadingInput was sanitizedwarning. The sanitized value was never returned or applied: every validated request continued with the original input, so the advertised sanitization did not exist. On top of being dead code, the warning also persisted the raworiginalinput (addressed independently for the other log calls in #189).Fix
Delete the dead block. The real validation pipeline — the command allowlist, per-command Joi schemas, and blocked-pattern rules — is unchanged and remains the decision point for whether input may reach the model. Deliberately not wiring the escaped value in:
validator.escapedoes HTML entity escaping, which would corrupt legitimate code text in prompts for commands likeexplain.sanitizeInputstays on the class for API compatibility.Net diff: 6 lines removed, 0 added.
Verification
grepacross__tests__/finds none); the repo's jest suite was not run here because dependencies are not installed in this environment — CI will cover it.