Repository navigation
perf: add benchmark and improve performance - #64
Conversation
|
Warning Amazon Q Developer for GitHub: end of support On January 30, 2027, AWS will discontinue support for the Amazon Q Developer for GitHub App. New app installations will no longer be available starting November 18, 2026. For capabilities similar to the Amazon Q Developer for GitHub App, explore Kiro and the Kiro GitHub App. For more information about the end of support, see Amazon Q Developer end-of-support announcement on the AWS DevOps Blog. |
There was a problem hiding this comment.
This PR introduces a performance benchmarking suite (bench/navigation.js, bench/render.js) and refactors the app routing/rendering architecture — moving from a monolithic stateful App.jsx with popstate listeners to a cleaner Navigation API–based router with a dedicated router.js module. The Shiki highlighter is also changed from the JS regex engine to the Oniguruma WASM engine (lazy-initialised), and post.config.js gains pre-rendered JSON output for each post at build time.
Critical issues found:
-
post.config.js— Path traversal via unsanitised tag names (security): Tag values from raw frontmatter are used directly as directory components inpath.join(distDir, 'tag', tag)without any normalisation. A tag value containing..or/would write outsidedistDirduring the build. Usepath.basename(tag)or an allow-list to sanitise. -
bench/navigation.js— Shared debug port across sequential Chrome spawns (logic error): Both benchmark profiles spawn separate Chrome processes that all bind to the same hardcodeddebugPort = 9230. The 300 ms grace sleep may not be enough for the OS to release the port, causing the second Chrome to fail to bind silently and the benchmark to either hang or report incorrect results against the wrong process.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
| path.join(distDir, 'index.html'), | ||
| path.join(tagDir, 'index.html') | ||
| ); | ||
| writePage(path.join(tagDir, 'index.html'), '/posts.json'); |
There was a problem hiding this comment.
🛑 Security Vulnerability: Tag values read from raw markdown frontmatter are used directly as filesystem path components without sanitisation. A tag containing .. or path separators (e.g., ../dist/evil) would cause path traversal during the build, potentially overwriting files outside distDir. Sanitise tag values before using them in path.join, for example by using path.basename(tag) to strip directory components.1
Footnotes
-
CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') - https://cwe.mitre.org/data/definitions/22.html ↩
|
|
||
| const root = fileURLToPath(new URL('..', import.meta.url)); | ||
| const previewPort = 4180; | ||
| const debugPort = 9230; |
There was a problem hiding this comment.
🛑 Logic Error: Both fast and mobile profiles use the same hardcoded debugPort = 9230. Each runProfile spawns its own Chrome process against that port. If the Chrome process from the first profile is still releasing the port during the 300 ms grace sleep, the second Chrome will fail to bind on the same port, causing the waitUntil for 'chrome' to silently poll the previous (or a failed) debug endpoint and either return stale targets or timeout. Consider either passing a unique port per profile or ensuring the port is free before spawning the next Chrome instance.
No description provided.