Skip to content

Latest commit

 

History

History
31 lines (16 loc) · 1.66 KB

File metadata and controls

31 lines (16 loc) · 1.66 KB

TODO

Critical

  • Resource leaks on errors - Curl handles aren't always closed if JSON decoding fails or exceptions occur during requests (FIXED: all HTTP functions now properly close handles on all code paths)

  • No error handling on dkjson.decode() - If GitHub returns malformed JSON (e.g., HTML error page), the code crashes without cleanup (FIXED: added _safeDecode() wrapper using pcall)

  • Wrong status code range - Line 138 checks statusCode >= 200 and statusCode <= 209 but should be 200-299. This breaks pagination for any 2xx response outside that tiny range. (FIXED: now checks 200-299)

High

  • No error handling on curl:perform() - Network failures, timeouts, SSL errors all cause unhandled crashes (FIXED: added _safePerform() wrapper using pcall)

  • Brittle Link header parsing - The regex at lines 36-44 can fail on edge cases and doesn't validate options before calling :gmatch() on it (FIXED: rewrote parser to validate url/options before use, properly extract rel="value" pairs)

  • HTTP/1.1 hardcoded - Line 59 only matches HTTP/1.1 responses; HTTP/2 responses silently fail (FIXED: pattern now matches HTTP/[0-9.]+)

Medium

  • Status code check is > 399 not >= 400 - Minor but semantically confusing (FIXED: now uses >= 400)

  • No validation of parseHeaders() output - If statusCode is nil, the comparison crashes (FIXED: now checks if statusCode is nil before comparisons)

Low

  • Rockspec excludes Lua 5.4+ - "lua >= 5.1, < 5.4" is outdated

  • No PATCH method support - Acknowledged in code comments

  • Inconsistent error message formatting