Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: mark torsf msmts from Android 3.8.3 as failed #705

Merged
merged 1 commit into from
Aug 18, 2023
Merged
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
23 changes: 13 additions & 10 deletions fastpath/fastpath/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,6 @@ def score_signal(msm: dict) -> dict:
if tk.get("failed_operation", True) or tk.get("failure", True):
scores["accuracy"] = 0.0


try:
# https://github.com/ooni/probe/issues/2344
tv = g_or(msm, "test_version", "0.0.0")
Expand Down Expand Up @@ -1414,6 +1413,13 @@ def score_torsf(msm: dict) -> dict:
# https://github.com/ooni/ooni.org/issues/772
scores = init_scores()
tk = g_or(msm, "test_keys", {})

sw_name = msm.get("software_name", "unknown")
sw_version = msm.get("software_version", "unknown")
if sw_version == "3.8.3" and sw_name.startswith("ooniprobe-android"):
scores["accuracy"] = 0.0
return scores

failure = tk.get("failure")
if failure:
scores["blocking_general"] = 1.0
Expand All @@ -1422,12 +1428,6 @@ def score_torsf(msm: dict) -> dict:
scores["extra"] = dict(
bootstrap_time=tk.get("bootstrap_time"), test_runtime=msm.get("test_runtime")
)

sw_name = msm.get("software_name", "unknown")
sw_version = msm.get("software_version", "unknown")
if sw_version == "3.8.3" and sw_name.startswith("ooniprobe-android"):
scores["accuracy"] = 0.0

return scores


Expand Down Expand Up @@ -1487,7 +1487,6 @@ def score_browser_web(msm: dict) -> dict:
return scores



@metrics.timer("score_measurement")
def score_measurement(msm: dict) -> dict:
"""Calculates measurement scoring. Returns a scores dict"""
Expand Down Expand Up @@ -1656,8 +1655,12 @@ def process_measurement(msm_tup) -> None:
test_version = g_or(measurement, "test_version", "")
test_runtime = g_or(measurement, "test_runtime", 0.0)
try:
test_helper_address = g(measurement, "test_helpers", "backend", "address", default="")
test_helper_type = g(measurement, "test_helpers", "backend", "type", default="")
test_helper_address = g(
measurement, "test_helpers", "backend", "address", default=""
)
test_helper_type = g(
measurement, "test_helpers", "backend", "type", default=""
)
except AttributeError:
test_helper_address = ""
test_helper_type = ""
Expand Down
1 change: 1 addition & 0 deletions fastpath/fastpath/tests/data/torsf_383.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"annotations":{"architecture":"arm64","engine_name":"ooniprobe-engine","engine_version":"3.18.1","flavor":"stableFull","go_version":"go1.20.6","network_type":"wifi","origin":"autorun","platform":"android","vcs_modified":"","vcs_revision":"","vcs_time":"","vcs_tool":""},"data_format_version":"0.2.0","input":null,"measurement_start_time":"2023-08-17 17:07:41","probe_asn":"AS17552","probe_cc":"TH","probe_ip":"127.0.0.1","probe_network_name":"TRUE INTERNET CORPORATION CO. LTD.","report_id":"20230817T165741Z_torsf_TH_17552_n1_cnp1wJuVMt1OgZjG","resolver_asn":"AS7470","resolver_ip":"203.144.207.14","resolver_network_name":"TRUE INTERNET CORPORATION CO. LTD.","software_name":"ooniprobe-android-unattended","software_version":"3.8.3","test_keys":{"bootstrap_time":0,"error":"timeout-reached","failure":"generic_timeout_error","success":false,"persistent_datadir":true,"rendezvous_method":"domain_fronting","timeout":600,"tor_logs":["Aug 17 23:57:41.000 [notice] Bootstrapped 0% (starting): Starting"],"tor_progress":0,"tor_progress_tag":"starting","tor_progress_summary":"Starting","tor_version":"0.4.7.13","transport_name":"snowflake"},"test_name":"torsf","test_runtime":600.057216071,"test_start_time":"2023-08-17 16:57:41","test_version":"0.4.0"}
15 changes: 14 additions & 1 deletion fastpath/fastpath/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_g():
assert g(dict(x=dict()), "x", "y", default="v") == "v"
assert g(dict(x=dict(y=None)), "x", "y", default="v") == "v"
assert g(dict(x=dict(y="22")), "x", "y", default="v") == "22"
#assert g(dict(x="str"), "x", "y", default="v") == "v"
# assert g(dict(x="str"), "x", "y", default="v") == "v"


def test_gn():
Expand Down Expand Up @@ -642,6 +642,19 @@ def test_score_torsf2():
}


def test_score_torsf383():
msm = loadj("torsf_383")
scores = fp.score_measurement(msm)
assert scores == {
"accuracy": 0.0,
"blocking_country": 0.0,
"blocking_general": 0.0,
"blocking_global": 0.0,
"blocking_isp": 0.0,
"blocking_local": 0.0,
}


def test_score_openvpn():
msm = loadj("openvpn")
scores = fp.score_measurement(msm)
Expand Down
Loading