Repository navigation
fix: validate YYYY-MM-DD date options on exception/miss/accept commands - #7
Merged
Merged
Conversation
secfoo exception create/update, miss create, and accept create/update all accept --expires-at / --discovered-at options documented as YYYY-MM-DD, but never validated the value -- a typo like "not-a-date" was silently accepted and stored as-is. That silently disables the feature rather than crashing: both storage/repository.py's expiry-aging-bucket calculation and web/top_findings.py's past-due detector parse this field with datetime.fromisoformat() wrapped in a bare `except ValueError: continue`, so a malformed date just gets skipped forever -- the record looks normal in `list`/`show`, but its expiry can never be tracked, flagged past-due, or surfaced on the dashboard again. Adds a shared _validate_date() Typer callback and wires it into the five affected options so a bad date is rejected immediately with a clear error instead of stored silently. Covered by 5 new tests (existing valid- date behavior is unchanged).
This was referenced Nov 26, 2026
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.
What does this change, and why?
secfoo exception create/update,miss create, andaccept create/updateall take--expires-at/--discovered-atoptions documented asYYYY-MM-DD, but never validated the value. A typo like--expires-at not-a-datewas silently accepted and stored as-is.This doesn't crash anything, which is exactly the problem: both
storage/repository.py's expiry-aging-bucket calculation andweb/top_findings.py's past-due detector parse this field withdatetime.fromisoformat()wrapped in a bareexcept ValueError: continue. So a malformed date is just silently skipped forever -- the record still looks normal inlist/show, but its expiry can never be tracked, flagged past-due, or surfaced on the dashboard again. For a risk-acceptance/exception tracking feature, that's a silent correctness bug, not a cosmetic one.Found while installing and exercising the CLI end-to-end (including a real
secfoo run --skill sast --agent claudescan against a sample vulnerable app, which worked correctly) as part of onboarding onto this repo.Fix
Adds a shared
_validate_date()Typer callback and wires it into the five affected options, so a bad date is rejected immediately with a clearInvalid value for '--expires-at': '...' is not a valid date -- expected YYYY-MM-DD.error instead of being stored silently. Existing valid-date behavior is unchanged.Testing
pytest testspasses (637 passed, including 5 new tests for this change)ruff check .-- no new findings beyond the project's existing pre-CI-gate backlogtest_cli_exception.py,test_cli_miss.py,test_cli_accept.py)