- 
                Notifications
    
You must be signed in to change notification settings  - Fork 32
 
🔒️ Enhance security of API keys 🗃️ #7085
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
      
      
            giancarloromeo
  merged 76 commits into
  ITISFoundation:master
from
giancarloromeo:is6880/hash-api-key-secret
  
      
      
   
  Apr 23, 2025 
      
    
  
     Merged
                    Changes from 27 commits
      Commits
    
    
            Show all changes
          
          
            76 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      b85facd
              
                add bcrypt req
              
              
                giancarloromeo e824932
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo db3c5f3
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo 2502d80
              
                remove bcrypt dependency
              
              
                giancarloromeo 3b69cee
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo d96ea56
              
                unify create api key
              
              
                giancarloromeo 181540b
              
                remove unused
              
              
                giancarloromeo 62e0fb7
              
                check hashed secret
              
              
                giancarloromeo 41acdaf
              
                Merge remote-tracking branch 'upstream/master' into is6880/hash-api-k…
              
              
                giancarloromeo 612f645
              
                fix hashed secret check
              
              
                giancarloromeo 90cfa71
              
                refactoring
              
              
                giancarloromeo 08b9d59
              
                fix mock
              
              
                giancarloromeo 32e9e89
              
                fix api_key faker
              
              
                giancarloromeo 0395f71
              
                fix faker
              
              
                giancarloromeo 89f48be
              
                fix mocker
              
              
                giancarloromeo 2cb13ce
              
                refactor test
              
              
                giancarloromeo 8ca8936
              
                add index
              
              
                giancarloromeo c1ed671
              
                update query
              
              
                giancarloromeo 66eb011
              
                update query
              
              
                giancarloromeo 0780f07
              
                update query
              
              
                giancarloromeo 28ff3c3
              
                add conflict check
              
              
                giancarloromeo a4eff3e
              
                add migration script
              
              
                giancarloromeo 6b77a6a
              
                add existing secrets hash script
              
              
                giancarloromeo fd94dcc
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo 6f5b906
              
                add comment
              
              
                giancarloromeo f673127
              
                Merge branch 'is6880/hash-api-key-secret' of github.com:giancarlorome…
              
              
                giancarloromeo d761450
              
                Merge branch 'ITISFoundation:master' into is6880/hash-api-key-secret
              
              
                giancarloromeo a0f8260
              
                add key deletion
              
              
                giancarloromeo 9f4cf34
              
                rename
              
              
                giancarloromeo 9f95970
              
                fix import
              
              
                giancarloromeo f470c49
              
                update comment
              
              
                giancarloromeo 84894ad
              
                fix endpoint
              
              
                giancarloromeo a42e986
              
                fix
              
              
                giancarloromeo e13969c
              
                always raise on conflict
              
              
                giancarloromeo 8a830ab
              
                fix tests
              
              
                giancarloromeo 6bde4b6
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo c3264b6
              
                update script deps
              
              
                giancarloromeo 541342e
              
                fix revises
              
              
                giancarloromeo 4b47f53
              
                fix test
              
              
                giancarloromeo 12e0c7b
              
                use model_json_schema
              
              
                giancarloromeo 00619ea
              
                continue
              
              
                giancarloromeo 4c70476
              
                Merge remote-tracking branch 'upstream/master' into is6880/hash-api-k…
              
              
                giancarloromeo 1c9df86
              
                fix script
              
              
                giancarloromeo 62f0faf
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo 8f6bb8b
              
                typecheck
              
              
                giancarloromeo 3d39b4c
              
                remove deps
              
              
                giancarloromeo d38c8a5
              
                fix delete by key
              
              
                giancarloromeo 470d6a8
              
                add product name check
              
              
                giancarloromeo 5186120
              
                fix create
              
              
                giancarloromeo 4a554d5
              
                Merge remote-tracking branch 'upstream/master' into is6880/hash-api-k…
              
              
                giancarloromeo 4cd7bdd
              
                fix repo
              
              
                giancarloromeo 5dc3b4a
              
                Merge remote-tracking branch 'upstream/master' into is6880/hash-api-k…
              
              
                giancarloromeo 3793ff2
              
                update script
              
              
                giancarloromeo fe5d750
              
                fix params
              
              
                giancarloromeo 8ff8a1b
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo d3f5dd3
              
                update script
              
              
                giancarloromeo bdb1264
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo bda3db2
              
                fix delete method
              
              
                giancarloromeo 036bbcf
              
                Update services/api-server/tests/unit/_with_db/conftest.py
              
              
                giancarloromeo 3543d71
              
                refactor
              
              
                giancarloromeo 1c8e2eb
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo 580ad26
              
                Update packages/postgres-database/src/simcore_postgres_database/migra…
              
              
                giancarloromeo efd20f7
              
                Merge remote-tracking branch 'upstream/master' into is6880/hash-api-k…
              
              
                giancarloromeo e071e87
              
                Merge branch 'is6880/hash-api-key-secret' of github.com:giancarlorome…
              
              
                giancarloromeo c4a54b9
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo d901074
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo f04db05
              
                add doc
              
              
                giancarloromeo 5133ccf
              
                fix import
              
              
                giancarloromeo 605a4d7
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo d1da32a
              
                rename
              
              
                giancarloromeo f834310
              
                Merge branch 'master' into is6880/hash-api-key-secret
              
              
                giancarloromeo b338774
              
                Merge remote-tracking branch 'upstream/master' into is6880/hash-api-k…
              
              
                giancarloromeo 24afffb
              
                Merge branch 'is6880/hash-api-key-secret' of github.com:giancarlorome…
              
              
                giancarloromeo f662580
              
                remove cast
              
              
                giancarloromeo 94a7bad
              
                update script
              
              
                giancarloromeo ef6493d
              
                typecheck
              
              
                giancarloromeo File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
  
    
      
          
            28 changes: 28 additions & 0 deletions
          
          28 
        
  ...simcore_postgres_database/migration/versions/742123f0933a_hash_exising_api_secret_data.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| """hash exising api_secret data | ||
| Revision ID: 742123f0933a | ||
| Revises: b0c988e3f348 | ||
| Create Date: 2025-03-13 09:39:43.895529+00:00 | ||
| """ | ||
| 
     | 
