Links
Problem
#59 added a guard rejecting a reference_doc whose type does not match output_format, because pandoc does not check this and fails silently when it is wrong.
The guard only inspects the reference_doc parameter. Pandoc's --reference-doc can also be set inside a defaults file, via the reference-doc: key, and that path is passed through to pandoc unvalidated.
# my-defaults.yaml
reference-doc: /templates/house.docx
convert-contents(output_format="odt", defaults_file="my-defaults.yaml")
│
▼
reference_doc parameter is None ──► guard never runs ✅ skipped
│
▼
extra_args = ["--defaults", "my-defaults.yaml"]
│
▼
pandoc applies reference-doc from the YAML, exit 0, silent
│
▼
"Content successfully converted and saved to: out.odt" ← file is broken
Behaviour being bypassed
Verified on pandoc 3.7.0.2. All combinations exit 0 with nothing on stdout or stderr.
| Output |
Reference type |
Result |
| docx |
.odt / .pptx |
Reference silently discarded. Output byte-identical to using no reference, so the document ships unstyled |
| odt |
.docx / .pptx |
Writes an ODF package containing the OOXML word/ tree and no root styles.xml. Pandoc cannot read back the file it just wrote: Could not find styles.xml |
Scope
Pre-existing, not a regression from #59. The parameter path is now guarded; this one is not.
Lower severity than the parameter path: a defaults file is a deliberate artifact a user authors once, rather than something a model fills in per call. But the failure mode is identical, and the tool still reports success.
Acceptance criteria
Out of scope
Whether to validate other pandoc options reachable through defaults_file. Worth a separate look at what else the defaults path can smuggle past validation.
Links
src/mcp_pandoc/server.py→handle_call_tool, thereference_docvalidation blockProblem
#59 added a guard rejecting a
reference_docwhose type does not matchoutput_format, because pandoc does not check this and fails silently when it is wrong.The guard only inspects the
reference_docparameter. Pandoc's--reference-doccan also be set inside a defaults file, via thereference-doc:key, and that path is passed through to pandoc unvalidated.Behaviour being bypassed
Verified on pandoc 3.7.0.2. All combinations exit 0 with nothing on stdout or stderr.
.odt/.pptx.docx/.pptxword/tree and no rootstyles.xml. Pandoc cannot read back the file it just wrote:Could not find styles.xmlScope
Pre-existing, not a regression from #59. The parameter path is now guarded; this one is not.
Lower severity than the parameter path: a defaults file is a deliberate artifact a user authors once, rather than something a model fills in per call. But the failure mode is identical, and the tool still reports success.
Acceptance criteria
reference-docinside adefaults_fileis validated with the same rule as thereference_docparameterOut of scope
Whether to validate other pandoc options reachable through
defaults_file. Worth a separate look at what else the defaults path can smuggle past validation.