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

feat: add saml app sessions table #6881

Merged
merged 2 commits into from
Dec 27, 2024
Merged

Conversation

darcyYe
Copy link
Contributor

@darcyYe darcyYe commented Dec 13, 2024

Summary

Add saml_application_sessions table to help improve the security of OIDC and SAML proxy. (resolves LOG-10581)

  1. when we receice SAML auth request, we create create a record (using applicationId, and samlRequestId) in this table
  2. and then we start a OIDC auth request on backend, which should update the record and attach oidcState
  3. on SAML proxy callback page, we check whether we have unexpired and unused OIDC state in record, if not, throw an error otherwise mark the OIDC state as used (this prevents replay attack)
  4. after getting the OIDC token with the OIDC auth code, we get the unused samlRequestId and sent SAML response to the ACS URL in record and hence marked the samlRequestId as parsed

Testing

N/A

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

@github-actions github-actions bot added the feature Cool stuff label Dec 13, 2024
Copy link

github-actions bot commented Dec 13, 2024

COMPARE TO master

Total Size Diff 📈 +5.23 KB

Diff by File
Name Diff
packages/core/src/saml-applications/queries/sessions.ts 📈 +2.29 KB
packages/core/src/tenants/Queries.ts 📈 +174 Bytes
packages/schemas/alterations/next-1735012422-add-saml-application-sessions-table.ts 📈 +1.27 KB
packages/schemas/src/foundations/jsonb-types/index.ts 📈 +48 Bytes
packages/schemas/src/foundations/jsonb-types/saml-application-sessions.ts 📈 +527 Bytes
packages/schemas/tables/saml_application_sessions.sql 📈 +965 Bytes

@darcyYe darcyYe force-pushed the yemq-add-saml-app-session-table branch from ebeca16 to 9feaea5 Compare December 24, 2024 04:37
@darcyYe darcyYe force-pushed the yemq-add-saml-app-session-table branch from 9feaea5 to e7ca100 Compare December 24, 2024 06:45
@darcyYe darcyYe force-pushed the yemq-add-saml-app-session-table branch 2 times, most recently from 43a34a7 to 965f6a2 Compare December 26, 2024 04:56
Copy link
Contributor

@simeng-li simeng-li left a comment

Choose a reason for hiding this comment

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

overall LGTM

packages/schemas/tables/saml_application_sessions.sql Outdated Show resolved Hide resolved
@darcyYe darcyYe force-pushed the yemq-add-saml-app-session-table branch from 965f6a2 to fd2ea4a Compare December 27, 2024 04:46
@darcyYe darcyYe enabled auto-merge December 27, 2024 04:47
@darcyYe darcyYe merged commit 659ec5c into master Dec 27, 2024
37 checks passed
@darcyYe darcyYe deleted the yemq-add-saml-app-session-table branch December 27, 2024 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants