-
Notifications
You must be signed in to change notification settings - Fork 6
fix: Add redirect support and security safeguards to curl command #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "lib/forge-std": { | ||
| "rev": "3b20d60d14b343ee4f908cb8079495c07f5e8981" | ||
| }, | ||
| "lib/solidity-stringutils": { | ||
| "rev": "4b2fcc43fa0426e19ce88b1f1ec16f5903a2e461" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,7 +147,7 @@ library HTTP { | |
| } | ||
|
|
||
| function request(Request storage req) internal returns (Response memory res) { | ||
| string memory scriptStart = 'response=$(curl -s -w "\\n%{http_code}" '; | ||
| string memory scriptStart = 'response=$(curl -sL --max-redirs 3 --proto-redir =https -w "\\n%{http_code}" '; | ||
|
||
| string memory scriptEnd = | ||
| '); status=$(tail -n1 <<< "$response"); data=$(sed "$ d" <<< "$response");data=$(echo "$data" | tr -d "\\n"); cast abi-encode "response(uint256,string)" "$status" "$data";'; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
--proto-redirflag has incorrect syntax. There should be no space between the equals sign and the protocol value. The correct syntax is--proto-redir=https(without the space). With the current syntax, curl will likely fail or ignore this security safeguard, potentially allowing protocol downgrades from HTTPS to HTTP.