Skip to content

Enable Per-Detection Configuration of Enable/Disable Cookies #38

@ben51degrees

Description

@ben51degrees

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 JavaSctiptBuilderElement build with enableCookies set to true, the generated JavaScript should contain JavaScript that adds cookie values,
  • With a source JavaScript value that sets a cookie, and the JavaScriptBuilderElement built with enableCookies set to each of the possible values, and an evidence value of true for the key query.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 JavaScriptBuilderElement built with enableCookies set to each of the possible values, and an evidence value of false for the key query.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).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions