April 29, 2026

Markup, Ollama, and Migration Overhauls

Significant code quality and security improvements across markup rendering, Ollama service, and XML migration logic were made

Significant code quality and security improvements across markup rendering, Ollama service, and XML migration logic were made.

In markup rendering, parsers were replaced with purpose-built tools like mistune, html.parser, and DOMParser, eliminating numerous Sonar ReDoS and complexity hotspots.

Markup rendering now uses browser’s HTML parser in frontend implementations, ensuring attribute handling is sanitized via canonical URL generation.

Ollama service error handlers were refactored to drop unnecessary parameters, removing data-flow paths that previously triggered CodeQL alerts regarding sensitive data logging.

The Ollama service validation now strictly validates host and model configurations at the source, acting as a sanitization barrier against tainted input.

In XML migration, content rewriting was adjusted to skip non-assistant roles, preventing unformatted user or tool content from leaking into the chat UI.

Several Sonar and CodeQL alerts across markup and Ollama were closed by removing suppressed markers and refactoring error logging.

The dependencies were updated, adding mistune>=3.0.0 to requirements.

  • Replaced regex-driven parsers with mistune, html.parser, and DOMParser, resolving 11 quality-gate hotspots.

  • Ollama error handlers removed payload parameters to break taint flow leading to clear-text logging alerts.

  • Markup rendering now uses browser’s HTML parser, sanitizing attribute values through canonical URL generation.

  • XML migration now skips content rewriting for non-assistant roles to prevent UI leakage.

  • Strict validation added to Ollama service initialization for host and model configurations.

  • Dependencies updated to include mistune>=3.0.0.