MCPcopy Create free account
hub / github.com/chhoumann/quickadd / markdownAssetIsExecutable

Function markdownAssetIsExecutable

src/services/packagePreview.ts:194–207  ·  view source on GitHub ↗
(
	originalPath: string,
	content: string,
)

Source from the content-addressed store, hash-verified

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.
194function 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

Callers 1

buildPackagePreviewFunction · 0.85

Calls 2

decodeFromBase64Function · 0.90

Tested by

no test coverage detected