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

🐛 Fixed bug with ability to log in with revoked session #554

Merged
merged 1 commit into from
May 30, 2024

Conversation

shepilov
Copy link
Member

No description provided.

@shepilov shepilov requested a review from MontaGhanmy May 29, 2024 20:27
Copy link

Coverage Report

  • Status: ✅ Passed

Click to view remaining coverage report
Status File Stmts Branch Funcs Lines
total 67.54 50.67 60.02 67.27
/usr/src/app/src/version.ts 100 100 100 100
/usr/src/app/src/core/config/index.ts 100 100 100 100
/usr/src/app/src/core/crypto/index.ts 91.3 100 66.66 90.9
/usr/src/app/src/core/crypto/legacy.ts 85.71 57.14 50 85.71
/usr/src/app/src/core/crypto/v1.ts 87.5 71.42 100 87.5
/usr/src/app/src/core/crypto/v2.ts 88 71.42 100 88
/usr/src/app/src/core/platform/platform.ts 80 100 50 80
/usr/src/app/src/core/platform/framework/configuration.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/event-bus.ts 93.75 100 100 93.75
/usr/src/app/src/core/platform/framework/execution-storage.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/factory.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/index.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/logger.ts 100 66.66 100 100
/usr/src/app/src/core/platform/framework/api/application-configuration.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/api/component.ts 92.59 81.81 100 92.3
/usr/src/app/src/core/platform/framework/api/constants.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/api/container.ts 73.07 0 75 76
/usr/src/app/src/core/platform/framework/api/crud-service.ts 94.54 75 90.47 93.47
/usr/src/app/src/core/platform/framework/api/index.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/api/service-options.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/api/service-state.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/api/service.ts 58.73 58.33 77.77 58.73
/usr/src/app/src/core/platform/framework/decorators/consumes.ts 100 0 100 100
/usr/src/app/src/core/platform/framework/decorators/index.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/decorators/prefix.ts 100 0 100 100
/usr/src/app/src/core/platform/framework/decorators/service-name.ts 100 100 100 100
/usr/src/app/src/core/platform/framework/decorators/skip.ts 92.85 66.66 100 92.3
/usr/src/app/src/core/platform/framework/utils/component-utils.ts 72.5 11.11 100 74.35
/usr/src/app/src/core/platform/framework/utils/loader.ts 75 60 83.33 72.22
/usr/src/app/src/core/platform/services/auth/index.ts 100 100 100 100
/usr/src/app/src/core/platform/services/auth/service.ts 85.71 100 66.66 85.71
/usr/src/app/src/core/platform/services/auth/web/index.ts 100 100 100 100
/usr/src/app/src/core/platform/services/auth/web/jwt.ts 100 90 100 100
/usr/src/app/src/core/platform/services/auth/web/routes.ts 71.42 100 50 71.42
/usr/src/app/src/core/platform/services/counter/index.ts 100 100 100 100
/usr/src/app/src/core/platform/services/counter/provider.ts 88.57 80 100 88.57
/usr/src/app/src/core/platform/services/cron/index.ts 34.78 0 16.66 34.78
/usr/src/app/src/core/platform/services/database/index.ts 74.07 0 66.66 72
/usr/src/app/src/core/platform/services/database/services/connector-factory.ts 71.42 33.33 100 71.42
/usr/src/app/src/core/platform/services/database/services/index.ts 77.77 50 60 77.77
/usr/src/app/src/core/platform/services/database/services/orm/manager.ts 84.05 70 76.92 87.87
/usr/src/app/src/core/platform/services/database/services/orm/utils.ts 53.84 4.16 40 54.05
/usr/src/app/src/core/platform/services/database/services/orm/connectors/abstract-connector.ts 66.66 100 33.33 50
/usr/src/app/src/core/platform/services/database/services/orm/connectors/mongodb/mongodb.ts 7.84 0 0 8.08
/usr/src/app/src/core/platform/services/database/services/orm/connectors/mongodb/query-builder.ts 14.28 0 0 15.38
/usr/src/app/src/core/platform/services/database/services/orm/connectors/mongodb/typeTransforms.ts 12.28 0 0 9.25
/usr/src/app/src/core/platform/services/database/services/orm/connectors/postgres/postgres-data-transform.ts 87.09 93.87 100 88.13
/usr/src/app/src/core/platform/services/database/services/orm/connectors/postgres/postgres-query-builder.ts 98.96 90 100 98.85
/usr/src/app/src/core/platform/services/database/services/orm/connectors/postgres/postgres.ts 83.87 76.92 88.46 84.16
/usr/src/app/src/core/platform/services/database/services/orm/decorators/column.ts 100 100 100 100
/usr/src/app/src/core/platform/services/database/services/orm/decorators/entity.ts 100 50 100 100
/usr/src/app/src/core/platform/services/database/services/orm/decorators/index.ts 100 100 100 100
/usr/src/app/src/core/platform/services/database/services/orm/repository/manager.ts 84.61 100 100 84.61
/usr/src/app/src/core/platform/services/database/services/orm/repository/repository.ts 83.78 77.77 76.92 87.87
/usr/src/app/src/core/platform/services/email-pusher/index.ts 63.88 40.74 100 63.38
/usr/src/app/src/core/platform/services/message-queue/api.ts 81.25 66.66 77.77 82.6
/usr/src/app/src/core/platform/services/message-queue/bus.ts 83.33 100 66.66 83.33
/usr/src/app/src/core/platform/services/message-queue/factory.ts 66.66 25 100 66.66
/usr/src/app/src/core/platform/services/message-queue/index.ts 80.95 50 72.72 80
/usr/src/app/src/core/platform/services/message-queue/processor.ts 58.82 0 50 58.82
/usr/src/app/src/core/platform/services/message-queue/proxy.ts 54.54 22.22 46.15 54.54
/usr/src/app/src/core/platform/services/message-queue/amqp/client.ts 9.52 0 0 9.75
/usr/src/app/src/core/platform/services/message-queue/amqp/constants.ts 100 100 100 100
/usr/src/app/src/core/platform/services/message-queue/amqp/index.ts 26.92 100 0 26.92
/usr/src/app/src/core/platform/services/message-queue/amqp/manager.ts 16.27 0 0 16.27
/usr/src/app/src/core/platform/services/message-queue/amqp/pubsub.ts 15.78 0 0 15.78
/usr/src/app/src/core/platform/services/message-queue/amqp/pubsubclient.ts 19.35 0 0 20.68
/usr/src/app/src/core/platform/services/message-queue/local/index.ts 80 100 83.33 80
/usr/src/app/src/core/platform/services/push/index.ts 63.15 16.66 66.66 58.82
/usr/src/app/src/core/platform/services/push/connectors/fcm/service.ts 18.75 0 0 18.75
/usr/src/app/src/core/platform/services/search/api.ts 100 100 100 100
/usr/src/app/src/core/platform/services/search/index.ts 65.21 33.33 54.54 64.28
/usr/src/app/src/core/platform/services/search/repository.ts 92.59 66.66 100 92.3
/usr/src/app/src/core/platform/services/search/adapters/abstract.ts 54.54 100 16.66 54.54
/usr/src/app/src/core/platform/services/search/adapters/ascii-folder.ts 64.7 30 50 91.66
/usr/src/app/src/core/platform/services/search/adapters/utils.ts 76.92 0 77.77 77.27
/usr/src/app/src/core/platform/services/search/adapters/elasticsearch/elastic-open-search-adapter.ts 75.39 61.53 76.92 75.39
/usr/src/app/src/core/platform/services/search/adapters/elasticsearch/search.ts 90.16 76.59 100 90.16
/usr/src/app/src/core/platform/services/search/adapters/mongosearch/index.ts 10.41 0 0 10.41
/usr/src/app/src/core/platform/services/search/adapters/mongosearch/search.ts 11.11 0 0 11.42
/usr/src/app/src/core/platform/services/storage/index.ts 82.75 61.53 90.9 81.92
/usr/src/app/src/core/platform/services/storage/connectors/S3/s3-service.ts 19.29 22.22 16.66 20.75
/usr/src/app/src/core/platform/services/storage/connectors/local/service.ts 80.55 100 70 80.55
/usr/src/app/src/core/platform/services/tracker/index.ts 30.43 0 22.22 28.57
/usr/src/app/src/core/platform/services/tracker/adapters/segment.ts 11.53 0 0 11.53
/usr/src/app/src/core/platform/services/webserver/error.ts 100 50 100 100
/usr/src/app/src/core/platform/services/webserver/index.ts 79.16 9.09 66.66 80.28
/usr/src/app/src/services/global-resolver.ts 97.36 50 100 97.36
/usr/src/app/src/services/applications/index.ts 92.3 100 66.66 90.9
/usr/src/app/src/services/applications-api/index.ts 60 50 50 57.89
/usr/src/app/src/services/applications-api/web/index.ts 100 100 100 100
/usr/src/app/src/services/applications-api/web/routes.ts 76.47 0 33.33 76.47
/usr/src/app/src/services/applications-api/web/schemas.ts 100 100 100 100
/usr/src/app/src/services/applications-api/web/controllers/index.ts 13.04 0 0 13.04
/usr/src/app/src/services/applications/entities/application.ts 45.45 100 0 33.33
/usr/src/app/src/services/applications/services/applications.ts 50 0 25 60
/usr/src/app/src/services/applications/services/company-applications.ts 17.39 0 25 17.39
/usr/src/app/src/services/applications/services/hooks.ts 25.8 0 25 25.8
/usr/src/app/src/services/applications/web/index.ts 100 100 100 100
/usr/src/app/src/services/applications/web/routes.ts 100 100 100 100
/usr/src/app/src/services/applications/web/schemas.ts 100 100 100 100
/usr/src/app/src/services/applications/web/controllers/applications.ts 17.39 0 0 17.39
/usr/src/app/src/services/applications/web/controllers/company-applications.ts 20 100 0 20
/usr/src/app/src/services/console/client-factory.ts 75 33.33 100 75
/usr/src/app/src/services/console/index.ts 92.3 100 66.66 90.9
/usr/src/app/src/services/console/service.ts 95 50 80 95
/usr/src/app/src/services/console/clients/internal.ts 14.28 0 0 14.63
/usr/src/app/src/services/console/clients/remote-jwks-verifier.ts 25 27.27 10 25
/usr/src/app/src/services/console/clients/remote.ts 64.49 57.44 31.57 64.96
/usr/src/app/src/services/console/entities/session.ts 91.66 100 0 90
/usr/src/app/src/services/console/web/controller.ts 23.52 8.16 22.22 23.52
/usr/src/app/src/services/console/web/index.ts 100 100 100 100
/usr/src/app/src/services/console/web/routes.ts 93.33 100 50 93.33
/usr/src/app/src/services/console/web/schemas.ts 100 100 100 100
/usr/src/app/src/services/documents/const.ts 100 100 100 100
/usr/src/app/src/services/documents/index.ts 93.33 100 66.66 92.3
/usr/src/app/src/services/documents/types.ts 100 100 100 100
/usr/src/app/src/services/documents/utils.ts 88.73 76.15 93.54 88.58
/usr/src/app/src/services/documents/entities/drive-file.search.ts 100 50 100 100
/usr/src/app/src/services/documents/entities/drive-file.ts 100 100 100 100
/usr/src/app/src/services/documents/entities/drive-tdrive-tab.ts 68.75 100 0 64.28
/usr/src/app/src/services/documents/entities/file-version.ts 63.33 100 0 60.71
/usr/src/app/src/services/documents/entities/missed-drive-file.ts 58.82 100 0 56.25
/usr/src/app/src/services/documents/services/access-check.ts 72.68 59.67 71.42 71.69
/usr/src/app/src/services/documents/services/drive-file-dto-builder.ts 100 100 100 100
/usr/src/app/src/services/documents/services/index.ts 70.52 64.64 74.35 70.96
/usr/src/app/src/services/documents/services/engine/extract-keywords.ts 100 100 100 100
/usr/src/app/src/services/documents/services/engine/index.ts 96.29 100 100 96.29
/usr/src/app/src/services/documents/services/engine/save-keywords.ts 80 83.33 75 80
/usr/src/app/src/services/documents/web/index.ts 100 100 100 100
/usr/src/app/src/services/documents/web/routes.ts 100 100 100 100
/usr/src/app/src/services/documents/web/schemas.ts 100 100 100 100
/usr/src/app/src/services/documents/web/controllers/documents.ts 56.32 25 56 57.98
/usr/src/app/src/services/documents/web/controllers/index.ts 100 100 100 100
/usr/src/app/src/services/files/index.ts 92.3 100 66.66 90.9
/usr/src/app/src/services/files/entities/file.ts 86.36 100 50 85
/usr/src/app/src/services/files/services/index.ts 54.06 48.88 50 53.25
/usr/src/app/src/services/files/services/preview.ts 81.81 50 80 85
/usr/src/app/src/services/files/web/index.ts 100 100 100 100
/usr/src/app/src/services/files/web/routes.ts 90.47 100 33.33 89.47
/usr/src/app/src/services/files/web/controllers/files.ts 42.1 58.82 33.33 41.81
/usr/src/app/src/services/files/web/controllers/index.ts 100 100 100 100
/usr/src/app/src/services/general/index.ts 92.85 100 66.66 91.66
/usr/src/app/src/services/general/languages.ts 100 100 100 100
/usr/src/app/src/services/general/web/index.ts 100 100 100 100
/usr/src/app/src/services/general/web/routes.ts 71.42 0 25 71.42
/usr/src/app/src/services/i18n/i18n-service.ts 80 100 50 80
/usr/src/app/src/services/i18n/index.ts 100 100 100 100
/usr/src/app/src/services/previews/utils.ts 100 100 100 100
/usr/src/app/src/services/previews/services/files/engine/clear.ts 40 0 0 42.85
/usr/src/app/src/services/previews/services/files/engine/index.ts 100 100 100 100
/usr/src/app/src/services/previews/services/files/engine/service.ts 95.23 66.66 80 95.12
/usr/src/app/src/services/previews/services/files/processing/image.ts 86.36 100 100 86.36
/usr/src/app/src/services/previews/services/files/processing/pdf.ts 76.19 0 100 75
/usr/src/app/src/services/previews/services/files/processing/service.ts 92.85 100 100 92.85
/usr/src/app/src/services/previews/services/files/processing/video.ts 56.52 12.5 63.63 56.52
/usr/src/app/src/services/statistics/index.ts 83.33 100 50 83.33
/usr/src/app/src/services/statistics/types.ts 100 100 100 100
/usr/src/app/src/services/statistics/entities/statistics.ts 91.66 100 0 90
/usr/src/app/src/services/statistics/service/index.ts 47.05 40 50 47.05
/usr/src/app/src/services/tags/index.ts 92.85 100 66.66 91.66
/usr/src/app/src/services/tags/entities/index.ts 100 100 100 100
/usr/src/app/src/services/tags/entities/tags.ts 100 100 100 100
/usr/src/app/src/services/tags/services/tags.ts 91.66 100 100 91.66
/usr/src/app/src/services/tags/web/index.ts 100 100 100 100
/usr/src/app/src/services/tags/web/routes.ts 100 100 100 100
/usr/src/app/src/services/tags/web/controllers/index.ts 100 100 100 100
/usr/src/app/src/services/tags/web/controllers/tags.ts 85.29 83.33 100 85.29
/usr/src/app/src/services/user/index.ts 92.3 100 66.66 90.9
/usr/src/app/src/services/user/utils.ts 100 74.19 100 100
/usr/src/app/src/services/user/entities/company.ts 100 100 100 100
/usr/src/app/src/services/user/entities/company_user.ts 100 100 100 100
/usr/src/app/src/services/user/entities/device.ts 100 100 100 100
/usr/src/app/src/services/user/entities/external_company.ts 100 100 100 100
/usr/src/app/src/services/user/entities/external_user.ts 100 100 100 100
/usr/src/app/src/services/user/entities/user.search.ts 100 100 100 100
/usr/src/app/src/services/user/entities/user.ts 88.37 40 75 87.8
/usr/src/app/src/services/user/services/companies.ts 47.7 35 38.09 49.5
/usr/src/app/src/services/user/services/external_links/index.ts 61.11 0 50 61.11
/usr/src/app/src/services/user/services/users/service.ts 51.67 48.97 56.75 53.67
/usr/src/app/src/services/user/web/controller.ts 78.94 63.63 79.16 78.26
/usr/src/app/src/services/user/web/index.ts 100 100 100 100
/usr/src/app/src/services/user/web/routes.ts 95.65 0 100 95.65
/usr/src/app/src/services/user/web/schemas.ts 100 100 100 100
/usr/src/app/src/services/user/web/types.ts 100 100 100 100
/usr/src/app/src/services/workspaces/index.ts 92.3 100 66.66 90.9
/usr/src/app/src/services/workspaces/entities/workspace.ts 100 100 100 100
/usr/src/app/src/services/workspaces/entities/workspace_counters.ts 100 100 100 100
/usr/src/app/src/services/workspaces/entities/workspace_invite_domain.ts 90.9 100 0 88.88
/usr/src/app/src/services/workspaces/entities/workspace_invite_tokens.ts 92.3 100 0 90.9
/usr/src/app/src/services/workspaces/entities/workspace_pending_users.ts 91.66 100 0 90
/usr/src/app/src/services/workspaces/entities/workspace_user.ts 100 66.66 100 100
/usr/src/app/src/services/workspaces/services/workspace.ts 53.98 40.29 61.36 54.05
/usr/src/app/src/services/workspaces/web/index.ts 100 100 100 100
/usr/src/app/src/services/workspaces/web/routes.ts 74.71 15.38 66.66 74.71
/usr/src/app/src/services/workspaces/web/schemas.ts 100 100 100 100
/usr/src/app/src/services/workspaces/web/controllers/workspace-invite-tokens.ts 8.47 0 0 8.47
/usr/src/app/src/services/workspaces/web/controllers/workspace-users.ts 55.94 43.18 65.62 56.83
/usr/src/app/src/services/workspaces/web/controllers/workspaces.ts 80.68 80 90 80.68
/usr/src/app/src/utils/coalesce.ts 100 100 100 100
/usr/src/app/src/utils/company.ts 82.6 75 50 82.6
/usr/src/app/src/utils/counters.ts 100 100 100 100
/usr/src/app/src/utils/exec.ts 69.76 0 50 71.05
/usr/src/app/src/utils/files.ts 89.58 100 80 89.47
/usr/src/app/src/utils/handleError.ts 33.33 0 0 33.33
/usr/src/app/src/utils/mime.ts 100 100 100 100
/usr/src/app/src/utils/password-encoder.ts 50 0 50 50
/usr/src/app/src/utils/pick.ts 100 100 100 100
/usr/src/app/src/utils/types.ts 100 100 100 100
/usr/src/app/src/utils/users.ts 85.18 71.42 100 88
/usr/src/app/src/utils/uuid-reducer.ts 40 0 0 33.33
/usr/src/app/src/utils/workspace.ts 33.33 14.28 25 33.33
/usr/src/app/test/e2e/utils.api.ts 93.75 100 83.33 93.33
/usr/src/app/test/e2e/utils.prepare.db.ts 73.07 76.92 61.53 74
/usr/src/app/test/e2e/common/user-api.ts 93.7 70 90.24 94.28
/usr/src/app/test/e2e/common/entities/mock_entities.ts 100 100 100 100
/usr/src/app/test/e2e/documents/utils.ts 100 100 100 100
/usr/src/app/test/e2e/setup/index.ts 91.3 62.5 100 91.3
/usr/src/app/test/unit/core/services/database/services/orm/connectors/postgres/utils.ts 79.16 100 37.5 73.68

Total 67.27%
Change from base: 0%
Covered Lines: 4570
Total Lines: 6793

@@ -320,7 +323,8 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
const sessionRepository = gr.services.console.getSessionRepo();
const session = await sessionRepository.findOne({ sid: payload.claims.sid });
if (session) {
await sessionRepository.remove(session);
session.revoked_at = new Date().getTime();
await sessionRepository.save(session);
Copy link
Contributor

Choose a reason for hiding this comment

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

when are those rows cleaned up ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now nowhen, we'll think about it later, it can be cron job or event

@shepilov shepilov merged commit 9026900 into main May 30, 2024
7 checks passed
@shepilov shepilov deleted the backchannel_logout_sesseion_revoke_date branch May 30, 2024 08:43
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 this pull request may close these issues.

3 participants