Commit 0c0a715
[UPDATE PRIMITIVE] Fix markdown injection and platform-dependent path tests in prompt handlers (#162)
* Initial plan
* Fix markdown injection and platform-dependent path tests in prompt handlers
- Add sanitizeForInlineCode() helper to escape backticks and newlines in user-supplied values embedded in markdown code spans
- Apply sanitizer to resolvePromptFilePath 'does not exist' warning (filePath and absolutePath)
- Apply sanitizer to formatValidationError issue.received display
- Fix POSIX path separator assumptions in tests: use basename only ('mydb', 'database')
- Rename createSafePromptHandler tests to clarify they validate the handler wrapper, not MCP SDK validation
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/2660567b-5822-4505-91c2-37fe3ef00f4e
* Replace sanitizeForInlineCode with CommonMark-compliant markdownInlineCode
- markdownInlineCode() uses a fence length = maxRun+1 per CommonMark spec,
preserving the original string (no information loss from backtick→apostrophe)
- Normalises CR/CRLF to LF before wrapping (inline spans can't span lines)
- Export markdownInlineCode for testability
- Add 6 unit tests for markdownInlineCode (plain text, single/double backtick,
CRLF normalisation, backtick-only values)
- Add regression test for formatValidationError with backtick in received value
- Add regression test for resolvePromptFilePath warning with backtick in path
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/ec7c534b-93ac-40e5-bcb6-023bc7496940
* Fix markdownInlineCode to replace newlines with spaces for single-line output
Replace \r\n, \r, and \n with a space (not just normalize CRLF to LF) so
the returned inline code span never contains a literal newline character.
Update docstring and test to reflect space-replacement behavior.
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/87cfd54e-9d66-4871-a581-601aff3c6c8d
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>1 parent 0db4c6d commit 0c0a715
File tree
4 files changed
+124
-10
lines changed- server
- dist
- src/prompts
- test/src/prompts
4 files changed
+124
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64468 | 64468 | | |
64469 | 64469 | | |
64470 | 64470 | | |
| 64471 | + | |
| 64472 | + | |
| 64473 | + | |
| 64474 | + | |
| 64475 | + | |
| 64476 | + | |
| 64477 | + | |
| 64478 | + | |
| 64479 | + | |
| 64480 | + | |
| 64481 | + | |
| 64482 | + | |
| 64483 | + | |
| 64484 | + | |
| 64485 | + | |
| 64486 | + | |
| 64487 | + | |
64471 | 64488 | | |
64472 | 64489 | | |
64473 | 64490 | | |
| |||
64503 | 64520 | | |
64504 | 64521 | | |
64505 | 64522 | | |
64506 | | - | |
| 64523 | + | |
64507 | 64524 | | |
64508 | 64525 | | |
64509 | 64526 | | |
| |||
64599 | 64616 | | |
64600 | 64617 | | |
64601 | 64618 | | |
64602 | | - | |
| 64619 | + | |
64603 | 64620 | | |
64604 | 64621 | | |
64605 | 64622 | | |
| |||
0 commit comments