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

bugfix: langflow application losing store api-key on refresh page/backend #2960

Merged
merged 11 commits into from
Jul 25, 2024

Conversation

Cristhianzl
Copy link
Collaborator

@Cristhianzl Cristhianzl commented Jul 25, 2024

This pull request introduces significant improvements to the handling of the store API key in the backend:

API Key Management:

  • The responsibility of managing the store API key has been shifted to the backend.
  • Refactored the code responsible for creating and managing API keys.
  • Improved the process to ensure that the API key is correctly encoded in Base64 format.

#2458

…nd secret_key_path

refactor(login.py): refactor setting api_key cookie to use user's store_api_key
refactor(variable/service.py): re-encrypt stored value if secret_key changes to ensure validity
@Cristhianzl Cristhianzl self-assigned this Jul 25, 2024
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 25, 2024
@dosubot dosubot bot added the bug Something isn't working label Jul 25, 2024
Copy link
Contributor

Pull Request Validation Report

This comment is automatically generated by Conventional PR

Whitelist Report

Whitelist Active Result
Pull request is a draft and should be ignored
Pull request is made by a whitelisted user and should be ignored
Pull request is submitted by a bot and should be ignored
Pull request is submitted by administrators and should be ignored

Result

Pull request does not satisfy any enabled whitelist criteria. Pull request will be validated.

Validation Report

Validation Active Result
All commits in this pull request has valid messages
Pull request does not introduce too many changes
Pull request has a valid title
Pull request has mentioned issues
Pull request has valid branch name
Pull request should have a non-empty body

Result

Pull request satisfies all enabled pull request rules.

Last Modified at 25 Jul 24 18:46 UTC

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-2960.dmtpw4p5recq1.amplifyapp.com

…adability

📝 (login.py): Remove unused imports and clean up code for better readability
📝 (auth/utils.py): Remove unused imports and clean up code for better readability
📝 (store/service.py): Remove unused imports and clean up code for better readability
…y length less than 32 bytes to ensure key length is always 32 bytes

📝 (utils.py): update comments for clarity and accuracy regarding key generation and encryption process
Copy link
Contributor

@ogabrielluiz ogabrielluiz left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 25, 2024
@lucaseduoli lucaseduoli enabled auto-merge (squash) July 25, 2024 20:38
Cristhianzl and others added 4 commits July 25, 2024 17:59
…a string before setting cookie

📝 (login.py): update logic to handle cases where user.store_api_key is None to prevent errors when setting cookie
@lucaseduoli lucaseduoli merged commit b6774cf into main Jul 25, 2024
51 checks passed
@lucaseduoli lucaseduoli deleted the cz/fernet branch July 25, 2024 22:05
nicoloboschi pushed a commit to datastax/ragstack-ai-langflow that referenced this pull request Jul 30, 2024
…kend (langflow-ai#2960)

* changing api key journey

* refactor(api_key.py): remove unnecessary code related to config_dir and secret_key_path
refactor(login.py): refactor setting api_key cookie to use user's store_api_key
refactor(variable/service.py): re-encrypt stored value if secret_key changes to ensure validity

* 📝 (api_key.py): Remove unused imports and clean up code for better readability
📝 (login.py): Remove unused imports and clean up code for better readability
📝 (auth/utils.py): Remove unused imports and clean up code for better readability
📝 (store/service.py): Remove unused imports and clean up code for better readability

* 🔧 (utils.py): replace hashing logic with random key generation for key length less than 32 bytes to ensure key length is always 32 bytes
📝 (utils.py): update comments for clarity and accuracy regarding key generation and encryption process

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]>
(cherry picked from commit b6774cf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

STORE KEY ERROR - "Fernet key must be 32 url-safe base64-encoded bytes."
3 participants