Skip to content

fix(fs): fix cache key generation to use UUID #8275

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 5 commits into from
Jan 23, 2025

Conversation

knqyf263
Copy link
Collaborator

@knqyf263 knqyf263 commented Jan 22, 2025

Overview

This PR modifies the cache key generation logic to use UUID with SHA256 hash. This ensures uniqueness and consistency in cache keys while maintaining a standardized SHA256 format.

Description

  • Modified calcCacheKey function to generate SHA256 hash from UUID
  • Updated test cases to use SetFakeUUID for consistent test results
  • Fixed test failures by ensuring each test case sets its own UUID

Related Issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).

The cache key generation logic has been modified to use UUID with SHA256 hash to ensure uniqueness and consistency in cache keys. This change helps prevent cache key collisions during parallel execution while maintaining a standardized SHA256 format.
@knqyf263 knqyf263 changed the title fix(cache): fix cache key generation to use UUID fix(fs): fix cache key generation to use UUID Jan 22, 2025
@knqyf263 knqyf263 self-assigned this Jan 22, 2025
@knqyf263 knqyf263 marked this pull request as ready for review January 22, 2025 17:33
Copy link
Contributor

@DmitriyLewen DmitriyLewen left a comment

Choose a reason for hiding this comment

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

LGTM.
Left small comment

This commit removes the fake UUID setup from the TestMixedConfigurationScan, TestJSONConfigScan, and TestYAMLConfigScan functions in fs_test.go.
@knqyf263 knqyf263 requested a review from DmitriyLewen January 23, 2025 07:01
@DmitriyLewen DmitriyLewen added this pull request to the merge queue Jan 23, 2025
Merged via the queue into aquasecurity:main with commit eafd810 Jan 23, 2025
12 checks passed
@knqyf263 knqyf263 deleted the fix/fs_cache_key branch January 24, 2025 11:24
RingoDev pushed a commit to RingoDev/trivy that referenced this pull request Feb 26, 2025
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.

fix(fs): improve cache key generation for parallel execution
3 participants