Repository navigation
feat(guard): read curl's, wget's and gh api's options - #33
Merged
Merged
Conversation
The guard now watches curl, wget and gh api only when they send data: by a method other than GET and HEAD, or, with no method, with data to send. It follows each tool's way of reading its options (fact 35) and fails closed on what only the run decides (decision 51).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
guard-http, the next part of the guard (decision 51, fact 35):internal/guardnow reads the options ofcurl,wgetandgh api, and watches them only when they send data.GETandHEAD, or, with no method, data to send (-d,-F,--json,-T, wget's--post-data, gh's fields and--input, and the like).--next(-:) starts a request of its own; one that writes before it keeps the call watched.--meth=POST) and its-esettings (-e Post_Data=x) count, as wget reads them.curl -H -ddoesn't count as data.gh api graphqlalways counts, since GraphQL posts its reads too.-Gwith data andgh api -X=GET.curl $OPTS),~/.curlrc,-K,~/.wgetrc,WGETRC, and curl's other protocols (FTP's-Q,telnet://).Checks
mise run check: lint 0 issues,internal/guardat 100%, total 99.2%.dataandformrenamed are still the start of other names that send data, and the last match inlookupgives the same part as the first.guard.Commands, each with the expected verdict.curl -X GET -d -XPOSTsends a GET with a body,wget -O- --post-data=xa POST,curl --output-dira GET;gh apisends GET for-X=GETand-XGET, POST for-f a=band--input, and GET with a query for-X GET -f a=b.