Validate javascript syntax in DbConfig.validate()

Description

Javascript functions given in database config or the new javascript endpoints (sync and import_filter) should be syntactically valid, and today are only checked upon load. It would be ideal to validate them before the config is persisted.

We can ensure the functions are valid javascript inside DbConfig.validate() by running them through sgbucket.NewJSRunner(src) and ensuring no error is returned, which should prevent invalid javascript from being set on a config before being persisted.

Activity

Show:

CB robot September 15, 2021 at 10:31 PM

Build sync_gateway-3.0.0-412 contains sync_gateway commit d43596a with commit message:
: Validate Javascript syntax in validate() (#5217)

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Components

Sprint

Fix versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created August 31, 2021 at 12:56 PM
Updated September 21, 2021 at 5:03 PM
Resolved September 15, 2021 at 10:25 PM
Instabug