( originalPath: string, content: string, )
| 192 | // note that actually contains a runnable js fence is treated as executable, so |
| 193 | // plain `.md` templates are not flagged. Pure/App-free — operates on the payload. |
| 194 | function markdownAssetIsExecutable( |
| 195 | originalPath: string, |
| 196 | content: string, |
| 197 | ): boolean { |
| 198 | if (!MARKDOWN_FILE_EXTENSION_REGEX.test(originalPath)) return false; |
| 199 | let decoded: string; |
| 200 | try { |
| 201 | decoded = decodeFromBase64(content); |
| 202 | } catch { |
| 203 | return false; |
| 204 | } |
| 205 | const { code } = extractScriptFromMarkdown(decoded); |
| 206 | return code !== null && code.length > 0; |
| 207 | } |
| 208 | |
| 209 | // The runnable code of a bundled executable asset, for static disclosure scans: |
| 210 | // a `.md` note yields its first js fence (what the loader runs); any other |
no test coverage detected