Skip to content

Refuse to update old databases#61

Open
Mab879 wants to merge 1 commit intoComplianceAsCode:mainfrom
Mab879:block_old_dbs
Open

Refuse to update old databases#61
Mab879 wants to merge 1 commit intoComplianceAsCode:mainfrom
Mab879:block_old_dbs

Conversation

@Mab879
Copy link
Copy Markdown
Member

@Mab879 Mab879 commented Jan 22, 2026

Very old databases can causes 1000+ changes (ie. HTTP request) due getting every CVE listed in changes.csv getting updated. For very old database it is better to download the latest new archive.

if !lastUpdate.IsZero() {
fmt.Printf("Last update: %s (%s ago)\n", lastUpdate.Format(time.RFC1123), time.Since(lastUpdate).Round(time.Second))
if time.Since(lastUpdate) > (24 * time.Hour * 30) {
return fmt.Errorf("Database more than 30 days old, refusing to update. Delete the database and run this commmand again.")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("Database more than 30 days old, refusing to update. Delete the database and run this commmand again.")
return fmt.Errorf("Database more than 30 days old, refusing to update. Delete the database and run this command again.")

if !lastUpdate.IsZero() {
fmt.Printf("Last update: %s (%s ago)\n", lastUpdate.Format(time.RFC1123), time.Since(lastUpdate).Round(time.Second))
if time.Since(lastUpdate) > (24 * time.Hour * 30) {
return fmt.Errorf("Database more than 30 days old, refusing to update. Delete the database and run this commmand again.")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we print out the path of the database so that the user knows what to delete?


if !lastUpdate.IsZero() {
fmt.Printf("Last update: %s (%s ago)\n", lastUpdate.Format(time.RFC1123), time.Since(lastUpdate).Round(time.Second))
if time.Since(lastUpdate) > (24 * time.Hour * 30) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we make this some kind of constant so that it is not hardcoded in the middle of the code?

Copy link
Copy Markdown
Collaborator

@vojtapolasek vojtapolasek left a comment

Choose a reason for hiding this comment

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

In general I agree with the implementation and I acknowledge the reason; downloading many updates causes many small HTTP requests -> inefficiency -> actually higher amount of transfered data because if the user would download full database, it would be compressed.
I just have one thing apart from comments; could we put there some kind of command line parameter / env variable to override this behavior? I think a user should be given chance to go with the old way if they really wish so.

Very old databases can cause 1000+ http requests due getting every CVE.

For very old database it is better to download the latest new archive.
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.

2 participants