Skip to content

Feat/sanitize#39

Merged
hyp3rd merged 9 commits intomainfrom
feat/sanitize
Jan 11, 2026
Merged

Feat/sanitize#39
hyp3rd merged 9 commits intomainfrom
feat/sanitize

Conversation

@hyp3rd
Copy link
Owner

@hyp3rd hyp3rd commented Jan 11, 2026

No description provided.

Copilot AI and others added 8 commits January 11, 2026 14:09
Co-authored-by: hyp3rd <62474964+hyp3rd@users.noreply.github.com>
Co-authored-by: hyp3rd <62474964+hyp3rd@users.noreply.github.com>
…rcase

Co-authored-by: hyp3rd <62474964+hyp3rd@users.noreply.github.com>
Add comprehensive edge case tests for NoSQL operator detection
Add test coverage for NoSQL detector max length validation
Copilot AI review requested due to automatic review settings January 11, 2026 19:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a new test case for the NoSQL injection detector's maximum length validation feature. The test verifies that inputs exceeding the configured maximum length are properly rejected with the appropriate error.

Changes:

  • Added TestNoSQLInjectionDetectorMaxLength test function to validate the max length configuration option

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 39 to 49
func TestNoSQLInjectionDetectorMaxLength(t *testing.T) {
detector, err := NewNoSQLInjectionDetector(WithNoSQLDetectMaxLength(1))
if err != nil {
t.Fatalf("expected detector, got %v", err)
}

err = detector.Detect("ab")
if err != ErrNoSQLInputTooLong {
t.Fatalf("expected ErrNoSQLInputTooLong, got %v", err)
}
}
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test should include a boundary case where the input length equals the maxLength to verify that inputs at the exact limit are accepted. Consider adding a test case like detector.Detect("a") which should return nil since the length is exactly 1 and the maxLength is 1. This would ensure the boundary condition (len(input) > d.opts.maxLength) works correctly.

Copilot uses AI. Check for mistakes.
- Enable golangci-lint testpackage in .golangci.yaml to encourage black-box tests.
- Switch assertions to use errors.Is across validators (filename, html, markdown, nosql, sql, email, url) for accurate error matching.
- internal/io/write_fuzz_test.go: group boolean params in fuzz signature and add explicit err checks around os.WriteFile/os.Symlink with clearer failure messages; add t.Cleanup and minor formatting fixes.
- Update imports to include errors where needed; small formatting/blank-line cleanups.

No production code changes; improves test reliability and lint coverage.
@hyp3rd hyp3rd merged commit 614e63d into main Jan 11, 2026
13 checks passed
@hyp3rd hyp3rd deleted the feat/sanitize branch January 11, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants