Commit Graph

2967 Commits

Author SHA1 Message Date
Gergő Jedlicska bc83391c21 fix(fileimports): fix IFC file imports commit message (#1230) 2022-11-29 18:33:54 +01:00
Dimitrie Stefanescu 573a42c16c Merge pull request #1223 from specklesystems/dim/ifc-v2
Improves IFC parsing speed ~30x & captures object psets
2022-11-29 16:47:38 +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
Alexandru Popovici ddc4e4d17a Added a missing wait in the screenshot generation loop (#1228) 2022-11-29 13:46:18 +02:00
Dimitrie Stefanescu 69c1993f09 feat(ifc): prevents stack overflowing from too many args to array.push 2022-11-27 15:39:58 +00: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
Alexandru Popovici 5ac043ac6a 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) 2022-11-25 16:31:45 +02:00
Dimitrie Stefanescu 950077dcab Revert "feat(ifc): removes stale comment"
This reverts commit 83d2b2bf25.
2022-11-25 09:05:44 +00:00
Dimitrie Stefanescu 48085bffb4 feat(ifc): some tweaks 2022-11-24 20:10:23 +00:00
Iain Sproat 6bfcc35777 ci(circleci config): publishing was broken when main branch was tagged (i.e. for releases) (#1224) 2022-11-24 15:18:18 +00:00
Alexandru Popovici 4e23505fed Fixed #1219 (#1221) 2022-11-24 16:33:37 +02:00
Dimitrie Stefanescu 83d2b2bf25 feat(ifc): removes stale comment 2022-11-23 22:25:18 +00:00
Dimitrie Stefanescu 4ca0e19abb feat(ifc): fixes error capture on commit creation 2022-11-23 22:24:15 +00:00
Dimitrie Stefanescu 82af820a7c feat(ifc): fix file id propagation for ifc parser 2022-11-23 22:14:31 +00:00
Dimitrie Stefanescu d61f566b96 Merge branch 'main' into dim/ifc-v2 2022-11-23 22:00:48 +00:00
Dimitrie Stefanescu ca9d8d8515 feat(IFC): making gitguardian happy, removed my localhost access token 2022-11-23 21:57:20 +00:00
Dimitrie Stefanescu 44f2af2a2e feat(IFC): reverts path to temp output 2022-11-23 21:50:54 +00:00
Dimitrie Stefanescu 2b0e4a7dd5 feat(IFC): adds file id and parsing time to root commit object 2022-11-23 21:26:26 +00:00
Dimitrie Stefanescu 16c989e43c feat(IFC): WIP IFC parser cleanup 2022-11-23 21:00:51 +00:00
Dimitrie Stefanescu 9ac75eecd8 feat(IFC): WIP IFC parser improvements 2022-11-23 19:53:21 +00:00
Dimitrie Stefanescu 1ba31ee372 Revert "feat(IFC): WIP IFC parser improvements"
This reverts commit 093089a2c4.
2022-11-23 19:20:16 +00:00
Dimitrie Stefanescu 093089a2c4 feat(IFC): WIP IFC parser improvements 2022-11-23 18:55:06 +00:00
AlexandruPopovici eb1baf3eca Commented out waiting for progressive AO convergence 2022-11-22 16:48:25 +02:00
Iain Sproat c53688c67e CI(CircleCI): Halt building if a draft PR (#1214)
* Halt building if a draft PR
2022-11-21 11:20:36 +00:00
Dimitrie Stefanescu 22278af8d1 Merge pull request #1205 from specklesystems/dim/viewer-1201
Dim/viewer 1201
2022-11-15 15:28:30 +00:00
AlexandruPopovici 93c5810387 Added the new API member inside IViewer. Fixed a typo inside a comment 2022-11-15 15:07:43 +02:00
Dimitrie Stefanescu 5b98fdc574 feat(viewer): drives iteration so we only traverse the world tree once, rather than n times 2022-11-15 11:30:52 +00:00
Kristaps Fabians Geikins f0524b53db fix: various security alert fixes (#1202)
* fix: some extra param validation for some API endpoints

* fix(server): potentially leaking internal error details

* fix: secure session cookie for ssl servers

* fix(server): fixing tests
2022-11-15 12:30:13 +02:00
Dimitrie Stefanescu 6f78f3597a feat(viewer): adds method to set colors by object ids from userspace (re #1201) 2022-11-14 20:30:53 +00:00
Gergő Jedlicska 3d6653f73b hotfix/2.9.2 (#1175)
* Update to new specklepy (#1173)

* Publish images for all branches but limit tagging
* only tag 'latest' and '2' when 'SHOULD_PUBLISH' variable is 'true'

* Publishing helm chart should check for `SHOULD_PUBLISH`

* Move blocking step to publish-helm chart, and allow images to be published

* Pin python requirements and bump to latest versions

* Fix EOL whitespace

* use valid version for psycopg2-binary (the clue is in the 2!)

* fix(fileimports): add exception printing to file imports

* fix(fileimports): bump specklepy version

move to a specklepy version that contains a fix for send without writing to disk

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

* Fixes liveness and readiness checks to prevent CSRF error message (#1169)

- provides content-type header
- check that status code is 200

* Fixes broken helm template by adding quotation marks around liveness probe command (#1171)

* fix(server activities): make sure the stream events are properly dispatched

* feat(server webhooks): add scheduled orphaned webhook cleanup

* test(server webhooks): add test to webhook cleanup service

* feat(server webhooks): drop foreign key reference for webhooks schema to streams

* refactor(server req context): refactor req context to have the ip attribute for all requests

* feat(server objects rest api): add ratelimits to objects rest api endpoints

* fix(server rest api): properly handle returning 419

Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
2022-11-09 13:23:32 +01:00
Iain Sproat 071a9588dd ci(snyk): snyk vulnerability scan of yarn package.json (#1192)
* ci(snyk): snyk vulnerability scan of yarn package.json
* Run with strict-out-of-sync=false
* only runs for main branch to prevent pollution of Snyk's dashboard with branches
2022-11-09 12:06:50 +00:00
Iain Sproat 8c067b1ad7 fix(preview-service prometheus): additional buckets in prometheus histogram (#1184)
All previews were in the 600 to infinity bucket of the histogram, rendering it effectively useless.
This PR adds additional larger buckets at 1200 and 1800 ranges to provide better granularity.
2022-11-04 18:21:37 +00:00
Dimitrie Stefanescu 464078893d Merge pull request #1183 from specklesystems/alex/ao-max-param
Fix for incorrect AO halos
2022-11-04 14:30:13 +00:00
AlexandruPopovici acc2e9688d Removed the maxDist calculation from the loop 2022-11-04 15:28:39 +02:00
AlexandruPopovici dc3fd1dfb1 Removed min and max distance from the sandbox UI since they are no longer used as params 2022-11-04 15:01:09 +02:00
AlexandruPopovici 7c6a09e4a5 Removed some debug code 2022-11-04 14:50:28 +02:00
AlexandruPopovici a0f7fdb50f Fixed an issue which was driving me crazy regarding the progressive AO. The high depth delta limit was set as a uniform parameter which did not work well for all possible stream dimensions and sizes. One of the consequences were some ghastly halos around poles of any kind in streams of a particular range of dimensions. We dropped the uniform parameter and replaced it with the normalized sampling ray length. This works well in general, the halos are gone. There's only one downside, when the camera gets really close to objects, the AO range drops more than we'd want. However it's not very visible and it's something I can live with 2022-11-04 14:47:32 +02:00
Iain Sproat de9beccd22 Helm test is deployed as a job (#1174)
- this allows it to be identified in alerting more easily
2022-11-02 17:16:53 +00:00
Gergő Jedlicska c06650c475 Update to new specklepy (#1173)
* Publish images for all branches but limit tagging
* only tag 'latest' and '2' when 'SHOULD_PUBLISH' variable is 'true'

* Publishing helm chart should check for `SHOULD_PUBLISH`

* Move blocking step to publish-helm chart, and allow images to be published

* Pin python requirements and bump to latest versions

* Fix EOL whitespace

* use valid version for psycopg2-binary (the clue is in the 2!)

* fix(fileimports): add exception printing to file imports

* fix(fileimports): bump specklepy version

move to a specklepy version that contains a fix for send without writing to disk

Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
2022-11-02 12:57:46 +01:00
Iain Sproat fc2534e9b4 Always build, except when branch (not main) does not have PR (#1167)
* Always build, except when branch (not main) does not have PR

* Logic fix

* Should fail the step

* Debug

* More circleci debugging

* More and more circleci debugging

* More more more debugging

* Attempt to explicitly exit

* 🤦 the script required a passing line in order to exit non-zero
2022-11-02 12:45:15 +01:00
Iain Sproat df250d616d Fixes broken helm template by adding quotation marks around liveness probe command (#1171) 2022-11-02 10:40:03 +00:00
Iain Sproat 0c99573bc6 Fixes liveness and readiness checks to prevent CSRF error message (#1169)
- provides content-type header
- check that status code is 200
2022-11-02 10:01:19 +00:00
AlexandruPopovici 048f1de3c9 Debuging bad max param 2022-11-02 10:16:07 +02:00
Alexandru Popovici 9abeb2645b New progressive rending pipeline. Progressive ambient occlusion (#1156)
* Started working on progressive sao

* Started working on the ao generation stage shader and pass

* Continued with progressive SAO. Added the accumulation pass

* Implemented progressive AO using the same estimator as for the dynamic one.

* First draft of progressive AO with multiple selectable estimators. WIP on final implementation

* Restructuring how the pipeline and it's passes work so we can extend/configure them more easily. Added the concept of SpecklePass

* A lot of changes. Pipeline rework is more or less complete. Added individual output for some pipeline passes that we might want to inspect inside the sandbox.

* Finished with displaying individual pipeline stages

* Intruduced accumulation frames properly at pipeline level. Cleaned up progressive AO shader and pass. Exposed the number of accumulation frames as well as the kernel size in the sandbox.

* Accumulation frame count is now reset after a resize

* In the end I just implemented my own stationary/dynamic detection routine since the events sent from the 'camera controller' are dogshit

* Implemented interpolating during frame accumulation between the dynamic SAO and the static AO. This makes the transition much more smooth and seamless than simply jumping straight to the static AO which begins accumulating from 0

* Added configurable intensity to static AO. Fixed an issue with static scenario detection where the accumulation frames were ran twice in succession, because the 'camera controller' is probably clamping the angles to X decimal points at the end of a camera motion cycle, which in turn triggers a camera move larger than our defined epsilon

* Dynamic AO at half res

* Some improvements to how we update the rendering pipeline and it's dynamic and progressive states

* Trying to fix the issue with artifacts on progressive AO on mac. seems to be depth encoding related. Changed the depth pass to render to 32 float texture to check if the artifacts are gone

* Trying out a new float->RGBA encoding and decoding

* Added ner and far camera planes controls to see how they're values change depth encoding precision

* Finally managed to get AO properly working with encoded linear depth

* Trying 24 bit encoding

* Fix for the macOS artifacts using linear depth buffer and a bias value

* Extended the camera controller class and added/changed a few things so that the controller doesn't mess up our camera movement and also we now rely on the events sent by it to determine stationary vs dynamic camera scenarios. This way we spare the rendered from having to determine camera movement deltas by itslef(only to have it ruined by the camera controller anyway)

* Added switching between perspective and linear depth when going from dynamic AO to progressive AO, so we don't have to integrate linear depth buffer sampling in the already existing features

* Disabled normal texture rendering for dynamic AO

* Some fixes and added dynamic AO back in at half res

* Fixed an issue with converging progressive pipeline when using a trackpad

* Implemented relative dynamic progressive AO kernel size

* Fixed compile error

* Fixed an issue with macOS and depth texture filtering

* Added half res depth buffer switching for dynamic AO

* Changed some params now that dynamic AO is at half res

* Made section boxes work properly with our new progressive pipeline

* Added correct kernel size computation for orthographic projection

* Patched the camera controls to send events when zooming in orthographic mode

* Some more integrations with camera views and fixed a bug with bad pipeline resets

* Small fix for zoom and startup reset

* Various fixes of issues I could find

* Removed longs

* preview-service now waits for the pipeline to convgerge before taking the screenshot

* Handled #1110. Added the concept of 'ObjectLayers' which uses three's existing implementation for selective layer rendering/lighting/picking. Also added the BaseSpecklePass abstract class which provides a default implementation for any subclassing pass that needs to use specific layers when rendering.

* Added more time between frames for the preview service. It seems to be generating the previews properly now

Co-authored-by: Alex <alex@192-168-0-159.rdsnet.ro>
Co-authored-by: Alex <alexandru.popovici@busymachines.com>
2022-11-01 16:30:36 +02:00
Iain Sproat 3d4b3b6979 Pin python requirements and bump to latest versions (#1140)
* Pin python requirements and bump to latest versions
* fix(fileimports): add exception printing to file imports

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
2022-11-01 11:17:03 +00:00
Iain Sproat 1dac1e43b6 Fix build.sh as regex had features not available in bash regex (ere flavor) (#1166) 2022-11-01 11:03:15 +00:00
AlexandruPopovici fa9ad5b651 #1136 Removed ctrl+click debug feature 2022-11-01 11:46:25 +02:00
Iain Sproat a51ba5f4a9 Circleci manual holds (#1152)
* ci(circleci): introduces manual holds to prevent resource wastage

We were building all commits unnecessarily. The logic was not consistent for versioning and when to
build and when to publish. This PR addresses these issues.

* Replaces `should-build` with `build-approval`
* Replace `should-publish` with `publish-approval`

* Clean up image tagging logic
    - tags as latest when version is semver or semver-alpha.build_number
    - other commits aren't tagged as latest, and instead tagged with their branch name
    - move naming logic to common.sh script

* Push each tag individually to avoid pollution
    - docker engine used is shared amongst all runs of speckle-server pipeline, so pushing all tags indiscrimanately pushes images built on other CircleCI runs 😬

* Improve logging
* Do not require approval for any tagged commit
2022-11-01 08:52:51 +00:00
AlexandruPopovici 6250099687 Added more time between frames for the preview service. It seems to be generating the previews properly now 2022-10-31 16:47:21 +02:00