Skip to content

fix(oval): add pseudo server type in NewOVALClient #2254

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

Merged
merged 1 commit into from
Jul 1, 2025

Conversation

MaineK00n
Copy link
Collaborator

If this Pull Request is work in progress, Add a prefix of “[WIP]” in the title.

What did you implement:

Fixes #2253

In this commit, ServerTypePseudo was removed from NewOVALClient:
9c8fd04#diff-c38ba8400657a4caf68a8813319549c02e254e9ccb12099f6d3dba39bbf81ddeL688-L689

As a result, an error occurred when opening the database before starting the server, because the family used at that time was ServerTypePseudo:
28e3ff5#diff-ba4491525d7251d0ed3fa7f42df81f3150fa73551b7b4923bd45b14bd283e299R274

Therefore, this PR adds ServerTypePseudo back to NewOVALClient.

Note that this error does not occur during reporting because pseudo servers skip OVAL processing:

vuls/detector/detector.go

Lines 380 to 382 in c40e7e8

case constant.FreeBSD, constant.MacOSX, constant.MacOSXServer, constant.MacOS, constant.MacOSServer, constant.ServerTypePseudo:
logging.Log.Infof("%s type. Skip OVAL, gost and vuls2 detection", r.Family)
return false

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

before

$ vuls server
[Jul  1 10:55:41]  INFO [localhost] vuls-0.33.1-c40e7e8eb0049076bdded96a5d8b045428ef04cb-2025-06-25T04:33:59Z
[Jul  1 10:55:41]  INFO [localhost] Validating config...
[Jul  1 10:55:41]  INFO [localhost] cveDict.type=sqlite3, cveDict.url=, cveDict.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/cve.sqlite3
[Jul  1 10:55:41]  INFO [localhost] ovalDict.type=sqlite3, ovalDict.url=, ovalDict.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/goval-dictionary/oval.sqlite3
[Jul  1 10:55:41]  INFO [localhost] gost.type=sqlite3, gost.url=, gost.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/gost.sqlite3
[Jul  1 10:55:41]  INFO [localhost] exploit.type=sqlite3, exploit.url=, exploit.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/go-exploitdb.sqlite3
[Jul  1 10:55:41]  INFO [localhost] metasploit.type=sqlite3, metasploit.url=, metasploit.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/go-msfdb.sqlite3
[Jul  1 10:55:41]  INFO [localhost] kevuln.type=sqlite3, kevuln.url=, kevuln.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/go-kev.sqlite3
[Jul  1 10:55:41]  INFO [localhost] cti.type=sqlite3, cti.url=, cti.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/go-cti.sqlite3
[Jul  1 10:55:41]  INFO [localhost] Validating DBs...
[Jul  1 10:55:41] ERROR [localhost] Failed to validate DBs. err: Failed to new OVAL client. err:
    github.com/future-architect/vuls/detector.ValidateDBs
        github.com/future-architect/vuls/detector/util.go:276
  - OVAL for pseudo is not implemented yet:
    github.com/future-architect/vuls/oval.NewOVALClient
        github.com/future-architect/vuls/oval/util.go:536

after

$ vuls server
[Jul  1 10:56:24]  INFO [localhost] vuls-v0.33.1-build-20250701_105326_64dffcf
[Jul  1 10:56:24]  INFO [localhost] Validating config...
[Jul  1 10:56:24]  INFO [localhost] cveDict.type=sqlite3, cveDict.url=, cveDict.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/cve.sqlite3
[Jul  1 10:56:24]  INFO [localhost] ovalDict.type=sqlite3, ovalDict.url=, ovalDict.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/goval-dictionary/oval.sqlite3
[Jul  1 10:56:24]  INFO [localhost] gost.type=sqlite3, gost.url=, gost.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/gost.sqlite3
[Jul  1 10:56:24]  INFO [localhost] exploit.type=sqlite3, exploit.url=, exploit.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/go-exploitdb.sqlite3
[Jul  1 10:56:24]  INFO [localhost] metasploit.type=sqlite3, metasploit.url=, metasploit.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/go-msfdb.sqlite3
[Jul  1 10:56:24]  INFO [localhost] kevuln.type=sqlite3, kevuln.url=, kevuln.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/go-kev.sqlite3
[Jul  1 10:56:24]  INFO [localhost] cti.type=sqlite3, cti.url=, cti.SQLite3Path=/home/mainek00n/github/github.com/MaineK00n/vuls/go-cti.sqlite3
[Jul  1 10:56:24]  INFO [localhost] Validating DBs...
[Jul  1 10:56:24]  INFO [localhost] Listening on localhost:5515

$ curl -s http://localhost:5515/health
ok

Checklist:

You don't have to satisfy all of the following.

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

@MaineK00n MaineK00n requested a review from shino July 1, 2025 02:04
@MaineK00n MaineK00n self-assigned this Jul 1, 2025
Copy link
Collaborator

@shino shino left a comment

Choose a reason for hiding this comment

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

🍶

@MaineK00n MaineK00n merged commit ac2257b into master Jul 1, 2025
7 checks passed
@MaineK00n MaineK00n deleted the MaineK00n/oval-pseudo branch July 1, 2025 02:21
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.

Cannot start vuls server on Ubuntu22 - "Failed to new OVAL client"
2 participants