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:
@@ -72,7 +72,7 @@ type herokuTeamMember struct {
|
||||
func (d *HerokuDriver) ListAccounts(ctx context.Context) ([]AccountRecord, error) {
|
||||
var records []AccountRecord
|
||||
|
||||
endpoint, err := url.JoinPath("https://api.heroku.com", "teams", d.teamID, "members")
|
||||
endpoint, err := url.JoinPath("https://api.heroku.com", "teams", url.PathEscape(d.teamID), "members")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot build heroku members URL: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user