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

SessionUtils.current_session_id is unable to verify session token signed with old API secret #978

Closed
tatsuya opened this issue Jun 24, 2022 · 0 comments · Fixed by #979
Closed
Assignees

Comments

@tatsuya
Copy link
Contributor

tatsuya commented Jun 24, 2022

Issue summary

Related issue: Shopify/shopify_app#1459

This gem provides ShopifyAPI::Utils::SessionUtils.current_session_id function to verify the JWT session token and extract the shop domain inside its payload to build the session ID for currently logged in shops/users. The problem is that this JWT verification uses only one API secret passed from ShopifyAPI::Context and because of this limitation, it is currently unable to verify the session token signed with the old API secret.

Adding the ability to verify session tokens using both old and new API secrets is critical to rotate API secrets without downtime to address security risks. See also Shopify/shopify_app#1459

Expected behavior

shopify_app provides the solution for rotating API secrets by taking both secret and old_secret. My suggestion here is the same update ShopifyAPI::Context to take both api_secret_key and old_api_secret_key and verify JWT using both keys when possible.

Actual behavior

Unable to verify the session token signed with the old API secret.

Steps to reproduce the problem

See Shopify/shopify_app#1459

Logs

N/A

Specifications

  • shopify_api version: v10+
  • Shopify API version used (example: 2020-07): Any
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 a pull request may close this issue.

1 participant