Repository navigation
fix(export): exclude raw_html from JSON exports when include_raw_html is false - #116
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Description
JSONExporter.export_report()serialized the report, strippedscrape.raw_html, then calledcalculate_summary()and re-serialized the report — discarding the cleanup and leaking raw HTML into exports even withinclude_raw_html: false. Additionally,BaseExporter._serialize_item()only removed the top-levelraw_htmlkey, never the nesteddata["scrape"]["raw_html"]found inAnalysisReportexports (e.g.quick).Changes:
export/json.py—export_report()now runscalculate_summary()before the single serialization; the redundant post-serialization cleanup block was removed. Controls (_started,_finalized,ExportWriteError, stream/file writing) are unchanged.export/base.py—_serialize_item()stripsraw_htmlfrom both the top level and the nestedscrapemapping (copying the sub-dict first so caller-owned plain dicts are never mutated). Handles absent/null/non-mappingscrapewithout raising.include_rawandexclude_nonesemantics untouched.Verified end-to-end via CLI against a local loopback server: with
CIBERWEBSCAN_EXPORT_INCLUDE_RAW_HTML=falsethe exported JSON contains noraw_htmlkey; withtrueit is present. All otherscrapefields remain intact.Related Issue
None — found during internal code audit.
Type of Change
Checklist
Screenshots (if applicable)
N/A — backend/export change.