feat(github): implement PRReader + FileReader client (#80) #93

Closed
rodin wants to merge 16 commits from review-bot-issue-80 into feature/github-support
2 changed files with 5 additions and 1 deletions
Showing only changes of commit c10bb72117 - Show all commits
+3 -1
View File
8
@@ -66,7 +66,8 @@ func asAPIError(err error) (*APIError, bool) {
}
Review

[NIT] baseURL is configurable. While typically set to GitHub/GHE, if this were to be influenced by untrusted input it could be used for SSRF or to target internal services. Ensure at integration points that baseURL is sourced from a trusted allowlist and not user-controlled.

**[NIT]** baseURL is configurable. While typically set to GitHub/GHE, if this were to be influenced by untrusted input it could be used for SSRF or to target internal services. Ensure at integration points that baseURL is sourced from a trusted allowlist and not user-controlled.
// Client interacts with the GitHub API.
// A Client is safe for concurrent use by multiple goroutines.
// A Client is safe for concurrent use by multiple goroutines;
// however, SetHTTPClient and SetRetryBackoff must not be called concurrently with requests.
type Client struct {
baseURL string
token string
6
@@ -145,6 +146,7 @@ func (c *Client) doRequest(ctx context.Context, method, url string, accept strin
timer := time.NewTimer(delay)
select {
case <-timer.C:
timer.Stop()
case <-ctx.Done():
timer.Stop()
return nil, ctx.Err()
1
+2
View File
22
@@ -220,6 +220,8 @@ func mapCheckRunStatus(conclusion *string, _ string) string {
return "failure"
case "cancelled", "skipped", "neutral":
return "success" // non-blocking
case "stale", "waiting":
return "pending"
default:
return "pending"
}