Commit Graph

85 Commits

Author SHA1 Message Date
Kristaps Fabians Geikins f27f289dc6 chore(server): core IoC #78 - getServerInfoFactory 2024-10-17 12:37:43 +03:00
Kristaps Fabians Geikins 781ee2cc2d chore(server): core IoC #57 - getUserByEmailFactory 2024-10-15 13:17:34 +03:00
Kristaps Fabians Geikins 1cb27e6fdd chore(server): core IoC #51 - getUser(s)Factory 2024-10-14 17:24:11 +03:00
Kristaps Fabians Geikins 6cb5022ac4 chore(server): IoC 35 - updateStreamRoleAndNotify 2024-10-09 16:31:20 +03:00
Kristaps Fabians Geikins 5b5dd201e2 chore(server): IoC 29 - getStream(s)Factory 2024-10-09 10:39:00 +03:00
Alessandro Magionami 8cba8ce168 chore(activitystream): IoC 1 refactor addStreamInviteDeclined 2024-09-27 16:30:29 +02:00
Iain Sproat f93d9093a0 fix(errors): all error should define an appropriate status code (#3112)
* fix(errors): all error should define a status code (default is 500)
- rename NoInviteFoundError to InviteNotFoundError to match xNotFoundError pattern

* remove unused errors
2024-09-25 13:08:13 +02:00
Kristaps Fabians Geikins 43e7ec89ea chore(server): auth IoC 14 - localStrategyBuilderFactory (#3036)
* chore(server): auth IoC 3 - getAllAppsCreatedByUserFactory

* minor fix

* chore(server): auth IoC 4 - getAllAppsAuthorizedByUserFactory

* chore(server): auth IoC 5 - createAppFactory

* chore(server): auth IoC 6 - updateAppFactory

* chore(server): auth IoC 7 - deleteAppFactory

* chore(server): auth IoC 8 - revokeExistingAppCredentialsForUserFactory

* chore(server): auth IoC 9 - revokeRefreshTokenFactory

* chore(server): auth IoC 10 - createAuthorizationCodeFactory

* chore(server): auth IoC 11 - createAppTokenFromAccessCodeFactory

* chore(server): auth IoC 12 - refreshAppTokenFactory

* chore(server): auth IoC 13 - index repo

* chore(server): auth IoC 14 - localStrategyBuilderFactory

---------

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
2024-09-19 11:02:43 +02:00
Kristaps Fabians Geikins 9f6d2d9d3a chore(server): emails IoC 6 - sendVerificationEmailFactory 2024-09-10 14:26:06 +03:00
Kristaps Fabians Geikins f10c30aa3c chore(server): emails IoC 4 - requestNewEmailVerificationFactory 2024-09-10 14:00:13 +03:00
Kristaps Fabians Geikins c92938eff3 chore(server): apollo server v3 -> v4 (#2880)
* main changes seem to be done?

* lint fix

* minor cleanup

* dataloader clear
2024-09-05 12:27:13 +03:00
Gergő Jedlicska a12fda7f96 fix(workspaceInvites): fix error message (#2840) 2024-09-02 12:36:34 +02:00
Kristaps Fabians Geikins 7c6ea464e8 fix: support accepting invites even if a workspace member already (#2826)
* blocking workspace project invites from incorrect resolver

* invite create validation fixes + tests

* fix for email added on decline

* doing init validation on finalization as well

* more tests

* fix(server): allow accepting an email invite even if already a member

* fix(fe2): support accepting invites even if a workspace member already
2024-09-02 09:45:24 +02:00
Kristaps Fabians Geikins 80aa0aa20b fix(server): fixed validation in regards to workspaces, when they're secondary resource targets (#2814)
* blocking workspace project invites from incorrect resolver

* invite create validation fixes + tests

* fix for email added on decline

* doing init validation on finalization as well

* more tests
2024-08-30 11:44:26 +02:00
Kristaps Fabians Geikins 1380d1d17f feat(fe2): error reporting when invite (middleware level) auto-accept doesn't work (#2711)
* feat(fe2): auto-accept error toasts

* smarter error reporting

* typo
2024-08-20 17:27:53 +03:00
Kristaps Fabians Geikins 0b417c9ba0 feat(fe2): workspace invite cancel/resend + Invite dialog CTA in workspace home (#2691)
* feat(server): resend invite mutation

* invite resend/cancel from FE

* functional invite cta on workspace page
2024-08-20 10:17:42 +03:00
Kristaps Fabians Geikins 2bb7802fb9 feat: accept & decline workspace invite as a registered member (#2675)
* abstract base invite banner

* WIP banner actions

* WIP modify obj

* minor fix

* invite accept/decline cache mutations

* banner accept/decline basically works

* new block for accepting workspace invite

* WIP wrong account flow

* login/registration block changes

* add email invite related changes

* add new email FE

* add email w/ invite works

* final adjustments

* minor fixes

* addressing cr comments

* no-FF support

* extra workspace ff checks
2024-08-19 13:01:25 +03:00
Kristaps Fabians Geikins 4dae1569cd feat(fe2): invite + list workspace invites (#2629)
* list invites table

* invites list works

* update last reminded date on resend

* fix FE

* WIP invitedialog + updated debounced utility

* invite create works

* exclude users correctly

* more adjustments

* minor cleanup

* using workspace invite server role

* test fix

* fixed multiple root eslint issues

* minor adjustments
2024-08-12 11:30:01 +03:00
Kristaps Fabians Geikins 50b5bdbbdd chore(server): typescriptified auth strategies (#2589)
* rebuilt strategies.js

* local.js -> local.ts

* oidc.js -> oidc.ts

* google.js -> google.ts

* github.js -> github.ts

* azure-ad.js -> azureAd.ts

* minor fixes

* FE2 regen

* improved error reference page

* minor adjustment

* more error page improvements

* migrated helper

* testfix
2024-08-07 11:38:44 +03:00
Kristaps Fabians Geikins 455b21cba3 fix(server): manual workspace role assignment on project invite create + more bugfixes (#2581)
* prep for new projectinvite create mutation

* fix for serverRole not being taken into account in stream invite

* new workspace invite create mutation
2024-08-06 13:42:10 +03:00
Kristaps Fabians Geikins 7383779375 feat(server): registration (w/ and w/o invites) tests (#2567)
* WIP tests

* a couple of tests done

* most server registration tests done

* finalized tests

* lint fix

* added login tests too
2024-08-05 16:21:56 +03:00
Kristaps Fabians Geikins 281f77ac11 fix(server): some serverinvites regressions (#2538)
* project invite retrieval

* fix for invalid invite target when inviting registered user by email

* improved error msg w/ broken streamId
2024-07-29 19:15:26 +03:00
Kristaps Fabians Geikins ede566eed9 feat(server): serverInvites refactor + workspace invites CRUD & GQL API (#2530)
* prep for new resources algo

* typescriptifying stuff

* minor types fix

* migrate to resources col

* repo & creation updated, WIP processing/retrieval

* WIP invite processing

* finished finalization refactor

* project invite management

* transformed all invites services

* fixed up projects & core serverinvites resolvers

* test fixes

* WIP workspace create GQL & test

* basic invite creation test works

* a buncha working tests

* more tests

* cancelation tests

* minor invite use refactor

* invite retrieval tasks

* invite use() works as expected

* filtering out broken invites

* enabled invite retrieval by token irregardless of who is it for

* minor adjustments

* tests fix

* test config improvements

* test env adjustment

* extra test case

* making resource access limits harder to ignore

* linter fixes

* eventBus type cleanup

* better generic names

* refactored serverinvites resource migration

* fix(server): better error message in project invite edge case
2024-07-29 14:37:54 +03:00
Alessandro Magionami 447b48a6c2 chore(server): remove relative imports 2024-07-18 16:07:16 +02:00
Kristaps Fabians Geikins ee5ae8af62 fix(fe2): accept invite before onboarding after sign up (#2491)
* explicitly ordering global middlewares

* various subscription fixes & WIP project invite middleware

* SSR invite accept & toast notifs seem to work

* backend support for mixpanel

* mixpanel be logic -> shared

* minor fix

* finissh

* lint fix

* minor comment adjustments

* better adblock handling
2024-07-11 11:45:11 +03:00
Kristaps Fabians Geikins 6bfffca0a9 fix: various invite flow fixes & improvements (#2451)
* fix(fe2): show signup CTA for non-registered invitees [web-1144]

* fix: server invite signup error

* WIP project error access block

* feat(fe2): better 'no project access' error screens

* CR fix
2024-06-28 17:26:11 +02:00
Gergő Jedlicska 7c16abc8eb feat(workspace): 1119 define workspaces dataschema (#2431)
* feat(workspaces): add workspaces module with roles and scopes

* feat(workspaces): add domain, graphql and persistent storage dataschema

* fix(workspaces): correct db injections

* chore(workspaces): add EE license

* chore(license): mentions workspaces separately in license file

* fix(core): roles import in migration

* fix(workspaces): drop workspace_acl on down migration

* fix(workspaces): roles constants

* fix(workspaces): coding standards

---------

Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
2024-06-26 17:00:56 +02:00
Gergő Jedlicska c6cd4c311d feat(serverinvites): create domain module in server invites (#2401)
* chore(serverinvites): repository refactor for multiregion

* chore(serverinvites): remove migrated functions from old repository

* chore(serverinvites): refactor serverInviteForToken resolver for multiregion

* chore(serverinvites): invite processing service refactor for multiregion

* chore(serverinvites): subscription refactor for multiregion

* chore(serverinvites): move buildEmailContents to dedicated file

* chore(serverinvites): deleteAllStreamInvites function multiregion refactor

* chore(serverinvites): refactor deleteServerOnlyInvites multiregion repository

* chore(serverinvites): complete repository refactor for multiregion

* feat(serverinvites): create domain module in server invites

* fix(serverinvites): no relative imports

* feat(serverinvites): extract individual types from repository

* feat(serverinvites): move interfaces to operations

* fix(serverinvites): update imports referencing old interfaces file

* fix(serverinvites): type mismatch for insert invite and delete old

* chore(serverinvites): refactor to single repo function

* test(serverinvites): fix tests

* fix(serverinvites): use domain types in all places

* feat(serverinvites): WIP unity

* feat(serverinvites): move to new facory names and types

* feat(serverinvites): fix tests

* fix(serverinvites): use factory name

---------

Co-authored-by: Alessandro Magionami <alessandro.magionami@gmail.com>
2024-06-25 13:24:37 +02:00
Kristaps Fabians Geikins bd9faa2415 fix(server): more legible auth errors (#2361) 2024-06-13 10:34:01 +03:00
Kristaps Fabians Geikins f9f490b440 fix(server): allow standard users to batch invite to server (#2150)
* fix(server): allow standard users to batch invite to server

* added max 10 invite batch limit

* minor change
2024-03-20 17:51:24 +02:00
Benjamin Ottensten 663a5b4ddc Use FE2 language in emails (#2115)
* Update copy in the Invite email

* Update copy in the comment email

* Update copy in project access emails
2024-03-13 10:46:35 +01:00
Kristaps Fabians Geikins 9caa2a37c8 feat(fe): auto accept stream/project invite on email link click [WBX-73] (#2017)
* feat(fe2): project invite auto accept

* fix(fe2): improved CSR error logging

* feat(fe1): auto accept stream invite on email link click

* minor type fix

* tests fix
2024-02-07 14:26:59 +02:00
Kristaps Fabians Geikins 37d51072fb feat(server): resource limits on app tokens (#1959)
* WIP new mutation arg

* limited resource token creation done

* token resource rule creation validation

* updated authorizeResolver implementation

* introduced resource access rule checks in authorizeResolver everywhere

* more checks added

* updated projects resolvers

* updated stream resolvers

* more checks added

* error page theme resolution fix

* WIP testss

* more tests

* implemented checks in REST auth pipeline

* REST API coverage & tests

* some tests fixed

* test fixess

* added tests

* feat(server): new automation result reporting scope (#1976)

* feat(server): new automation result reporting scope

* tests fix
2024-01-19 18:14:49 +01:00
Kristaps Fabians Geikins c5ff7688ac feat: click on invite link autofills email in register form (#1919) 2023-12-15 11:51:43 +02:00
andrewwallacespeckle 44bfa6d2c8 Fe2 server management bugfixes (#1787)
* fix(server): inviteList pagination

* Fixes from call with fabians

* more BE bufxies

* reducing server invite precision

* Infinite Scroll fixes. Slight design change to "update available"

* fixed tests

---------

Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
2023-09-08 12:55:03 +01:00
Kristaps Fabians Geikins 069f64afc9 feat(fe1 & fe2): guest role (#1768)
* feat: user guest role switching in FE1

* removed stream create buttons

* fe1 done

* fe1 - specifying role in invite dialogs

* fe1 - bulk invites

* WIP FE2 changes

* fe1: allow role select condition fixes

* xtra limitations on createForOnboarding

* more invite creation validations

* no longer able to set guest as project owner in invite

* preparations for server role select in invite dialog

* team management dialog done

* server invite dialog updated

* hiding invite dialog

* fixed mocks
2023-08-24 09:30:09 +02:00
Gergő Jedlicska 4b071872c2 gergo/adminInviteList (#1761)
* feat(admin): add users email to the admin user list query

* feat(admin): WIP invite list

* feat(admin): fix server invites resolver typing

* fix(admin): slim down admin user list item data
2023-08-11 15:02:02 +03:00
Kristaps Fabians Geikins ba7ef04ca3 fix(server): invites fixes + proper project()/stream() query error reporting (#1580)
* fix(server): invalid stream invite purge + better error handling

* fix(server): proper project/stream query error reporting

* undo env example change

* fix(server): fixed tests

* fix(fe-2): chromatic adjustments

* fix(fe-2): non-randomized stories
2023-05-17 17:17:09 +02:00
Kristaps Fabians Geikins b02a07e2b6 feat: Frontend 2.0 MVP 2023-05-08 10:47:01 +03:00
Gergő Jedlicska c4454c2ede refactor(server email templates): use the mjml ejs rendering for all emails (#1448)
* refactor(server email templates): use the mjml ejs rendering for all emails

* fix(server access request): await the server info pls
2023-03-13 15:07:13 +01:00
Iain Sproat 4d01e13a84 feat(structured logging) (#1242)
* Revert "Revert structured logging 2 (#1240)"
This reverts commit 78ecaeffcb.
* Logging should not be bundled into core shared directory
* making sure observability stuff isnt bundled into frontend


Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
2022-12-06 11:51:18 +00:00
Iain Sproat 78ecaeffcb Revert structured logging 2 (#1240)
* Revert "'@' shortcut must come after it is configured in bootstrap (#1239)"

This reverts commit 967329473f.

* Revert "Structured logging (attempt 2) (#1234)"

This reverts commit 444d2ca7dd.
2022-12-05 15:46:09 +00:00
Iain Sproat 444d2ca7dd Structured logging (attempt 2) (#1234)
* Revert "Revert "feat(structured logging): implements structured logging for backend (#1217)" (#1227)"

This reverts commit 63e6581162.

* Use pino-http instead of express pino logger
* Use correct reference to knex and do not instantiate HttpLogger prematurely
* Adds missing dependency for pino to webhook-service
* Do not instantiate middleware when passed to express
* Refactor to move logging into shared
* Copy shared packages into dockerfiles
* Build shared workspace in docker build-stage for fileimport & webhook
2022-12-05 14:49:52 +00:00
Iain Sproat a537d34dcc Rate limit all endpoints (#1213)
* Demonstration of bug to test when middleware added
- Adding middleware, even no-op, causes test to fail

* Make middleware async, but introduce delay.
Revert test back to original.

* Revert tests

* Add a 1ms sleep to the test to reduce likelihood of flakiness

* Rate limiting on all express endpoints using middleware

* Adds all configuration for existing rate limited endpoints

* It is helpful to add the package to yarn first

* Implements respectsLimits using Redis rate limiter

* Fix for test `Should rate-limit user creation`
- if rate limit error, post to `/auth/local/register` will return a 429 status code

* All rate limiting provided by new ratelimiter.ts

* Consolidate typescript interfaces

* Amend signature of function to require source to be passed in, and not try to guess it from the request

* Rename respectsLimits to isWithinRateLimits

* Throw within catch of Promise

* Replace rejectsRequestWithRatelimitStatusIfNeeded throughout code

* Sending rate limit response should deal with other types of error
- Sentry notified of the error

* Express middleware rate limits by a 3 second burst or a daily rate
- Provide action when generating 429 response

* Prevent DOS of Redis

* Add 'Retry-After' for all cases when responding with 429 status code
- default of 1 day, but dynamic based on available information

* Generate rate limiters once, on init
- Improved and consistent handling of exit from functions
- fixed environment variable names

* WIP Refactor rate limiting setup

Co-authored-by: Iain Sproat <iainsproat@users.noreply.github.com>

* WIP: fixed references, now runs but tests fail

* Use getSourceFromRequest where possible

* WIP: unit tests for rate limiter

* Unit tests for ratelimiter

* feat(IFC): WIP IFC parser improvements

* Revert "feat(IFC): WIP IFC parser improvements"

This reverts commit 093089a2c4.

* refactor authz, rate limiting middleware to global

Co-authored-by: Kristaps Fabians Geikins <fabis94@users.noreply.github.com>
Co-authored-by: Iain Sproat <iainsproat@users.noreply.github.com>

* invites tests fix

* fix(server ratelimiter): export public interfaces

* Unit test for rate limiter use in memory rate limiter
- in memory rate limiter is configured with zero limit by default

* Fixed #1219 (#1221)

* WIP: improve auth test for rate limiting user creation

* ci(circleci config): publishing was broken when main branch was tagged (i.e. for releases) (#1224)

* Gitignore CPU profiles

* All tests are  now passing locally

* Fixed an issue in the frontend which was causing the views not to work. Fixed an issue with object selection camera animation where the dolly lerp factor was much too high for smooth animation (#1225)

* feat(structured logging): implements structured logging for backend (#1217)

* each log line is a json object
* structured logging allows logs to be ingested by machines and the logs to be indexed and queried addresses #1105
* structured logging allows arbitrary properties to be appended to each log line, and ingestion of logs to remain robust
* Structured logging provided by `pino` library
* Add `express-pino-logger` dependency
* Remove `debug`, `morgan`, and `morgan-debug` and replace with structured logging
* `console.log` & `console.error` replaced with structured logging in backend
* Remove `DEBUG` environment variable and replace with `LOG_LEVEL`
- Note that there is a test which reads from a logged line on `stdout`. This is not robust, it would be better to use the childProcess.pid to look up the port number.
* Log errors at points we explicitly send error to Sentry
* Amend indentation of a couple of log messages to align indentation with others

* Revert "feat(structured logging): implements structured logging for backend (#1217)" (#1227)

This reverts commit 84cb74e8b3.

* Move error to core/errors
- augmented typescript types moved to type-augmentations

* Added a missing wait in the screenshot generation loop (#1228)

* refactor(server rest api): remove duplicate rate limit requests

* feat(server rate limits): increase rate limits for the upload endpoints

* chore(server rate limits): final cleanup

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
Co-authored-by: Iain Sproat <iainsproat@users.noreply.github.com>
Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
Co-authored-by: Kristaps Fabians Geikins <fabis94@users.noreply.github.com>
Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
Co-authored-by: Alexandru Popovici <alexandrupopoviciioan@gmail.com>
2022-11-29 17:06:11 +01:00
Iain Sproat 63e6581162 Revert "feat(structured logging): implements structured logging for backend (#1217)" (#1227)
This reverts commit 84cb74e8b3.
2022-11-25 16:57:28 +00:00
Iain Sproat 84cb74e8b3 feat(structured logging): implements structured logging for backend (#1217)
* each log line is a json object
* structured logging allows logs to be ingested by machines and the logs to be indexed and queried addresses #1105
* structured logging allows arbitrary properties to be appended to each log line, and ingestion of logs to remain robust
* Structured logging provided by `pino` library
* Add `express-pino-logger` dependency
* Remove `debug`, `morgan`, and `morgan-debug` and replace with structured logging
* `console.log` & `console.error` replaced with structured logging in backend
* Remove `DEBUG` environment variable and replace with `LOG_LEVEL`
- Note that there is a test which reads from a logged line on `stdout`. This is not robust, it would be better to use the childProcess.pid to look up the port number.
* Log errors at points we explicitly send error to Sentry
* Amend indentation of a couple of log messages to align indentation with others
2022-11-25 16:05:05 +00:00
Kristaps Fabians Geikins db6a3e9367 refactor(server): apollo server v2 -> v3 migration (#1071) 2022-10-06 11:12:16 +03:00
Kristaps Fabians Geikins f991504932 feat: stream access requests (#976) 2022-09-06 11:10:38 +03:00
Kristaps Fabians Geikins ecb9f825bb refactor: email verification flow & email template (#967) 2022-08-31 17:11:19 +03:00
Kristaps Fabians Geikins 651dee0977 feat(server): stream discoverability flag & queries (#948) 2022-08-24 13:46:24 +03:00