fix(ingestion): structural lxml.html strip; serve posting both ways (closes py/bad-tag-filter) - #19
Merged
Merged
Conversation
…ing both ways The HTML-comment regex (_NON_RENDERED_RE) only knew the standard comment, script and style carriers. CodeQL flagged it (py/bad-tag-filter); a bench confirmed the bogus-comment class (bang, processing-instruction and bogus end-tag forms) survived the regex and reached the model verbatim. The robust fix is structural: be the parser. - _strip_non_rendered parses with lxml.html and drops the nodes the parser classifies as non-rendered (comment / processing-instruction) plus script/style; visible text and trailing tail are preserved. Regex removed. - load_job_posting accepts offer_path OR offer_body (exactly one), making the sanitised path the convenient one on the chat surface (finding C). Residual named: on offer_body the model already read the raw body, so the strip defends downstream propagation, not that first read. - manifest load_job_posting description synced to the both-ways contract. - Floor: falsify-first guards [2c] + [2d] (258 -> 270). [2c] asserts the version-robust invariant "zero non-rendered node survives" (libxml2 2.11.9 downgrades the bogus end-tag form to the visible channel rather than removing it -- the documented visible residual), not "payload dropped".
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.
Replaces the carrier-enumerating regex ingestion strip with a structural lxml.html parser, and opens load_job_posting to both offer_path and offer_body (finding C).
Why: CodeQL flagged _NON_RENDERED_RE (py/bad-tag-filter). A bench confirmed the bogus-comment class survived the regex and reached the model verbatim. Enumerating carriers is a deny-list by nature; the robust fix is to be the parser.
Changes:
Closes the py/bad-tag-filter sink (regex removed). refs #282 unaffected.