Repository navigation
fix(ctf): reject None for list-typed detector config keys - #594
Open
Prasad-desh wants to merge 4 commits into
Open
Prasad-desh wants to merge 4 commits into
Prasad-desh wants to merge 4 commits into
Conversation
Signed-off-by: Prasad Deshpande <officiallyprasad@gmail.com>
Signed-off-by: Prasad Deshpande <officiallyprasad@gmail.com>
Signed-off-by: Prasad Deshpande <officiallyprasad@gmail.com>
Signed-off-by: Prasad Deshpande <officiallyprasad@gmail.com>
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 #119
Fixes #120
_validate_configskipped the type check whenprohibited_keywordsorprohibited_indicatorswasNone, so a config carrying the key with an empty YAML value started up clean.check_eventthen reads the key back with.get(key, DEFAULT), which returnsNonerather than the default once the key is present, and raisesTypeErroron the first matching event. The detector is down for the rest of the process after that, so a prohibited vendor re-activated later goes unflagged.Checking for the key's presence instead, as both issues suggest.
gradual_status_flip.pyhas the same validator and the same read-back and no issue filed against it, so it is fixed here too. All three confirmed acceptingNonebefore the change:The three negative tests fail on
mainand pass with the fix.tests/unit/ctfis 42 passed, 1 skipped before and after.The tests are in a new file rather than
tests/unit/ctf/test_detectors.py, since #136 adds that file with its ownTestNegativeCasesand the two would collide. The test IDs the issues name are kept as they are so the mapping is still obvious.One thing left out on purpose:
invoice_threshold_bypass.pyandinvoice_trust_override.pyvalidatemax_invoice_amountandmin_amountthe same way and read them back with a default, so an explicitNonegets past startup there too. Happy to open a separate issue for those if that is useful.