Skip to content

fix: raise TypeError for non-dict config in BaseDetector#276

Open
deveshreddyp wants to merge 1 commit intoGenAI-Security-Project:mainfrom
deveshreddyp:fix/issue-117-basedetector
Open

fix: raise TypeError for non-dict config in BaseDetector#276
deveshreddyp wants to merge 1 commit intoGenAI-Security-Project:mainfrom
deveshreddyp:fix/issue-117-basedetector

Conversation

@deveshreddyp
Copy link

Description

Closes #117

Added type validation in the BaseDetector constructor to explicitly raise a TypeError when a non-dictionary config is passed. This prevents downstream AttributeError crashes and ensures cleaner error handling in the detection pipeline.

cc @steadhac - Fixed per the "Must Fix" bugs list!

(Note: The detector-specific pytest checks are all passing green locally. There are a few unrelated environment failures on main like the Windows path separator in test_sqlite_url, but the core detection suite is clean). Let me know if you need any adjustments!

@stealthwhizz
Copy link
Contributor

stealthwhizz commented Mar 21, 2026

@saikishu @steadhac Hey, just a heads up - PR #261 already fixes #117 along with #131 and #130.
It also adds the TypeError catch in registry.py so the registry handles the new exception, and includes unit tests for both the base detector and tool_call detector.

This PR might be a duplicate. Worth checking #261 before merging this one.

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.

Bug_20_MUST_FIX: Test Case DET-THR-NEG-001 "crashes app" BaseDetector accepts non-dict config, raises AttributeError instead of TypeError

2 participants