[tor-commits] [check/master] Be more permissive about the platform found in the UA

arlo at torproject.org arlo at torproject.org
Mon Jul 2 22:22:17 UTC 2018


commit c6a82190f970a6598541d1fbd1422c9ef16fc4fe
Author: Arlo Breault <arlolra at gmail.com>
Date:   Mon Jul 2 18:16:47 2018 -0400

    Be more permissive about the platform found in the UA
    
    At least temporarily, until trac 26146 is resolved.
    
    Trac: 26566
---
 utils.go      | 2 +-
 utils_test.go | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/utils.go b/utils.go
index bbba5fe..072d414 100644
--- a/utils.go
+++ b/utils.go
@@ -55,7 +55,7 @@ func GetHost(r *http.Request) (host string, err error) {
 	return
 }
 
-var TBBUserAgents = regexp.MustCompile(`^Mozilla/5\.0 \(((Windows NT 6\.1)|(Android; Mobile)); rv:[\d]+\.0\) Gecko/20100101 Firefox/[\d]+\.0$`)
+var TBBUserAgents = regexp.MustCompile(`^Mozilla/5\.0 \([^)]*\) Gecko/20100101 Firefox/[\d]+\.0$`)
 var OrfoxUserAgents = regexp.MustCompile(`^Mozilla/5\.0 \(Android; Mobile; rv:38.0\) Gecko/38.0 Firefox/38.0$`)
 
 func LikelyTBB(ua string) bool {
diff --git a/utils_test.go b/utils_test.go
index 096a48c..e01f652 100644
--- a/utils_test.go
+++ b/utils_test.go
@@ -4,7 +4,7 @@ import "testing"
 
 var UserAgents = map[string]bool{
 	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:10.0.2) Gecko/20100101 Firefox/10.0.2":                                    false,
-	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:11.0) Gecko/20100101 Firefox/11.0":                                        false,
+	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:11.0) Gecko/20100101 Firefox/11.0":                                        true,
 	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36": false,
 	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1":    false,
 	"Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0":                                                        true,
@@ -14,6 +14,9 @@ var UserAgents = map[string]bool{
 	"Mozilla/5.0 (Android; Mobile; rv:38.0) Gecko/38.0 Firefox/38.0":                                                           true,
 	"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0":                                                        true,
 	"Mozilla/5.0 (Android; Mobile; rv:52.0) Gecko/20100101 Firefox/52.0":                                                       true,
+	"Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0":                                                        true,
+	"Mozilla/5.0 (Android; Mobile; rv:60.0) Gecko/20100101 Firefox/60.0":                                                       true,
+	"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0":                                       true,
 }
 
 func TestLikelyTBB(t *testing.T) {



More information about the tor-commits mailing list