Restore url.PathEscape on user-supplied path segments in url.JoinPath calls
url.JoinPath does not percent-encode slashes or reserved characters in its arguments, so user-supplied values (group IDs, slugs, team IDs) must be wrapped with url.PathEscape to prevent path traversal. Update cursor rule and contrib guide to codify this as a mandatory practice. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -71,7 +71,7 @@ type clickupTeamResponse struct {
|
||||
}
|
||||
|
||||
func (d *ClickUpDriver) ListAccounts(ctx context.Context) ([]AccountRecord, error) {
|
||||
endpoint, err := url.JoinPath("https://api.clickup.com", "api", "v2", "team", d.teamID)
|
||||
endpoint, err := url.JoinPath("https://api.clickup.com", "api", "v2", "team", url.PathEscape(d.teamID))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot build clickup team URL: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user