-
Notifications
You must be signed in to change notification settings - Fork 3
Description
The JavaScriptBuilderElement
currently has a build option named enableCookies.
This should be configurable per request, and should be disabled by default.
Summary of Steps
- Disable cookies by default,
- Enable configuration of cookies per-detection,
- Add option to evidence keys
- Document the usage of the new feature,
- Add tests for the new feature.
Disable by Default
Setting the option to disabled by default is a simple change to the _enableCookies default in the constructor.
Per-Detection Configuration
To enable configuration per request, an additional evidence key of query.fod-js-enable-cookies should be added, and used in the same way as the existing header.host and header.protocol. Usage of the existing options can be found starting on lines 667-673.
Evidence Keys
The new evidence key query.fod-js-enable-cookies should be added to the evidence keys returned by the engine.
Tests
Tests for this should be added, and include the following:
- With a source JavaScript value that sets a cookie, and default config for the
JavaScriptBuilderElement, the generated JavaScript should not contain any JavaScript that adds cookie values, - With a source JavaScript value that sets a cookie, and the
JavaSctiptBuilderElementbuild withenableCookiesset to true, the generated JavaScript should contain JavaScript that adds cookie values, - With a source JavaScript value that sets a cookie, and the
JavaScriptBuilderElementbuilt withenableCookiesset to each of the possible values, and an evidence value oftruefor the keyquery.fod-js-enable-cookies, the generated JavaScript should contain JavaScript that adds cookie values, - With a source JavaScript value that sets a cookie, and the
JavaScriptBuilderElementbuilt withenableCookiesset to each of the possible values, and an evidence value offalsefor the keyquery.fod-js-enable-cookies, the generated JavaScript should not contain any JavaScript that adds cookie values,
Documentation
Documentation should be added to the builder method to make it clear that it can also be configured per-detection.
The behavior of cookies, and whether or not they are written, should be thoroughly documented in the readme with the their options (pointing to external documentation where necessary).