feat(cache): implement hashed API key storage and retrieval #632

Merged
argoyle merged 1 commits from feat/cache-hashed-api-key-storage into main 2025-11-20 21:30:50 +00:00
argoyle commented 2025-11-20 21:11:39 +00:00 (Migrated from gitlab.com)

Adds a new hashed key storage mechanism for API keys in the cache.
Replaces direct mapping to API keys with composite keys based on
organizationId and name. Implements searching of API keys using
hash comparisons for improved security. Updates related tests to
ensure correct functionality and validate the hashing. Also,
adds support for a new dependency golang.org/x/crypto.

Adds a new hashed key storage mechanism for API keys in the cache. Replaces direct mapping to API keys with composite keys based on organizationId and name. Implements searching of API keys using hash comparisons for improved security. Updates related tests to ensure correct functionality and validate the hashing. Also, adds support for a new dependency `golang.org/x/crypto`.
argoyle (Migrated from gitlab.com) scheduled this pull request to auto merge when all checks succeed 2025-11-20 21:11:46 +00:00
argoyle commented 2025-11-20 21:28:33 +00:00 (Migrated from gitlab.com)

Codecov Report

Patch coverage is 47.05882% with 36 lines in your changes missing coverage. Please review.
Project coverage is 8.83%. Comparing base (1e2236d) to head (4468903).

Files with missing lines Patch % Lines
cache/cache.go 0.00% 22 Missing ⚠️
hash/hash.go 80.64% 4 Missing and 2 partials ⚠️
domain/commands.go 54.54% 4 Missing and 1 partial ⚠️
cmd/service/service.go 0.00% 2 Missing ⚠️
graph/converter.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #628      +/-   ##
========================================
+ Coverage   7.74%   8.83%   +1.08%     
========================================
  Files         44      44              
  Lines       2299    2344      +45     
========================================
+ Hits         178     207      +29     
- Misses      2116    2129      +13     
- Partials       5       8       +3     

View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
## [Codecov](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware) Report :x: Patch coverage is `47.05882%` with `36 lines` in your changes missing coverage. Please review. :white_check_mark: Project coverage is 8.83%. Comparing base ([`1e2236d`](https://app.codecov.io/gl/unboundsoftware/schemas/commit/1e2236dc9e498913662c6a816d9885ce0a6400ee?dropdown=coverage&el=desc&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware)) to head ([`4468903`](https://app.codecov.io/gl/unboundsoftware/schemas/commit/446890353542f0cd46f26f54e2f462c5760a5183?dropdown=coverage&el=desc&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware)). | [Files with missing lines](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware) | Patch % | Lines | |---|---|---| | [cache/cache.go](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&filepath=cache%2Fcache.go&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware#diff-Y2FjaGUvY2FjaGUuZ28=) | 0.00% | [22 Missing :warning: ](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware) | | [hash/hash.go](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&filepath=hash%2Fhash.go&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware#diff-aGFzaC9oYXNoLmdv) | 80.64% | [4 Missing and 2 partials :warning: ](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware) | | [domain/commands.go](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&filepath=domain%2Fcommands.go&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware#diff-ZG9tYWluL2NvbW1hbmRzLmdv) | 54.54% | [4 Missing and 1 partial :warning: ](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware) | | [cmd/service/service.go](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&filepath=cmd%2Fservice%2Fservice.go&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware#diff-Y21kL3NlcnZpY2Uvc2VydmljZS5nbw==) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware) | | [graph/converter.go](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&filepath=graph%2Fconverter.go&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware#diff-Z3JhcGgvY29udmVydGVyLmdv) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?src=pr&el=tree&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware) | <details><summary>Additional details and impacted files</summary> ```diff @@ Coverage Diff @@ ## main #628 +/- ## ======================================== + Coverage 7.74% 8.83% +1.08% ======================================== Files 44 44 Lines 2299 2344 +45 ======================================== + Hits 178 207 +29 - Misses 2116 2129 +13 - Partials 5 8 +3 ``` </details> [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gl/unboundsoftware/schemas/pull/628?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=gitlab&utm_content=comment&utm_campaign=pr+comments&utm_term=unboundsoftware). :loudspeaker: Have feedback on the report? [Share it here](https://gitlab.com/codecov-open-source/codecov-user-feedback/-/issues/4). <details><summary> :rocket: New features to boost your workflow: </summary> - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems. </details>
argoyle commented 2025-11-20 21:30:51 +00:00 (Migrated from gitlab.com)

mentioned in commit a1b0f49aab

mentioned in commit a1b0f49aaba3ab174fbbd662e86c1a2a3f8d6ff5
argoyle (Migrated from gitlab.com) merged commit a1b0f49aab into main 2025-11-20 21:30:51 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unboundsoftware/schemas#632