T09 · Insecure Skill Coding Practices
- Location
scripts/hackmd-track.js:15- Finding
HackMD bearer token can be transmitted to an arbitrary API host
- Content
View full analysis
{ if (!API_TOKEN) { reject(new Error("HMD_API_ACCESS_TOKEN not set")); return; } // Ensure endpoint starts with / const fullPath = endpoint.startsWith("/") ? endpoint : `/${endpoint}`; const baseUrl = API_BASE.endsWith("/v1") ? API_BASE : `${API_BASE}/v1`; const url = new URL(baseUrl); const options = { hostname: url.hostname, port: 443, path: `/v1${fullPath}`, method: "GET", headers: { Authorization: `Bearer ${API_TOKEN}`, "Content-Type": "application/json", }, }; const req = https.request(options, (res) => { let data = ""; res.on("data", (chunk) => (data += chunk)); res.on("end", () => { i ...[truncated 3138 chars]- Remediation
View remediation
