Skip to content

Commit

Permalink
feat: introduce $FUZZYMONKEY_SSL_NO_VERIFY
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Fenoll <[email protected]>
  • Loading branch information
fenollp committed Nov 9, 2024
1 parent cd0cf87 commit a411523
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Options:
Try:
export FUZZYMONKEY_API_KEY=fm_42
export FUZZYMONKEY_SSL_NO_VERIFY=1
monkey update
monkey -f fm.star exec reset
monkey fuzz --only /pets --calls-without-input=NewPet --seed=$(monkey pastseed)
Expand Down
2 changes: 1 addition & 1 deletion Tagfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.50.0
0.51.0
34 changes: 18 additions & 16 deletions pkg/modeler/openapiv3/caller_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package openapiv3
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"net/http/httputil"
"net/url"
"os"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -250,23 +252,23 @@ func (c *tCapHTTP) Do(ctx context.Context) {

func (c *tCapHTTP) RoundTrip(req *http.Request) (rep *http.Response, err error) {
// TODO: stricter/smaller timeouts https://pkg.go.dev/github.com/asecurityteam/transport#Option
t := &http.Transport{
Proxy: func(req *http.Request) (*url.URL, error) {
// TODO: snap the envs that ProxyFromEnvironment reads
log.Println("[NFO] HTTP proxying is work in progress...")
return nil, nil
},
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
// ForceAttemptHTTP2: true,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
t := http.DefaultTransport.(*http.Transport).Clone()
t.Proxy = func(req *http.Request) (*url.URL, error) {
// TODO: snap the envs that ProxyFromEnvironment reads
log.Println("[NFO] HTTP proxying is work in progress...")
return nil, nil
}
t.DialContext = (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext
// t.ForceAttemptHTTP2 = true
t.MaxIdleConns = 100
t.IdleConnTimeout = 90 * time.Second
t.TLSHandshakeTimeout = 10 * time.Second
t.ExpectContinueTimeout = 1 * time.Second
t.TLSClientConfig = &tls.Config{InsecureSkipVerify: os.Getenv("FUZZYMONKEY_SSL_NO_VERIFY") == "1"}

start := time.Now()
rep, err = t.RoundTrip(req)
Expand Down
1 change: 1 addition & 0 deletions usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Options:
Try:
export FUZZYMONKEY_API_KEY=fm_42
export FUZZYMONKEY_SSL_NO_VERIFY=1
` + B + ` update
` + B + ` -f fm.star exec reset
` + B + ` fuzz --only /pets --calls-without-input=NewPet --seed=$(monkey pastseed)
Expand Down

0 comments on commit a411523

Please sign in to comment.