Skip to content

Commit

Permalink
feat(webconnectivitylte): add Cloudflare CAPTCHA test cases (ooni#1476)
Browse files Browse the repository at this point in the history
## Checklist

- [x] I have read the [contribution
guidelines](https://github.com/ooni/probe-cli/blob/master/CONTRIBUTING.md)
- [x] reference issue for this pull request:
ooni/probe#1734
- [x] if you changed anything related to how experiments work and you
need to reflect these changes in the ooni/spec repository, please link
to the related ooni/spec pull request:
ooni/spec#284
- [x] if you changed code inside an experiment, make sure you bump its
version number: not needed

## Description

Closes ooni/probe#1734.

See ooni/probe#2661.

While there, rename an incorrectly renamed Yandex test.

While there, ignore the `/oonireport` binary.
  • Loading branch information
bassosimone authored and Murphy-OrangeMud committed Feb 13, 2024
1 parent e9414f9 commit 8daf64f
Show file tree
Hide file tree
Showing 18 changed files with 3,679 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
/oohelper
/oohelperd
/ooniprobe
/oonireport
/ooporthelper
/probe-cli.cov
/tinyjafar
Expand Down
53 changes: 53 additions & 0 deletions internal/experiment/webconnectivityqa/cloudflare.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package webconnectivityqa

import "github.com/ooni/probe-cli/v3/internal/netemx"

// cloudflareCAPTCHAWithHTTP obtains the cloudflare CAPTCHA using HTTP.
func cloudflareCAPTCHAWithHTTP() *TestCase {
// See https://github.com/ooni/probe/issues/2661 for an explanation of why
// here for now we're forced to declare "http-diff".
return &TestCase{
Name: "cloudflareCAPTCHAWithHTTP",
Flags: TestCaseFlagNoV04,
Input: "http://www.cloudflare-cache.com/",
Configure: func(env *netemx.QAEnv) {
// nothing
},
ExpectErr: false,
ExpectTestKeys: &testKeys{
DNSConsistency: "consistent",
StatusCodeMatch: false,
BodyLengthMatch: false,
BodyProportion: 0.18180740037950663,
HeadersMatch: true,
TitleMatch: false,
XBlockingFlags: 16, // AnalysisBlockingFlagHTTPDiff
Accessible: false,
Blocking: "http-diff",
},
}
}

// cloudflareCAPTCHAWithHTTPS obtains the cloudflare CAPTCHA using HTTPS.
func cloudflareCAPTCHAWithHTTPS() *TestCase {
return &TestCase{
Name: "cloudflareCAPTCHAWithHTTPS",
Flags: TestCaseFlagNoV04,
Input: "https://www.cloudflare-cache.com/",
Configure: func(env *netemx.QAEnv) {
// nothing
},
ExpectErr: false,
ExpectTestKeys: &testKeys{
DNSConsistency: "consistent",
StatusCodeMatch: false,
BodyLengthMatch: false,
BodyProportion: 0.18180740037950663,
HeadersMatch: true,
TitleMatch: false,
XBlockingFlags: 32, // AnalysisBlockingFlagSuccess
Accessible: true,
Blocking: false,
},
}
}
3 changes: 3 additions & 0 deletions internal/experiment/webconnectivityqa/testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func AllTestCases() []*TestCase {
badSSLWithWrongServerName(),
badSSLWithUnknownAuthorityWithInconsistentDNS(),

cloudflareCAPTCHAWithHTTP(),
cloudflareCAPTCHAWithHTTPS(),

controlFailureWithSuccessfulHTTPWebsite(),
controlFailureWithSuccessfulHTTPSWebsite(),

Expand Down
Loading

0 comments on commit 8daf64f

Please sign in to comment.