Skip to content

Reject QTI items with entity references instead of raising - #6238

Merged
rtibbles merged 1 commit into
learningequality:unstablefrom
rtibblesbot:issue-6234-f6da72
Sep 30, 2026
Merged

rtibbles merged 1 commit into
learningequality:unstablefrom
rtibblesbot:issue-6234-f6da72

Conversation

@rtibblesbot

@rtibblesbot rtibblesbot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Entity references (&e;) crashed validate_qti_item and perseus_derive, aborting publish or 500ing the sync API.

  • parse_qti_xml raises XMLSyntaxError on entity nodes; existing callers already handle it (is_valid=False, not derivable).
  • Rejected, not resolved: secure_parser keeps resolve_entities=False.
  • Still accepted: entities in attribute values, unused <!ENTITY>, bare <!DOCTYPE>, &amp;.

References

Fixes #6234. Same class as #6229 (comment nodes); reconcile the two parse_qti_xml checks if that lands differently.

Reviewer guidance

  • Tests: validator, derivation, sync-API create, channel publish (item excluded).
  • Not run locally (no pytest in the agent's environment); rely on CI.
  • Error has no column; lineno comes from the entity node.

AI usage

Implemented with Claude Code from a written plan, test-first. I reviewed the diff for scope.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks
@rtibblesbot

🟡 Waiting for feedback

Last updated: 2026-09-30 18:53 UTC

@rtibblesbot
rtibblesbot marked this pull request as ready for review September 30, 2026 18:45
@rtibblesbot
rtibblesbot requested review from a team and marcellamaki September 30, 2026 18:45
@rtibblesbot

Copy link
Copy Markdown
Contributor Author

Outside this PR's scope — tracked under #5998:


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

Unresolved entity nodes crashed schema validation and Perseus
derivation, aborting publish. parse_qti_xml now raises XMLSyntaxError,
so validation returns is_valid=False and derivation treats the item as
not derivable. Covers validator, sync API and publish.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes make sense - and good to see the secure option to not resolve the entities is already set, this is just taking the next step to raise a validation error with them.

@rtibbles
rtibbles merged commit c329743 into learningequality:unstable Sep 30, 2026
13 checks passed
@rtibblesbot
rtibblesbot deleted the issue-6234-f6da72 branch September 30, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[QTI] A QTI item with a DOCTYPE entity reference fails the channel publish

2 participants