Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/scan/passive.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
var (
crtshBaseURL = "https://crt.sh/?q=%%25.%s&output=json"
certspotterBaseURL = "https://api.certspotter.com/v1/issuances?domain=%s&include_subdomains=true&expand=dns_names"
waybackBaseURL = "http://web.archive.org/cdx/search/cdx?url=*.%s/*&output=text&fl=original&collapse=urlkey"
waybackBaseURL = "https://web.archive.org/cdx/search/cdx?url=*.%s/*&output=text&fl=original&collapse=urlkey"
)

// cap the response we read from any one source so a hostile/huge feed can't
Expand Down
17 changes: 17 additions & 0 deletions internal/scan/passive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package scan
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
)
Expand Down Expand Up @@ -168,6 +169,22 @@ func TestPassive_ScopesSubdomainsToTarget(t *testing.T) {
}
}

func TestPassive_SourcesUseTLS(t *testing.T) {
// all three passive feeds must be fetched over https: an on-path attacker
// able to tamper with a plain-http response could inject or drop
// subdomains/urls in the reported results without detection.
sources := map[string]string{
"crtsh": crtshBaseURL,
"certspotter": certspotterBaseURL,
"wayback": waybackBaseURL,
}
for name, base := range sources {
if !strings.HasPrefix(base, "https://") {
t.Errorf("%s base url is not https: %q", name, base)
}
}
}

func TestNormalizeHost(t *testing.T) {
tests := []struct {
in string
Expand Down
Loading