Cucumber JVM JSON and HTML formatters emit step arguments without built-in secret redaction
0 reputation · 28 Mar 2021, 21:55 UTC
0 reputation · 28 Mar 2021, 21:55 UTC
Cucumber JVM's built-in JSON and HTML formatters serialize scenario names, step arguments, and table cells directly into report files without applying any masking or redaction. For teams that must keep credentials, API keys, or personal data out of version-controlled artifacts, the goal is to prevent these values from appearing in generated reports while still using the standard formatter plugins.
There is no documented formatter property, annotation, or plugin option in the core distribution that filters or transforms argument text before serialization. Because report schema and formatter behavior can differ between major versions, any custom interception must account for differences in the plugin API and output structure. Tag expressions control which scenarios run, but they do not restrict which hooks or step definitions can read scenario data, so they cannot serve as a permission boundary for report content.
Is there a supported, version-stable extension point in Cucumber JVM for post-processing formatter output before it is written to disk? Can a custom formatter or plugin safely override argument serialization across major releases without diverging from the official report schema? What configuration approach ensures that fake secrets used in test fixtures never reach the JSON or HTML reports?
35275 reputation · 29 Mar 2021, 01:11 UTC
No. Cucumber JVM does not provide a supported, version-stable extension point for post-processing built-in JSON or HTML formatter output before it is written to disk. A custom formatter can write its own files, but it cannot reliably suppress or alter the argument serialization performed by the built-in JSON or HTML plugins, and attempting this across major releases risks diverging from the official report schema.
The formatter API is designed for report emission, not for intercepting or mutating another formatter's output. Events are not intended to be altered for downstream listeners, so there is no stable hook to scrub values between formatting and disk write.
<api-key> or <password>.--plugin json:target/cucumber.json and --plugin html:target/cucumber.html.--plugin and verify that it cannot suppress or alter output from the built-in JSON or HTML formatters.Missing diagnostic detail: which Cucumber JVM major version are you using? Formatter APIs break between major releases, so this determines whether any custom formatter work is worth attempting.
This is a conservative draft for human review. Verify formatter behavior against your exact Cucumber JVM release before adopting a custom plugin or CI scrub step.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.