Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors when package version "0" or "9999" is passed #54

Closed
mrl5 opened this issue Jul 23, 2022 · 2 comments · Fixed by #56
Closed

errors when package version "0" or "9999" is passed #54

mrl5 opened this issue Jul 23, 2022 · 2 comments · Fixed by #56
Labels
bug Something isn't working

Comments

@mrl5
Copy link
Owner

mrl5 commented Jul 23, 2022

affected commands

vulner scan and vulner cpe

precondition

$ vulner sync

steps to reproduce

$ vulner cpe '[{"name":"ethertypes","version":"0"}]'

or

$ vulner cpe '[{"name":"ethertypes","version":"9999"}]'

expected result

{} is returned

actual result

stdout flooded with feed contents (feed that was downloaded in precondidtion step)

additional info

with vulner scan it causes HTTP 400 errors flood:

[2022-07-23T13:08:39Z WARN  vulner::command::scan] found CVEs for net-misc/ethertypes-0 ...
[2022-07-23T13:09:28Z ERROR vulner::command::scan] net-misc/ethertypes-0: HTTP status client error (400 Bad Request) for url (https://services.nvd.nist.gov/rest/json/cves/1.0?cpeMatchString=cpe:2.3:a:gdprinfo:cookie_notice_\\&_consent_banner_for_gdpr_\\&_ccpa_compliance:1.2.0:*:*:*:*:wordpress:*:*&apiKey=REDACTED)
[2022-07-23T13:10:12Z ERROR vulner::command::scan] net-misc/ethertypes-0: HTTP status client error (400 Bad Request) for url (https://services.nvd.nist.gov/rest/json/cves/1.0?cpeMatchString=cpe:2.3:a:smartypantsplugins:sp_project_\\&_document_manager:2.6.4.5:*:*:*:*:wordpress:*:*&apiKey=REDACTED)
[2022-07-23T13:10:36Z ERROR vulner::command::scan] net-misc/ethertypes-0: HTTP status client error (400 Bad Request) for url (https://services.nvd.nist.gov/rest/json/cves/1.0?cpeMatchString=cpe:2.3:a:joomla:joomla\\!:3.9.4:rc1:*:*:*:*:*:*&apiKey=REDACTED)
[2022-07-23T13:11:15Z ERROR vulner::command::scan] net-misc/ethertypes-0: HTTP status client error (400 Bad Request) for url (https://services.nvd.nist.gov/rest/json/cves/1.0?cpeMatchString=cpe:2.3:a:acyba:acymailing:4.2.0:*:*:*:*:joomla\\!:*:*&apiKey=REDACTED)
[2022-07-23T13:11:20Z ERROR vulner::command::scan] net-misc/ethertypes-0: HTTP status client error (400 Bad Request) for url (https://services.nvd.nist.gov/rest/json/cves/1.0?cpeMatchString=cpe:2.3:o:cisco:aironet_access_point_firmware:8.5\\(131.0\\):*:*:*:*:*:*:*&apiKey=REDACTED)
@mrl5 mrl5 added the bug Something isn't working label Jul 23, 2022
@mrl5 mrl5 changed the title errors when package version"0" or "9999" errors when package version"0" or "9999" is passed Jul 23, 2022
@mrl5 mrl5 changed the title errors when package version"0" or "9999" is passed errors when package version "0" or "9999" is passed Jul 23, 2022
@mrl5
Copy link
Owner Author

mrl5 commented Jul 23, 2022

unfortunately this bug has additional impact, that is a subject of #55

@mrl5
Copy link
Owner Author

mrl5 commented Jul 23, 2022

rootcause

in

def run(payload: list) -> str:

assert run([{"name":"ethertypes","version":"0"}]) == ''

this empty string then propagates here:

pub fn grep(pattern: String, feed: &Path) -> Result<HashSet<String>, Box<dyn Error>> {
let matcher = RegexMatcher::new_line_matcher(&pattern)?;

so that later every line in feed is matched ...

the best part is that it's expected behavior of ripgrep (according to this discussion: BurntSushi/ripgrep#2091)

and the same applies here:

let re = Regex::new(re_pattern).unwrap();

for https://docs.rs/regex/latest/regex/struct.Regex.html - I wonder if it's expected behavior: rust-lang/regex#896

@mrl5 mrl5 closed this as completed in #56 Jul 23, 2022
@mrl5 mrl5 closed this as completed in cff2ed2 Jul 23, 2022
mrl5 added a commit that referenced this issue Jul 23, 2022
fix(cpe-tag): errors when package version "0" or "9999" [#54]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant