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

Rename .well-known/first-party-set to include .json extension #16

Merged
merged 1 commit into from
Apr 27, 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
10 changes: 5 additions & 5 deletions FPS-Submission_Guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ Upon submission of a PR, a series of technical checks will run on GitHub to veri
<li>Each domain must satisfy the /.well-known/ metadata requirement:</li>
<ul>
<li>The /.well-known/ metadata requirement demonstrates that the submitter has administrative access to the domains present in the set, since administrative access is required to modify the /.well-known/ file. This will help prevent unauthorized actors from adding domains to a set. </li>
<li>The primary domain must serve a JSON file at /.well-known/first-party-set. The contents of the file must be identical to the submission. Each member domain must serve a JSON file at /.well-known/first-party-set. The contents of the file must name the primary domain. These files must be maintained for the duration of the domain’s inclusion in the set.</li>
<li>Example for primary.com/.well-known/first-party-set:</li>
<li>The primary domain must serve a JSON file at /.well-known/first-party-set.json. The contents of the file must be identical to the submission. Each member domain must serve a JSON file at /.well-known/first-party-set.json. The contents of the file must name the primary domain. These files must be maintained for the duration of the domain’s inclusion in the set.</li>
<li>Example for primary.com/.well-known/first-party-set.json:</li>
</ul></ul>

```json
Expand All @@ -161,7 +161,7 @@ Upon submission of a PR, a series of technical checks will run on GitHub to veri
}
}
```
The `/.well-known/first-party-set` file for the set primary must follow the schema specified below:
The `/.well-known/first-party-set.json` file for the set primary must follow the schema specified below:
```json
{
"type": "object",
Expand Down Expand Up @@ -202,13 +202,13 @@ The `/.well-known/first-party-set` file for the set primary must follow the sche
}
}
```
Example for associate1.com/.well-known/first-party-set:
Example for associate1.com/.well-known/first-party-set.json:
```json
{
"primary":"https://primary.com"
}
```
The /.well-known/first-party-set file for set members must follow the schema specified below:
The /.well-known/first-party-set.json file for set members must follow the schema specified below:
```json
{
"type": "object",
Expand Down
8 changes: 4 additions & 4 deletions FpsCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,13 @@ def check_list_sites(self, primary, site_list):
None
"""
for site in site_list:
url = site + "/.well-known/first-party-set"
url = site + "/.well-known/first-party-set.json"
try:
json_schema = self.open_and_load_json(url)
if 'primary' not in json_schema.keys():
self.error_list.append(
"The listed associated site site did not have primary"
+ " as a key in its .well-known/first-party-set file: "
+ " as a key in its .well-known/first-party-set.json file: "
+ site)
elif json_schema['primary'] != primary:
self.error_list.append("The listed associated site "
Expand Down Expand Up @@ -358,7 +358,7 @@ def find_invalid_well_known(self, check_sets):
# Check the schema to ensure consistency
for primary in check_sets:
# First we check the primary sites
url = primary + "/.well-known/first-party-set"
url = primary + "/.well-known/first-party-set.json"
# Read the well-known files and check them against the schema we
# have stored
try:
Expand Down Expand Up @@ -386,7 +386,7 @@ def find_invalid_well_known(self, check_sets):
if field_sym_difference:
self.error_list.append("The following member(s) of "
+ field + " were not present in both the changelist "
+ "and .well-known/first-party-sets file: " +
+ "and .well-known/first-party-set.json file: " +
str(sorted(field_sym_difference)))
except Exception as inst:
self.error_list.append(
Expand Down
20 changes: 10 additions & 10 deletions tests/fps_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,39 +735,39 @@ class MockedJsonResponse:
def __init__(self, json):
self.json = json

if args[0] == 'https://primary1.com/.well-known/first-party-set':
if args[0] == 'https://primary1.com/.well-known/first-party-set.json':
return {
"primary": "https://primary1.com",
"associatedSites": ["https://not-in-list.com"]
}
elif args[0] == 'https://expected-associated.com/.well-known/first-party-set':
elif args[0] == 'https://expected-associated.com/.well-known/first-party-set.json':
return {
"primary": "https://primary1.com"
}
elif args[0] == 'https://primary2.com/.well-known/first-party-set':
elif args[0] == 'https://primary2.com/.well-known/first-party-set.json':
return {
"primary": "https://wrong-primary.com",
"associatedSites":["https://associated1.com"]
}
elif args[0] == 'https://associated1.com/.well-known/first-party-set':
elif args[0] == 'https://associated1.com/.well-known/first-party-set.json':
return {
"primary": "https://primary2.com"
}
elif args[0] == 'https://primary3.com/.well-known/first-party-set':
elif args[0] == 'https://primary3.com/.well-known/first-party-set.json':
return {
"primary": "https://primary3.com",
"associatedSites": ["https://associated2.com"]
}
elif args[0] == 'https://associated2.com/.well-known/first-party-set':
elif args[0] == 'https://associated2.com/.well-known/first-party-set.json':
return {
"primary": "https://wrong-primary.com"
}
elif args[0] == 'https://primary4.com/.well-known/first-party-set':
elif args[0] == 'https://primary4.com/.well-known/first-party-set.json':
return {
"primary": "https://primary4.com",
"associatedSites": ["https://associated3.com"]
}
elif args[0] == 'https://associated3.com/.well-known/first-party-set':
elif args[0] == 'https://associated3.com/.well-known/first-party-set.json':
return {
"primary": "https://primary4.com"
}
Expand Down Expand Up @@ -1070,7 +1070,7 @@ def test_primary_page_differs(self, mock_open_and_load_json):
self.assertEqual(loaded_sets, expected_sets)
self.assertEqual(fp.error_list, ["The following member(s) of " +
"associatedSites were not present in both the changelist and " +
".well-known/first-party-sets file: ['https://expected-associated.com'"
".well-known/first-party-set.json file: ['https://expected-associated.com'"
+ ", 'https://not-in-list.com']"])

@mock.patch('FpsCheck.FpsCheck.open_and_load_json',
Expand Down Expand Up @@ -1102,7 +1102,7 @@ def test_wrong_primary_name(self, mock_open_and_load_json):
self.assertEqual(loaded_sets, expected_sets)
self.assertEqual(fp.error_list, ["The following member(s) of " +
"primary were not present in both the changelist and " +
".well-known/first-party-sets file: ['https://primary2.com'"
".well-known/first-party-set.json file: ['https://primary2.com'"
+ ", 'https://wrong-primary.com']"])

@mock.patch('FpsCheck.FpsCheck.open_and_load_json',
Expand Down
Loading