-
Notifications
You must be signed in to change notification settings - Fork 69
Oonirun v2.1 #301
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
Draft
hellais
wants to merge
3
commits into
master
Choose a base branch
from
oonirun-v2.1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+151
−39
Draft
Oonirun v2.1 #301
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ Below are definitions for important components of the system: | |
with the OONI Probe app installed allows the user to instrument their probe to | ||
run the nettests configured by the link creator. If the OONI Probe app is not | ||
installed, it will display a web page asking them to download the app. | ||
|
||
* **OONI Run descriptor** contains the metadata for a specific OONI Run link and | ||
the nettest definitions: what nettests should be run and how they should be | ||
configured (ex. what URLs should be tested) | ||
|
@@ -125,12 +125,24 @@ An OONI Run link descriptor is a JSON file with the following semantics: | |
// `array` provides a JSON array of tests to be run. | ||
"nettests":[{ | ||
|
||
// (optional) `array` provides a JSON array of tests to be run. | ||
// (optional) `array` provides a JSON array of inputs for the specified test. | ||
"inputs": [ | ||
"https://example.com/", | ||
"https://ooni.org/" | ||
], | ||
|
||
// (optional) `array` provides a richer JSON array containing targets for the specified experiment. | ||
// One of either `inputs` or `targets` can be specified, but not both. | ||
"targets": [ | ||
"input": "https://example.com/", | ||
"extra": { | ||
"category_code": "HUMR", | ||
} | ||
], | ||
|
||
// (optional) string used to specify during creation what is the label for targets to use. | ||
"targets_name": "websites_list_prioritized", | ||
|
||
// (optional) `map` options arguments provided to the specified test_name | ||
// | ||
// Note: this field is currently experimental. A future version of the specification | ||
|
@@ -139,18 +151,6 @@ An OONI Run link descriptor is a JSON file with the following semantics: | |
"HTTP3Enabled": true | ||
}, | ||
|
||
// (optional) `map` settings which are sent to probe_services for retrieving the inputs vector | ||
// It's possible to reference user configured settings by accessing the | ||
// $settings special variable. | ||
// In particular the content of the backend_options will be sent to the /api/v1/check-in call nested | ||
// under the relative test_name. | ||
// | ||
// Note: this field is currently experimental. A future version of the specification | ||
// may modify the field name or its semantics if we discover it needs changes. | ||
"backend_options": { | ||
"category_codes": "$settings.category_codes" | ||
}, | ||
|
||
// (optional) `bool` indicates if this test should be run as part of autoruns. Defaults to true. | ||
// | ||
// Note: this field is currently experimental. A future version of the specification | ||
|
@@ -166,21 +166,33 @@ An OONI Run link descriptor is a JSON file with the following semantics: | |
"test_name": "web_connectivity" | ||
}, { | ||
"test_name": "openvpn", | ||
"backend_options": { | ||
"provider": "riseupvpn" | ||
}, | ||
"targets": [ | ||
"input": "https://foo.com/", | ||
"extra": { | ||
"provider": "riseupvpn", | ||
} | ||
], | ||
}] | ||
} | ||
``` | ||
|
||
In particular values starting with the `$settings` prefix should be mapped | ||
based on user-configured preferences in the app. (Note also that this is | ||
currently an experimental feature that we may change in the future.) | ||
In reality there are two different views onto an OONI Run link descriptor. One | ||
is the view from the perspective of the creator and owner of the link, the | ||
second is from the perspective of measurement applications that need to consume | ||
these links. | ||
|
||
Currently the following `$settings` are defined: | ||
The reason for this is that certain target lists need to be generated | ||
dynamically and at runtime, while the parameters for generating these dynamic | ||
links are specified by the creator of the link. | ||
|
||
* `$settings.category_codes` should be replaced with the list of category codes | ||
the user has enabled (ex. `["HUMR", "NEWS"]`. | ||
A prime example of this would be the OONI Run link for the stock OONI Websites | ||
card. The OONI Run descriptor, as specified from the link creator, is saying | ||
"run the test-lists with weights applied based on coverage", while the mobile | ||
application will then receive a prioritized and sorted list which will change | ||
every time a new run is performed. | ||
|
||
To achieve this we need 2 different views on the link, one for the creation | ||
phase (`target_name`) and another for the retrieval phase (`targets`). | ||
|
||
Based on the above specification it would be possible to re-implement the cards for the OONI Probe | ||
dashboard as follows. | ||
|
@@ -197,20 +209,17 @@ dashboard as follows. | |
"nettests": | ||
[ | ||
{ | ||
"options": { | ||
"MaxRuntime": "$settings.max_runtime", | ||
}, | ||
"backend_settings": { | ||
"category_codes": "$settings.category_codes" | ||
}, | ||
"targets": [ | ||
"input": "https://example.com/", | ||
"extra": { | ||
"category_code": "HUMR", | ||
} | ||
], | ||
"is_manual_run_enabled": true, | ||
"is_background_run_enabled": false, | ||
"test_name": "web_connectivity" | ||
}, | ||
{ | ||
"backend_settings": { | ||
"category_codes": "$settings.category_codes" | ||
}, | ||
"is_manual_run_enabled": false, | ||
"is_background_run_enabled": true, | ||
"test_name": "web_connectivity" | ||
|
@@ -358,7 +367,7 @@ authentication should be handled. | |
When you `CREATE` a new OONI RUN link, the client sends a HTTP `POST` | ||
request conforming to the following: | ||
|
||
`POST /api/v2/oonirun` | ||
`POST /api/v2/oonirun/links` | ||
|
||
```JavaScript | ||
{ | ||
|
@@ -401,6 +410,11 @@ request conforming to the following: | |
} | ||
``` | ||
|
||
Moreover it's possible to specify `targets` as rich JSON structure or | ||
`target_name` indicating the name of the target list which will result in the | ||
target list being generated dynamically. | ||
|
||
`target`, `target_name` and `inputs` are mutually exclusive. | ||
|
||
### Response status code | ||
|
||
|
@@ -465,7 +479,7 @@ To update an OONI Run Link, the client issues a request compliant the same as th | |
Below we list the extra fields that are settable from the edit request that are | ||
not settable during CREATE. | ||
|
||
`PUT /api/v2/oonirun/{ooni_run_link_id}` | ||
`PUT /api/v2/oonirun/links/{ooni_run_link_id}` | ||
|
||
```JavaScript | ||
{ | ||
|
@@ -510,16 +524,16 @@ following JSON body: | |
|
||
## 4.3 GET the OONI Run descriptor | ||
|
||
This operation is performed by OONI Probe clients to retrieve the descriptor of | ||
a certain OONI Run link given the ID. | ||
This operation is performed by OONI Probe clients to retrieve the latest | ||
revision for a descriptor of a certain OONI Run link given the ID. | ||
|
||
As such, this request does not require any authentication. | ||
|
||
### Request | ||
|
||
To retrieve an OONI Run link descriptor, the client issues a request compliant with: | ||
|
||
`GET /api/v2/oonirun/{oonirun_link_id}` | ||
`GET /api/v2/oonirun/links/{oonirun_link_id}` | ||
|
||
### Response status code | ||
|
||
|
@@ -541,7 +555,105 @@ following JSON body: | |
} | ||
``` | ||
|
||
## 4.4 LIST the OONI Run descriptors | ||
Note: for dynamically generated run links, this view will only return the | ||
`target_name` and not the `targets` list. | ||
|
||
## 4.4 GET the OONI Run full descriptor by revision | ||
|
||
This operation is performed by OONI Probe clients to retrieve the descriptor of | ||
a certain OONI Run link given the ID and revision | ||
|
||
As such, this request does not require any authentication. | ||
|
||
### Request | ||
|
||
To retrieve an OONI Run link descriptor, the client issues a request compliant with: | ||
|
||
`GET /api/v2/oonirun/links/{oonirun_link_id}/full-descriptor/{revision}` | ||
|
||
### Response status code | ||
|
||
Same as 4.3 GET the OONI Run descriptor | ||
|
||
### Response body | ||
|
||
Same as 4.3 GET the OONI Run descriptor | ||
|
||
Note: for dynamically generated run links, this view will only return the | ||
`target_name` and not the `targets` list. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This way, the users never see the full list of URLs to be tested before installing a Run Link right? Maybe on the mobile clients we need to add a button to see the full list on the web... |
||
|
||
## 4.4 GET the OONI Run engine descriptor revision | ||
|
||
This operation is performed by OONI Probe clients to retrieve the engine descriptor of | ||
a certain OONI Run link given the ID and revision | ||
|
||
As such, this request does not require any authentication. | ||
|
||
This method is used to return just the nettests, revision and date_created | ||
sections of a descriptor to be used by the measurement engine. | ||
|
||
When the specified OONI Run link contains dynamic targets, it will return the | ||
generated `targets` list and hence every request might return a different target | ||
list. | ||
|
||
### Request | ||
|
||
To retrieve an OONI Run link descriptor, the client issues a request compliant with: | ||
|
||
`GET /api/v2/oonirun/links/{oonirun_link_id}/engine-descriptor/{revision}?run_type={timed|manual}&is_charging={true|false}` | ||
|
||
Upon receiving this request, the OONI Run backend: | ||
|
||
1. SHOULD check whether the `${oonirun_link_id}` exists and return 404 if it does | ||
not. | ||
|
||
2. if everything is okay, returns `200` to the client (see below). | ||
|
||
A client should also include the following headers to allow the server to | ||
properly generate dynamic target lists: | ||
* `X-OONI-NetworkInfo`: `<probe_asn>,<probe_cc> (<network_type>)`, eg `AS1234,IT (wifi)` | ||
* `X-OONI-WebsiteCategoryCodes`: comma separated list of category codes that user has chosen to test (eg. NEWS,HUMR) | ||
* `X-OONI-Credentials`: base64 encoded OONI anonymous credentials | ||
|
||
The the `platform`, `software_name`, `software_name`, `engine_name` and | ||
`engine_version` are encoded inside of the `User-Agent` string using the following | ||
format: | ||
``` | ||
<software_name>/<software_version> (<platform>) <engine_name>/<engine_version> (<engine_version_full>) | ||
``` | ||
|
||
### Response body | ||
|
||
In case of success (i.e. `200` response), the OONI Run Service MUST return the | ||
following JSON body: | ||
|
||
```JavaScript | ||
{ | ||
"revision": "1", | ||
"date_created": "" | ||
"nettests": [ | ||
{ | ||
// See CREATE response format for other fields | ||
"targets": [ | ||
"input": "https://example.com/", | ||
"extra": { | ||
"category_code": "HUMR", | ||
} | ||
], | ||
"test_name": "web_connectivity" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Additionally, the `Vary` header should specify the list of headers that affect | ||
the response body caching, which are all headers starting with the `X-OONI-` | ||
prefix. | ||
|
||
The server might also return an updated version of the submitted anonymous | ||
credentials using the `X-OONI-Credentials` header. | ||
|
||
## 4.7 LIST the OONI Run descriptors | ||
|
||
This operation is performed by users of the OONI Run platform to list all the existing OONI Run links. | ||
|
||
|
@@ -551,7 +663,7 @@ Authentication for this endpoint is optional. | |
|
||
To retrieve an OONI Run link descriptor, the client issues a request compliant with: | ||
|
||
`GET /api/v2/oonirun_links?only_latest=true&only_mine=true&include_archived=true` | ||
`GET /api/v2/oonirun/links?only_latest=true&only_mine=true&include_archived=true` | ||
|
||
- `only_latest`, boolean flag to filter only by the latest revision of an OONI | ||
Run link. If unset or set to false, it will instead include all revisions as | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will come from a fixed list of options right?