-
Notifications
You must be signed in to change notification settings - Fork 662
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
feat: @slack/oauth: add support and examples for CSRF mitigation #1013
base: main
Are you sure you want to change the base?
feat: @slack/oauth: add support and examples for CSRF mitigation #1013
Commits on May 7, 2020
-
fix: moves dev dependencies to devDependencies
* Updates the version to 1.1.0 * Moves TypeScript dependencies that were in the production dependencies to the devDependencies
Configuration menu - View commit details
-
Copy full SHA for 40e6930 - Browse repository at this point
Copy the full SHA 40e6930View commit details -
feat: adds timing attack mitigation
If the JWT doesn't expire, it can be used any time. * Adds configuration option to limit the lifetime of the state token * Adds default lifetime of 3 minutes
Configuration menu - View commit details
-
Copy full SHA for 75f18ea - Browse repository at this point
Copy the full SHA 75f18eaView commit details -
docs: adds documentation for overriding state ttl
Adds documentation to the README to describe the default state lifetime, and how to override it.
Configuration menu - View commit details
-
Copy full SHA for 351003c - Browse repository at this point
Copy the full SHA 351003cView commit details -
feat: adds support for csrf mitigation
* Replaces generateInstallUrl with makeInstallUrl, which returns both the url, and the token that was generated * Adds support for passing the token in with the options to callbackHandler, so it can be bound to the device in a cookie, and compared to the token that we received from Slack * Adds support for injecting the web client, so additional test paths can be evaluated * Improves test coverage * Fixes the mock web client responses (appId should be app_id)
Configuration menu - View commit details
-
Copy full SHA for 495811f - Browse repository at this point
Copy the full SHA 495811fView commit details -
docs: updates README with makeInstallUrl
Because the generateInstallUrl returned a string, it wasn't extensible, so I had to either (a) introduce a breaking change, or (b) introduce a new function. I chose the latter, and updated the documentation to demonstrate (b) in the examples.
Configuration menu - View commit details
-
Copy full SHA for ba07cc0 - Browse repository at this point
Copy the full SHA ba07cc0View commit details -
feat: updates v1 example with csrf mitigation
* Adds dependency on `cookie` library * Uses new makeInstallUrl function to get the redirect url, and token * Adds the generated token to a secure, http-only cookie before redirecting to Slack OAuth * Parses the cookie from the headers when Slack redirects back to the app * Ensures the cookie exists before calling handleCallback, so there isn't a wait-for-expiration gap * Passes the token to handleCallback so it can be timingSafeCompared to the JWT that Slack send back in the query string
Configuration menu - View commit details
-
Copy full SHA for 9afaab1 - Browse repository at this point
Copy the full SHA 9afaab1View commit details -
feat: updates v2 example with csrf mitigation
* Adds dependency on `cookie` library * Uses new makeInstallUrl function to get the redirect url, and token * Adds the generated token to a secure, http-only cookie before redirecting to Slack OAuth * Parses the cookie from the headers when Slack redirects back to the app * Ensures the cookie exists before calling handleCallback, so there isn't a wait-for-expiration gap * Passes the token to handleCallback so it can be timingSafeCompared to the JWT that Slack send back in the query string
Configuration menu - View commit details
-
Copy full SHA for 02db29a - Browse repository at this point
Copy the full SHA 02db29aView commit details -
fix: uses separate jwt for device sync
My intention was to only send the random byte array as the value for the OAuth state param, and for the JWT to only exist in the cookie. However, that represents a potentially complex and/or breaking change. However, if the same JWT is used as the state param and in the cookie, and adversary who is able to capture the redirect url can easily spoof a synchronized device. So the examples sign JWTs specifically for the device, and provide the synchronizer to the callbackHandler for comparison.
Configuration menu - View commit details
-
Copy full SHA for 67edf26 - Browse repository at this point
Copy the full SHA 67edf26View commit details -
fix: updates tests to pass after rebase
A test breaking change was introduced in master. This changes the test to evaluate the new behavior.
Configuration menu - View commit details
-
Copy full SHA for d96d522 - Browse repository at this point
Copy the full SHA d96d522View commit details