mirror of
https://github.com/versity/versitygw.git
synced 2026-01-09 04:53:10 +00:00
Merge pull request #1053 from versity/ben/fix_ipa_quoting
Potential fix for code scanning alert no. 15: Potentially unsafe quoting
This commit is contained in:
@@ -354,15 +354,18 @@ func (ipa *IpaIAMService) newRequest(method string, args []string, dict map[stri
|
|||||||
return "", fmt.Errorf("ipa request invalid: %w", err)
|
return "", fmt.Errorf("ipa request invalid: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf(`{
|
request := map[string]interface{}{
|
||||||
"id": %d,
|
"id": id,
|
||||||
"method": %s,
|
"method": json.RawMessage(jmethod),
|
||||||
"params": [
|
"params": []json.RawMessage{json.RawMessage(jargs), json.RawMessage(jdict)},
|
||||||
%s,
|
|
||||||
%s
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
`, id, jmethod, jargs, jdict), nil
|
|
||||||
|
requestJSON, err := json.Marshal(request)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("failed to marshal request: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(requestJSON), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// pkcs7Unpad validates and unpads data from the given bytes slice.
|
// pkcs7Unpad validates and unpads data from the given bytes slice.
|
||||||
|
|||||||
Reference in New Issue
Block a user