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

WIP: 🔒️ Hash API Keys secret #7085

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

giancarloromeo
Copy link
Contributor

@giancarloromeo giancarloromeo commented Jan 24, 2025

What do these changes do?

We need to store a hashed version of the api_key, I would suggest using bcrypt library.

When storing hashed keys:

  • Generate a random API key and hash it using bcrypt.
  • Store the hashed key in the database.

When verifying:

  • Retrieve the hashed key from the database.
  • Use the corresponding library's verify function to check the provided API key against the hash.

All existing API keys already stored in the DB must be hashed & updated.

Related issue/s

How to test

Dev-ops checklist

@giancarloromeo giancarloromeo self-assigned this Jan 24, 2025
@giancarloromeo giancarloromeo added this to the Singularity milestone Jan 24, 2025
@giancarloromeo giancarloromeo added t:maintenance Some planned maintenance work security Pull requests that address a security vulnerability a:webserver issue related to the webserver service labels Jan 24, 2025
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.30%. Comparing base (69cf7cb) to head (b85facd).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7085      +/-   ##
==========================================
- Coverage   87.15%   83.30%   -3.85%     
==========================================
  Files        1634      637     -997     
  Lines       64264    31354   -32910     
  Branches     2051      262    -1789     
==========================================
- Hits        56010    26120   -29890     
+ Misses       7917     5174    -2743     
+ Partials      337       60     -277     
Flag Coverage Δ
integrationtests 57.62% <ø> (-6.06%) ⬇️
unittests 84.86% <ø> (-0.65%) ⬇️
Components Coverage Δ
api ∅ <ø> (∅)
pkg_aws_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library ∅ <ø> (∅)
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration ∅ <ø> (∅)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 77.37% <ø> (-8.02%) ⬇️
agent ∅ <ø> (∅)
api_server ∅ <ø> (∅)
autoscaling ∅ <ø> (∅)
catalog ∅ <ø> (∅)
clusters_keeper ∅ <ø> (∅)
dask_sidecar ∅ <ø> (∅)
datcore_adapter ∅ <ø> (∅)
director ∅ <ø> (∅)
director_v2 78.62% <ø> (-12.65%) ⬇️
dynamic_scheduler ∅ <ø> (∅)
dynamic_sidecar 88.76% <ø> (-1.00%) ⬇️
efs_guardian ∅ <ø> (∅)
invitations ∅ <ø> (∅)
osparc_gateway_server ∅ <ø> (∅)
payments ∅ <ø> (∅)
resource_usage_tracker ∅ <ø> (∅)
storage ∅ <ø> (∅)
webclient ∅ <ø> (∅)
webserver 84.60% <ø> (+0.05%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69cf7cb...b85facd. Read the comment docs.

@giancarloromeo giancarloromeo changed the title 🔒️ Hash API Keys secret WIP: 🔒️ Hash API Keys secret Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:webserver issue related to the webserver service security Pull requests that address a security vulnerability t:maintenance Some planned maintenance work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

api key: upgrade encryption scheme of key-secret in db
1 participant