Skip to content

Commit a475856

Browse files
authored
docs: content from archived repos (#2075)
docs: content from archived repos
1 parent 0f759c6 commit a475856

11 files changed

Lines changed: 507 additions & 133 deletions

docs/src/SUMMARY.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
# Summary
77

88
- [Introduction](introduction.md)
9-
- [Application Configuration](config.md)
109
- [Application Architecture](architecture.md)
10+
- [Application Configuration](config.md)
11+
- [Testing](testing.md)
12+
- [Release Process](release-process.md)
13+
- [Frequently Asked Questions](faq.md)
14+
- [Data Types](data-types.md)
1115
- [OpenAPI Documentation](open-api-docs.md)
1216
- [Syncstorage API](syncstorage/api.md)
1317
- [API v1.5](syncstorage/api-1.5.md)

docs/src/config.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The following configuration options are available.
4747
| <span id="SYNC_CORS_ALLOWED_ORIGIN"></span>SYNC_CORS_ALLOWED_ORIGIN | * | Allowed origins for CORS requests |
4848
| <span id="SYNC_CORS_MAX_AGE"></span>SYNC_CORS_MAX_AGE | 1728000 | CORS preflight cache seconds (20 days) |
4949
| <span id="SYNC_CORS_ALLOWED_METHODS"></span>SYNC_CORS_ALLOWED_METHODS | ["DELETE", "GET", "POST", "PUT"] | Allowed methods |
50+
| <span id="SYNC_CORS_ALLOWED_HEADERS"></span>SYNC_CORS_ALLOWED_HEADERS | See source | Allowed headers for CORS requests |
5051

5152
### Syncstorage Database
5253

@@ -81,6 +82,8 @@ The following configuration options are available.
8182
| <span id="SYNC_SYNCSTORAGE__ENABLE_QUOTA"></span>SYNC_SYNCSTORAGE__ENABLE_QUOTA | false | Enable quota tracking (Spanner only) |
8283
| <span id="SYNC_SYNCSTORAGE__ENFORCE_QUOTA"></span>SYNC_SYNCSTORAGE__ENFORCE_QUOTA | false | Enforce quota limits (Spanner only) |
8384
| <span id="SYNC_SYNCSTORAGE__GLEAN_ENABLED"></span>SYNC_SYNCSTORAGE__GLEAN_ENABLED | true | Enable Glean telemetry |
85+
| <span id="SYNC_SYNCSTORAGE__LBHEARTBEAT_TTL"></span>SYNC_SYNCSTORAGE__LBHEARTBEAT_TTL | None | Load balancer heartbeat period in seconds |
86+
| <span id="SYNC_SYNCSTORAGE__LBHEARTBEAT_TTL_JITTER"></span>SYNC_SYNCSTORAGE__LBHEARTBEAT_TTL_JITTER | 25 | Jitter percentage for the load balancer heartbeat period |
8487
| <span id="SYNC_SYNCSTORAGE__STATSD_LABEL"></span>SYNC_SYNCSTORAGE__STATSD_LABEL | syncstorage | StatsD metrics label prefix |
8588

8689
### Tokenserver Database
@@ -100,6 +103,7 @@ The following configuration options are available.
100103
| <span id="SYNC_TOKENSERVER__ENABLED"></span>SYNC_TOKENSERVER__ENABLED | false | Enable tokenserver service |
101104
| <span id="SYNC_TOKENSERVER__RUN_MIGRATIONS"></span>SYNC_TOKENSERVER__RUN_MIGRATIONS | false | Run DB migrations on startup |
102105
| <span id="SYNC_TOKENSERVER__NODE_TYPE"></span>SYNC_TOKENSERVER__NODE_TYPE | spanner | Storage backend type reported in token response for telemetry. Valid values: "mysql", "postgres", "spanner" |
106+
| <span id="SYNC_TOKENSERVER__STATSD_LABEL"></span>SYNC_TOKENSERVER__STATSD_LABEL | syncstorage.tokenserver | StatsD metrics label prefix |
103107
| <span id="SYNC_TOKENSERVER__TOKEN_DURATION"></span>SYNC_TOKENSERVER__TOKEN_DURATION | 3600 | Token TTL (1 hour) |
104108

105109
### Tokenserver+FxA Integration
@@ -110,6 +114,7 @@ The following configuration options are available.
110114
| <span id="SYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL"></span>SYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL | https://oauth.stage.mozaws.net | FxA OAuth server URL |
111115
| <span id="SYNC_TOKENSERVER__FXA_OAUTH_REQUEST_TIMEOUT"></span>SYNC_TOKENSERVER__FXA_OAUTH_REQUEST_TIMEOUT | 10 | OAuth request timeout in seconds |
112116
| <span id="SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET"></span>SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET | secret | Secret for hashing metrics to maintain anonymity |
117+
| <span id="SYNC_TOKENSERVER__ADDITIONAL_BLOCKING_THREADS_FOR_FXA_REQUESTS"></span>SYNC_TOKENSERVER__ADDITIONAL_BLOCKING_THREADS_FOR_FXA_REQUESTS | 1 | Number of additional blocking threads to add to the threadpool for OAuth verification requests to FxA |
113118
| <span id="SYNC_TOKENSERVER__FXA_OAUTH_PRIMARY_JWK__KTY"></span>SYNC_TOKENSERVER__FXA_OAUTH_PRIMARY_JWK__KTY | None | Primary JWK key type (e.g., "RSA") |
114119
| <span id="SYNC_TOKENSERVER__FXA_OAUTH_PRIMARY_JWK__ALG"></span>SYNC_TOKENSERVER__FXA_OAUTH_PRIMARY_JWK__ALG | None | Primary JWK algorithm (e.g., "RS256") |
115120
| <span id="SYNC_TOKENSERVER__FXA_OAUTH_PRIMARY_JWK__KID"></span>SYNC_TOKENSERVER__FXA_OAUTH_PRIMARY_JWK__KID | None | Primary JWK key ID |

docs/src/data-types.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Firefox Sync data types
2+
3+
The following are important details around each syncing data type.
4+
5+
Users can configure which Firefox data types are synced across all connected Firefoxes. On desktop, this is found on `about:preferences#sync`; on mobile this is found in `Sync Settings` under the application menu. Mobile Firefox currently only shows data types that are supported on that platform. Any changes to selected data types on any platform are applied at the account level: they will take effect on all clients connected by that account.
6+
7+
## Bookmarks
8+
9+
- All bookmarks are synced; users cannot specify bookmarks to include or exclude.
10+
- Bookmarks are merged when synced, so that the result is all bookmarks from all connected devices.
11+
- We do not identify the device that a bookmark came from. However, on mobile you will see a "Desktop Bookmarks" folder, and on desktop you will see a "Mobile bookmarks" folder that the respective platforms use by default.
12+
- There is a record per bookmark in sync storage.
13+
14+
## History
15+
16+
- We sync the most recent 5,000 history entries.
17+
- History is merged when synced, so that the result is the most recent history from all connected devices.
18+
- There is a record per history entry in sync storage.
19+
20+
## Open tabs
21+
22+
- The ability to use the Send Tab feature does not require the user to be syncing tabs.
23+
- The ability to remotely close tabs does require the user to be syncing tabs.
24+
- Unlike other synced data, tabs are synced with an associated client/device identifier; they are not merged.
25+
- Tabs were changed with MR 2022 to sync every 5s after a tab change.
26+
- Synced tab data is a subset of the local tab data. We do not sync:
27+
- Tabs with any URLs matching these schemes. This includes reader view tabs.
28+
- Any tabs in private windows (which is an intentional decision).
29+
- The back/forward stack (i.e. the "back" and "forward" buttons are disabled when opening a remote tab).
30+
- Window groupings. If you have multiple windows open, each with its own tabs, all your tabs will be flattened into a single list in the Synced Tabs views.
31+
- Whether the tab is pinned or not. We sync pinned tabs, but other devices see them as regular tabs, and they aren't sorted in any particular order.
32+
- Top sites from the New Tab page. Pinned top sites are synced completely separately, as part of preferences sync. Frequently visited top sites that aren't pinned rely on the frecency from history, which sometimes will mean they become top sites after history syncs. Manual pinning of top sites are not synced.
33+
- Additional page state. Cookies, local storage, scroll position, and any text entered in form fields on the page are never synced.
34+
- There is a record per device with tabs in sync storage.
35+
36+
## Logins & passwords (AKA. Logins)
37+
38+
- Logins & passwords are merged when synced, so that the result is all logins & passwords from all connected devices.
39+
- There is a record per login & password entry in sync storage.
40+
41+
## Addresses
42+
43+
- Addresses are only enabled for specific countries/geos.
44+
- Addresses are behind a feature flag on Android.
45+
- There is a record per address entry in sync storage.
46+
47+
## Payment methods (Credit Cards)
48+
49+
- Payment methods are merged when synced, so that the result is all payment methods from all connected devices.
50+
- There is a record per payment method (credit card) in sync storage.
51+
52+
## Add-ons
53+
54+
- Add-ons automatically (for now) sync between desktop clients only.
55+
- Add-ons categorically include web extensions, themes, and language packs, but language packs do not sync.
56+
- Themes do sync, but can be adversely affected by Settings sync (see below).
57+
- Web extensions syncing automatically means that installation/removal or enabling/disabling of an extension from one connected device will result in that same action occurring on the other connected device.
58+
- Web extensions syncing does not imply that the extensions share data; extension's ability to share data is based on the extension developer using the web extensions `storage.sync` API.
59+
- Extensions on any platform cannot use synced storage (i.e. the `storage.sync` API) unless the user has checked the "Add-ons" option in Sync settings/Choose What To Sync.
60+
- There is a record per add-on in sync storage.
61+
62+
## Settings (Prefs)
63+
64+
- Prefs are not merged when synced. They synced as an entire set, and the latest write wins.
65+
- Settings sync between desktop clients only; there is no mobile analogue for desktop preferences, so no mapping exists.
66+
- By "settings" we mean: a grab-bag of things from `about:config` (specifically, anything of the form `services.sync.prefs.sync.*`).
67+
- All of the syncable prefs are synced: users cannot currently choose to sync only a subset of these prefs.
68+
- Advanced/Adventuresome users can include/exclude certain preferences (see documentation for details).
69+
70+
## Other data
71+
72+
There are four other collections of data that sync. These are special, and they continue syncing even if you uncheck all displayed data types in the Choose What To Sync dialog.
73+
74+
- **clients**: A list of clients, used in reconciling the list of clients received from Accounts.
75+
- **meta**: A list of data that allows the client to coordinate syncing (engines declined, syncID, storageVersion, etc).
76+
- **crypto**: Cryptographic keys and data for encryption/decryption.
77+
- **keys**: Key management data for sync encryption.

docs/src/faq.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Frequently Asked Questions
2+
3+
## What is Sync?
4+
5+
Sync is a system of both a backend and client engines that are responsible for the syncing of client data to the storage server.
6+
7+
## When do things sync?
8+
9+
Engines do a full sync on a regular period (except for Tabs, see below):
10+
11+
- **iOS**: Every 15 minutes
12+
- **Fenix**: Every 4 hours (after an initial delay)
13+
- **Desktop**:
14+
- Initial delay:
15+
- Wake from sleep: 2s after wake
16+
- After startup: 5 minutes
17+
- The period varies depending on state:
18+
- Idle: 1 hour
19+
- Active: 10 minutes
20+
- After recently syncing something: 1.5 minutes (if we've synced something new, we temporarily change the sync delay from 10min → 1.5min until we don't have anything left to sync)
21+
22+
**Tabs** were changed with MR 2022 to sync every 5s after a tab change. This is sometimes called "quick writing."
23+
24+
## In what order do things sync?
25+
26+
The order of the engines is determined per-platform.
27+
28+
- **Desktop**: engines, prefs, passwords, tabs, bookmarks, addons, form autofill, forms, history, extension storage
29+
- **Mobile**: Matches desktop, ignoring engines and prefs as they aren't analogous
30+
31+
However, clients can override this.
32+
33+
## What happens when I click on "Sync Now" in Firefox?
34+
35+
A "Sync Now" button or link in the UI on device A only initiates syncing for that same device A – it does not force all of your connected devices to sync. This is still true when "Sync now" is a contextual option (such as the Firefox sidebar) – clicking on what appears to be "Sync now" for a connected mobile device from desktop actually only initiates syncing of that desktop.
36+
37+
## Does every platform have its own engines?
38+
39+
We use shared components as much as possible to avoid every platform having its own engines.
40+
41+
## Can Mozilla read/inspect/decrypt a user's synced data?
42+
43+
No. Client data is encrypted before it leaves the client; we cannot decrypt this outside of the client, by design. Therefore, the server is extremely limited (e.g. no searching, filtering, fancy queries, etc). If you want to do operations on the data, they have to be done on the client.
44+
45+
## What is the structure of synced data on the storage server?
46+
47+
The structure of the synced data is not the same as the structure of the data in the client. You don't sync entire databases. Synced data is a set of JSON key-value stores with no relationships between them.
48+
49+
- In these key-value stores, the key is a GUID and the value is an encrypted blob of JSON. Each of these stores represents a "collection" (bookmarks, tabs, logins, etc).
50+
- The JSON blobs are associated with hashed user and key IDs derived from the user's FxA. There are no identifiable relationships of this data apart from the `collection_id` foreign key that identifies what type of data it is.
51+
- In most cases, each item in a store is its own record (e.g. each bookmark is one record). Tabs is different, as each device's tabs is in a single record.
52+
- Because the JSON blob is encrypted, the server cannot see the content of any synced data. This means:
53+
- No relationships are enforced between collections
54+
- No atomic updates are possible across collections, only within a collection
55+
- Modeling a relational DB in synced data isn't viable
56+
57+
## Where are the user's Sync settings stored?
58+
59+
The storage server does not store the user's Sync settings, and neither does FxA. When a user sets which types of data to sync, those are sent to the storage server as collections that the indicated user will sync. Subsequent syncs will request to this data as part of the sync process.
60+
61+
## Syncing, step by step
62+
63+
From the client/user perspective:
64+
65+
1. Fetch kSync encryption key and kXCS node assignment token from FxA
66+
2. Obtain token and storage node endpoint from token server
67+
3. Fetch (unencrypted) associated collections (`info/collections`) and their last-modified time
68+
4. Fetch (unencrypted) global metadata (`meta/global`) about syncing – IDs, version numbers, etc
69+
5. Compare global sync IDs and storage versions to determine if we can sync – or if we need to start over
70+
6. Fetch encryption and signing keys (`crypto/keys`) for future syncing
71+
7. Sync the clients engine to download new client records and commands
72+
8. Process incoming client commands
73+
9. Determine and update enabled engines
74+
10. For each enabled engine:
75+
- Fetch new records from the server
76+
- Decrypt each record and handle decryption errors
77+
- Resolve merge conflicts between incoming and changed records from step 10
78+
- Insert and update new records into the local store
79+
- Ask the tracker for a list of IDs changed since the last sync, and upload these records to the server
80+
- If an engine tracks a "backlog", make some progress on that backlog. This is only true for the history engine on desktop
81+
11. Sync the clients engine to upload outgoing commands
82+
12. Update `meta/global` on the server
83+
13. Run validation for synced engines
84+
14. Schedule next sync

docs/src/how-to-run-with-docker.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)