Commit Graph

87 Commits

Author SHA1 Message Date
Iain Sproat ced6eab7b0 feat(models): allow number of models retrieved per page to be configu… (#1868)
* feat(models): allow number of models retrieved per page to be configurable by environment variable
* Default to 100, as this was the existing value, but allow override via helm chart
2023-11-10 12:34:28 +00:00
Kristaps Fabians Geikins a3c4778a09 feat(server): disable mixpanel in test/dev envs 2023-09-27 10:57:31 +03:00
Kristaps Fabians Geikins eb441d7f4f feat(fe2): automations status subscriptions (#1793)
* fe subscriptions working

* minor adjustment
2023-09-18 15:03:42 +03:00
Gergő Jedlicska f6219fa5bf fix auth pipeline guest permissions (#1772) 2023-08-24 14:56:22 +02:00
Gergő Jedlicska ad1fba7fea Merge branch 'main' of github.com:specklesystems/speckle-server into gergo/serverGuest/main 2023-08-01 16:01:24 +02:00
Gergő Jedlicska 296ecc8340 chore(server): remove dead comment 2023-08-01 15:03:19 +02:00
Gergő Jedlicska 105f1c0b54 refactor(server authz): rework validateServerRole 2023-08-01 14:58:55 +02:00
Iain Sproat f568f54266 **Breaking Change**: fix(email): from address must be provided by operator if email is enabled (#1743) (#1745)
This reverts commit 0a795c51f2.
2023-08-01 11:49:08 +01:00
Gergő Jedlicska cb3dbb7a9d refactor(server/shared): reduce (but not fix) circular dependencies 2023-08-01 12:11:47 +02:00
Iain Sproat 0a795c51f2 Revert "**Breaking Change**: fix(email): from address must be provided by operator if email is enabled (#1743)" (#1744)
This reverts commit 3f9dd5f914.
2023-08-01 10:13:54 +01:00
Iain Sproat 3f9dd5f914 **Breaking Change**: fix(email): from address must be provided by operator if email is enabled (#1743)
* fix(email): from address should be an example to be configured by operator

* fix(environment variable): should be 'EMAIL_FROM'
- also uses docker_image_tag of '2', which should be latest in '2' tags

* No sensible defaults, instead validate that it is configured
2023-07-31 17:37:06 +01:00
Kristaps Fabians Geikins 951d86aa3e feat(server): cross-server onboarding stream sync + DL project CLI command (#1717)
* WIP

* cleanup and sync MVP kinda done

* WIP

* logging improved a bit

* fixed version sorting

* onboarding base stream creation works

* moved onboarding stream to use new base
2023-07-31 11:44:39 +03:00
Gergő Jedlicska 7a92730a0d fix(server auth): make sure to not throw null 2023-07-28 11:20:03 +02:00
Gergő Jedlicska 172357dfd1 refactor(server): use auth pipeline server role validator for gql auth 2023-07-28 11:15:52 +02:00
Gergő Jedlicska 99bd946f09 feat(server): revert env var based guest role flag
we're going for an admin modifiable flag, that needs to be stored
in the server config table
2023-07-27 17:02:29 +02:00
Gergő Jedlicska 2fa8a21754 feat(server): implement switch user role to guest 2023-07-27 13:30:32 +02:00
Gergő Jedlicska 3334d5b482 Merge branch 'gergo/serverGuest/main' of github.com:specklesystems/speckle-server into gergo/serverGuest/constantsRefactor 2023-07-26 21:45:28 +02:00
Gergő Jedlicska 5942c09671 feat(server, helm): add guest role feature flag 2023-07-26 21:00:51 +02:00
Gergő Jedlicska 6ea7aa8236 refactor roles to shared constants 2023-07-26 11:59:54 +02:00
Kristaps Fabians Geikins 80df259159 feat(server): improved cross-server commit/version download (#1711) 2023-07-19 11:43:06 +03:00
Iain Sproat 9f0418893f chore(objects upload): improves response when error due to large object size (#1685)
* test(objects upload): adds a test for large object
* print object too large messages in response
* allows object maximum size to be configured
2023-07-12 10:57:59 +01:00
Iain Sproat 2d0d4b3d9a fix(ip logging): handle ip addresses in header x-original-forwarded-for (#1686) 2023-07-11 23:00:42 +01:00
Dimitrie Stefanescu 802f3c9924 fix(fe2): newsletter changes 2023-06-22 16:35:49 +01:00
Dimitrie Stefanescu d5bb3b9923 feat(server): mailchimp plumbing 2023-06-16 13:34:04 +01:00
Kristaps Fabians Geikins 440adbd3f9 feat: checking schema changes against apollo studio (#1603) 2023-05-30 12:35:15 +03:00
Kristaps Fabians Geikins f83118977e fix(server): subscription request logging 2023-05-23 12:20:40 +03:00
Kristaps Fabians Geikins a42ee35c09 fix(server): self-cleaning sub dataloaders + Comment.data type change 2023-05-22 21:00:27 +03:00
Kristaps Fabians Geikins b02a07e2b6 feat: Frontend 2.0 MVP 2023-05-08 10:47:01 +03:00
Gergő Jedlicska 89dccd8495 feat(server): add speckle automate as a configurable default app (#1540)
* feat(server): add speckle automate as a configurable default app

* feat(server): add default automate url, and helm values

* fix default app tests reporting the old number
2023-04-19 12:59:59 +02:00
Dimitrie Stefanescu d402837f9a fix(server): prettier saves the day as always (snark) 2023-04-15 12:46:02 +01:00
Dimitrie Stefanescu 6cc1046a86 fix(server): logging ipv6 catches 2023-04-15 12:39:24 +01:00
Iain Sproat 43c339bccf fix(logging): use broadcast address to mask logged ip (#1532) 2023-04-13 19:43:54 +01:00
Iain Sproat 8bc04f97d9 fix(logging): hash ip for all requests with an ip (#1531) 2023-04-13 17:38:17 +01:00
Iain Sproat 122f4c731f feat(log): log the ip address if a user is not logged in (#1527)
- we do not log both the ip if the user is signed in, as this may be a privacy issue
- the ip is only logged if there is no associated user information
2023-04-13 14:57:07 +01:00
Gergő Jedlicska 84ea2b1043 fix(server): make sure apollo logging works and it doesn't leak sensitive stuff (#1520) 2023-04-12 13:39:03 +01:00
Iain Sproat 4c723781b5 feat(server): authentication middleware should log auth context creation status (#1508)
* feat(server): authentication middleware should log auth context creation status
- this uses the pino http logger provided via prior express middleware, ensuring a request ID is associated with the log messages
- userID, scopes and roles will be logged
* Appends the authContext to the req.log, which makes it available on all subsequent calls
2023-04-11 18:43:46 +01:00
Iain Sproat 6c66049248 feat(logging): log apollo (graphql) requests and responses (#1509)
* feat(logging): log apollo (graphql) requests and responses
2023-04-11 18:42:40 +01:00
Kristaps Fabians Geikins 483a28c211 fix(server): correct server_id format (#1495) 2023-03-30 16:37:24 +03:00
Kristaps Fabians Geikins 5d5c0e012f feat(server): awaitable track calls (#1493) 2023-03-30 15:54:24 +03:00
Kristaps Fabians Geikins 9f50a11188 feat(server): extra server tracking props + better logging (#1492) 2023-03-30 15:04:11 +03:00
Kristaps Fabians Geikins 5d0fceaaf3 feat: proper sign up tracking (#1489)
* feat: register flag passed to fe

* feat: mixpanel tracking for all sign ups

* feat: utm first touch & last touch tracking

* feat(helm): Allows Environment Variable for MP to be configured
- default is enabled
- renames environment variable to ENABLE_MP

* feat(helm network policy): allowlist analytics.speckle.systems

---------

Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
2023-03-30 12:21:59 +03:00
Gergő Jedlicska 4e3e1de8d2 gergo/invalid token throw (#1444)
* fix(server authz): make sure to forbid access with invalid tokens

fix #927

* test(server authz tests): update tests to reflect the changes in the invalid token forbidden flow
2023-03-13 14:07:49 +01:00
Iain Sproat 9ed1656541 fix(redis): Redis errors should be logged in a structured manner (#1389)
- errors should be logged to stdout in a structured format
- currently still throws errors which are ultimately unhandled, this matches existing behaviour
- Consolidate redis creation and error handling in a shared module
* remove unused 'redis' module, in favour of 'ioredis'
2023-02-22 09:13:05 +00:00
Gergő Jedlicska 40a6701799 feat(server): add switchable admin authz override (#1378)
* feat(server): add switchable admin authz override

* fix(server): make sure tests work with the new admin override

* feat(server authz): make sure to add all requested roles to server admins in admin override mode
2023-02-17 16:31:06 +01:00
spgoad 38720cecdc Feature: Add OpenID Connect Generic Authentication Strategy (#1283)
* feat(server): add OIDC auth strategy

Add an OpenID Connect Authentication Strategy for Speckle Server. Enables configuration of
authentication against an OIDC standard compliant identity provider endpoint.

closes specklesystems#1270

Co-authored-by: spencer.goad <spencer.goad@disney.com>
2023-01-09 13:41:50 +00:00
Iain Sproat 96bed71022 fix(logging): Improves error logging and pretty-prints logs during dev & test (#1255)
* Improves error logging
- use pino error logger correctly by passing in error as first argument

* monitor deployment: Filter logging at INFO level and above
* Use structured logging to create parameters for monitoring results
* Add structured logging to obj fileimport service
* Fileimport service, fix and improve logging
    - use child logger with additional context where possible
    - select appropriate logging level
- fix duplicated context in log statement
* REST endpoints, add context to structured logging and remove same context from message
* Webhook service provides context to bound logger to properly use structured logging
    - Pass bound logger containing context to `makeNetworkRequest`
    - do not log url, as it may contain a secret (like Discord's webhook urls), instead log the webhook Id
     - log error message when network call fails
* upload: make better use of structured logging when recording data
* pino-pretty when in dev or test mode
    - pino-pretty configured to send to stderr
* LOG_PRETTY env var
* Silence structured logging during testing
     - can not rely on determining the port number by reading from stdout/stderr
     - instead we determine which port is free, then create our server on that port
     - we then poll that port until the server is ready before commencing tests
* Allow puppeteer to install chromium
* Do not need to install chromium separately
2022-12-13 09:18:28 +00: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