-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
fix(core): Improve the security on OAuth callback endpoints #11593
Conversation
80fb12e
to
51453bc
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
51453bc
to
54808e6
Compare
…g the oauth flow can complete the flow
54808e6
to
e4eb7d0
Compare
e4eb7d0
to
a49f61d
Compare
packages/cli/src/controllers/oauth/abstract-oauth.controller.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/controllers/oauth/abstract-oauth.controller.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/controllers/oauth/abstract-oauth.controller.ts
Outdated
Show resolved
Hide resolved
|
||
const additionalData = await this.getAdditionalData(); | ||
const decryptedDataOriginal = await this.getDecryptedData(credential, additionalData); | ||
const oauthCredentials = this.applyDefaultsAndOverwrites<T>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we should set a default for this generic.
packages/cli/src/controllers/oauth/oauth1-credential.controller.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/controllers/oauth/__tests__/oauth1-credential.controller.test.ts
Outdated
Show resolved
Hide resolved
✅ All Cypress E2E specs passed |
n8n Run #7985
Run Properties:
|
Project |
n8n
|
Branch Review |
SEC-163-secure-oauth-callback
|
Run status |
Passed #7985
|
Run duration | 04m 40s |
Commit |
53d0940177: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
|
Committer | कारतोफ्फेलस्क्रिप्ट™ |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
3
|
Pending |
0
|
Skipped |
0
|
Passing |
477
|
View all changes introduced in this branch ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏🏻
packages/cli/src/controllers/oauth/abstract-oauth.controller.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/controllers/oauth/oauth1-credential.controller.ts
Outdated
Show resolved
Hide resolved
|
||
// TODO: Flip this flag in v2 | ||
// https://linear.app/n8n/issue/CAT-329 | ||
export const skipAuthOnOAuthCallback = process.env.N8N_SKIP_AUTH_ON_OAUTH_CALLBACK !== 'true'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want this as an "unofficial" env? (i.e. excluded from config object and from docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't want to document this because we really don't want anyone using it unless they have no other option, like some embed customers.
Once we have those customers migrated, we'll just remove this, and make auth always mandatory on callback.
|
✅ All Cypress E2E specs passed |
Got released with |
Summary
This PR updates our oauth endpoints to
userId
of the person starting the oauth flow, in the CSRFstate
, and ensure that only that user can handle the callback urlcreatedAt
to CSRF state, and use that to expire oauth flows if not finished under 5 minutesAuth on the callback endpoint is disabled for now for backward compatibility, but will be enabled by default in the next major release.
Related Linear tickets, Github issues, and Community forum posts
SEC-163
Review / Merge checklist
release/backport
(if the PR is an urgent fix that needs to be backported)