||
| from alembic import op | ||
| 
     | 
||
| # revision identifiers, used by Alembic. | ||
| revision = "742123f0933a" | ||
| down_revision = "b0c988e3f348" | ||
| branch_labels = None | ||
| depends_on = None | ||
| 
     | 
||
| 
     | 
||
| def upgrade(): | ||
| op.execute( | ||
| """ | ||
| UPDATE api_keys | ||
| SET api_secret = crypt(api_secret, gen_salt('bf', 10)) | ||
| """ | ||
| ) | ||
| 
     | 
||
| 
     | 
||
| def downgrade(): | ||
| pass | ||
        
          
  
    
      
          
            23 changes: 23 additions & 0 deletions
          
          23 
        
  .../simcore_postgres_database/migration/versions/b0c988e3f348_add_index_to_api_key_column.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| """add index to api_key column | ||
| 
     | 
||
| Revision ID: b0c988e3f348 | ||
| Revises: 381336fa8001 | ||
| Create Date: 2025-03-13 08:53:05.722855+00:00 | ||
| 
     | 
||
| """ | ||
| 
     | 
||
| from alembic import op | ||
| 
     | 
||
| # revision identifiers, used by Alembic. | ||
| revision = "b0c988e3f348" | ||
| down_revision = "381336fa8001" | ||
| branch_labels = None | ||
| depends_on = None | ||
| 
     | 
||
| 
     | 
||
| def upgrade(): | ||
| op.create_index(op.f("ix_api_keys_api_key"), "api_keys", ["api_key"], unique=False) | ||
| 
     | 
||
| 
     | 
||
| def downgrade(): | ||
| op.drop_index(op.f("ix_api_keys_api_key"), table_name="api_keys") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
                              
      
                  giancarloromeo marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
            
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.