From 474678e03c3d59606322762fa767dfd459a7afff Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Thu, 25 Jan 2024 18:30:25 +0100 Subject: [PATCH] feat: support Web Connectivity blocking "tls" See https://github.com/ooni/probe/issues/2457 --- components/aggregation/mat/labels.js | 12 ++--- .../measurement/nettests/WebConnectivity.js | 46 ++++++++++--------- public/static/lang/en.json | 1 + 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/components/aggregation/mat/labels.js b/components/aggregation/mat/labels.js index 378aff99..e3ac7606 100644 --- a/components/aggregation/mat/labels.js +++ b/components/aggregation/mat/labels.js @@ -2,7 +2,6 @@ import PropTypes from 'prop-types' import { Box } from 'ooni-components' import { testNames } from '../../test-info' -import { getCategoryCodesMap } from '../../utils/categoryCodes' import { getLocalisedRegionName } from 'utils/i18nCountries' const InputRowLabel = ({ input }) => { @@ -21,14 +20,13 @@ InputRowLabel.propTypes = { input: PropTypes.string, } -const categoryCodesMap = getCategoryCodesMap() - const blockingTypeLabels = { '': '', 'dns': 'DNS Tampering', 'http-diff': 'HTTP Diff', 'http-failure': 'HTTP Failure', - 'tcp_ip': 'TCP/IP Blocking' + 'tcp_ip': 'TCP/IP Blocking', + 'tls': 'TLS Blocking' } export const getRowLabel = (key, yAxis, locale = 'en') => { @@ -47,10 +45,10 @@ export const getRowLabel = (key, yAxis, locale = 'en') => { case 'probe_asn': return `AS${key}` case 'test_name': - return Object.keys(testNames).includes(key) ? - messages[testNames[key].id] : + return Object.keys(testNames).includes(key) ? + messages[testNames[key].id] : key default: return key } -} \ No newline at end of file +} diff --git a/components/measurement/nettests/WebConnectivity.js b/components/measurement/nettests/WebConnectivity.js index c3974522..14b195f9 100644 --- a/components/measurement/nettests/WebConnectivity.js +++ b/components/measurement/nettests/WebConnectivity.js @@ -36,6 +36,10 @@ const messages = defineMessages({ id: 'Measurement.SummaryText.Websites.Anomaly.BlockingReason.TCP', defaultMessage: '' }, + 'blockingReason.tls': { + id: 'Measurement.SummaryText.Websites.Anomaly.BlockingReason.TLS', + defaultMessage: '' + }, 'connection.Success': { id: 'Measurement.Details.Websites.TCP.ConnectionTo.Success', defaultMessage: '' @@ -64,7 +68,7 @@ const HttpResponseBodyContainer = styled(WrappedPre)` overflow: auto; ` -const HttpResponseBody = ({request}) => { +const HttpResponseBody = ({ request }) => { let body if (!request || !request.response || !request.response.body) { @@ -86,7 +90,7 @@ HttpResponseBody.propTypes = { request: PropTypes.object.isRequired } -const RequestResponseContainer = ({request}) => { +const RequestResponseContainer = ({ request }) => { return ( // FIXME: This sometime ends up creating empty sections with just a title // when request data contains states like 'generic_timeout_error' @@ -96,7 +100,7 @@ const RequestResponseContainer = ({request}) => { ) : ( - // !request.failure && + // !request.failure && {/* Request URL */} @@ -143,7 +147,7 @@ RequestResponseContainer.propTypes = { request: PropTypes.object.isRequired } -const FailureString = ({failure}) => { +const FailureString = ({ failure }) => { if (typeof failure === 'undefined') { return () } @@ -167,11 +171,11 @@ FailureString.propTypes = { } const DnsNarrowAnswerCell = (props) => ( - {props.children} + {props.children} ) const DnsAnswerCell = (props) => ( - {props.children} + {props.children} ) DnsAnswerCell.propTypes = { @@ -179,13 +183,13 @@ DnsAnswerCell.propTypes = { } const dnsAnswerIpInfo = (dnsAnswer) => { - const asn = dnsAnswer.asn ? `AS${dnsAnswer.asn}` : 'Unknown AS' - const asOrgName = dnsAnswer.as_org_name ? `(${dnsAnswer.as_org_name})` : '' + const asn = dnsAnswer.asn ? `AS${dnsAnswer.asn}` : 'Unknown AS' + const asOrgName = dnsAnswer.as_org_name ? `(${dnsAnswer.as_org_name})` : '' - return `${asn} ${asOrgName}`.trim() + return `${asn} ${asOrgName}`.trim() } -const DnsAnswerRow = ({ name = 'Name', netClass = 'Class', ttl = 'TTL', type = 'Type', data = 'DATA', answer_ip_info = 'Answer IP Info', header = false}) => ( +const DnsAnswerRow = ({ name = 'Name', netClass = 'Class', ttl = 'TTL', type = 'Type', data = 'DATA', answer_ip_info = 'Answer IP Info', header = false }) => ( {name} @@ -208,7 +212,7 @@ DnsAnswerRow.propTypes = { header: PropTypes.bool } -const QueryContainer = ({query}) => { +const QueryContainer = ({ query }) => { const { query_type, answers, @@ -346,7 +350,7 @@ const WebConnectivityDetails = ({ const intl = useIntl() const date = new Intl.DateTimeFormat(intl.locale, { dateStyle: 'long', timeStyle: 'long', timeZone: 'UTC' }).format(new Date(measurement_start_time)) - + const p = url.parse(input) const hostname = p.host @@ -367,7 +371,7 @@ const WebConnectivityDetails = ({ country }} /> - } else if(isConfirmed) { + } else if (isConfirmed) { status = 'confirmed' summaryText = {render({ status: status, - statusInfo: {input} } - message={reason} + message={reason} />, summaryText: summaryText, headMetadata: headMetadata, @@ -518,22 +522,22 @@ const WebConnectivityDetails = ({ title={} content={ - + - + - + - + - + - + diff --git a/public/static/lang/en.json b/public/static/lang/en.json index c4d9d56a..5a690355 100644 --- a/public/static/lang/en.json +++ b/public/static/lang/en.json @@ -90,6 +90,7 @@ "Measurement.SummaryText.Websites.Anomaly": "On {date}, {WebsiteURL} presented signs of {reason} on {network} in {country}.\n\nThis might mean that {WebsiteURL} was blocked, but false positives can occur.\n\nPlease explore the network measurement data below.", "Measurement.SummaryText.Websites.Anomaly.BlockingReason.DNS": "DNS tampering", "Measurement.SummaryText.Websites.Anomaly.BlockingReason.TCP": "TCP/IP blocking", + "Measurement.SummaryText.Websites.Anomaly.BlockingReason.TLS": "TLS blocking", "Measurement.SummaryText.Websites.Anomaly.BlockingReason.HTTP-failure": "HTTP blocking (HTTP requests failed)", "Measurement.SummaryText.Websites.Anomaly.BlockingReason.HTTP-diff": "HTTP blocking (a blockpage might be served)", "Measurement.SummaryText.Websites.ConfirmedBlocked": "On {date}, {WebsiteURL} was blocked on {network} in {country}.\n\nThis is confirmed because a block page was served, as illustrated through the network measurement data below.",