@oxy.so/app-preset 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/certs/README.md +60 -29
- package/certs/oxy-updates-code-signing.pem +18 -0
- package/package.json +1 -1
- package/plugin/withOxyUpdates.js +40 -15
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ and JSON.
|
|
|
16
16
|
| --- | --- | --- |
|
|
17
17
|
| Config plugin | `['@oxy.so/app-preset', {}]` | iOS keychain entitlement + `expo-build-properties` + `@oxy.so/services/plugins/withOxySharedPermissions` (which signs every release with the ecosystem key, see below) + the R8 `-optimize` ProGuard file |
|
|
18
18
|
| Android WebP resources | `@oxy.so/app-preset/plugin/withOxyAndroidWebp` | re-encoding generated mipmaps/splash bitmaps to real lossless WebP (opt-in, needs `sharp`) |
|
|
19
|
-
| Oxy Updates (OTA) | `@oxy.so/app-preset/plugin/withOxyUpdates` | the `expo-updates` manifest URL, release channel, `runtimeVersion` policy and the shared code-signing certificate (opt-in, see below) |
|
|
19
|
+
| Oxy Updates (OTA) | `@oxy.so/app-preset/plugin/withOxyUpdates` | the `expo-updates` manifest URL, release channel, `runtimeVersion` policy and the shared code-signing certificate, required (opt-in, see below) |
|
|
20
20
|
| Metro | `@oxy.so/app-preset/metro` | monorepo watch folders, block list, symlink + package-exports resolution, web-font/wasm asset exts, release minifier, NativeWind wrapper |
|
|
21
21
|
| Babel | `@oxy.so/app-preset/babel` | `babel-preset-expo` alone in development, so Expo's oxc transformer (Noxcturnal) runs; the build-id inliner in production |
|
|
22
22
|
| ESLint | `@oxy.so/app-preset/eslint` | `eslint-config-expo/flat` + `dist/*` ignore |
|
|
@@ -226,10 +226,13 @@ receive JS assuming native modules they do not have.
|
|
|
226
226
|
|
|
227
227
|
**Code signing is one certificate for the whole ecosystem**, shipped in this
|
|
228
228
|
package at `certs/oxy-updates-code-signing.pem` rather than copied into each app
|
|
229
|
-
repo, so a rotation is one preset bump. See `certs/README.md` for how it
|
|
230
|
-
generated and
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
repo, so a rotation is one preset bump. See `certs/README.md` for how it was
|
|
230
|
+
generated, where its private key lives, and how to rotate it. `withOxyUpdates`
|
|
231
|
+
fails the build (5.2.0+; before that the code defaulted to a warning) when the
|
|
232
|
+
certificate is missing or is not a PEM certificate, rather than producing a
|
|
233
|
+
binary that accepts unsigned manifests for its whole lifetime. The server side
|
|
234
|
+
matches: oxy-api signs every manifest and directive and serves nothing, and
|
|
235
|
+
accepts no publish, without its key. Development builds may explicitly pass
|
|
233
236
|
`{ codeSigning: 'auto' }` to receive platform warnings, or
|
|
234
237
|
`{ codeSigning: false }` to opt out of verification.
|
|
235
238
|
|
package/certs/README.md
CHANGED
|
@@ -1,55 +1,86 @@
|
|
|
1
1
|
# Oxy Updates code-signing certificate
|
|
2
2
|
|
|
3
|
-
`withOxyUpdates`
|
|
3
|
+
`withOxyUpdates` reads exactly one file in this directory:
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
oxy-updates-code-signing.pem
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
It is the **public** half of the Oxy Updates code-signing keypair
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
It is the **public** half of the Oxy Updates code-signing keypair (RSA 2048,
|
|
10
|
+
self-signed, `CN=Oxy Updates Code Signing`, extended key usage Code Signing,
|
|
11
|
+
valid 2026-10-24 to 2036-10-24, SHA-256 fingerprint
|
|
12
|
+
`E9:1D:40:E6:BA:F7:05:C8:C1:94:FF:89:F8:FD:65:E6:6B:89:DA:AB:26:95:B9:E4:7A:7E:54:28:F5:39:DA:81`).
|
|
13
|
+
It is safe to commit, and it lives here rather than in each app repo so that a
|
|
14
|
+
key rotation is one `@oxy.so/app-preset` bump instead of one edit per app.
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
`withOxyUpdates` fails the build when this file is missing or is not a PEM
|
|
17
|
+
certificate (`codeSigning: 'require'`, the default), because the certificate is
|
|
18
|
+
baked into the native binary: a binary built without it accepts unsigned
|
|
19
|
+
manifests for its whole lifetime. `codeSigning: 'auto'` / `false` are for local
|
|
20
|
+
development builds only.
|
|
17
21
|
|
|
18
|
-
##
|
|
22
|
+
## Where the private key lives
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
- **SSM SecureString `/oxy/oxy-api/UPDATES_CODE_SIGNING_PRIVATE_KEY`** (us-west-2,
|
|
25
|
+
KMS `alias/aws/ssm`), the base64-encoded PKCS#8 PEM. It is the only copy the
|
|
26
|
+
server reads: `deploy-aws.yml` binds it into the oxy-api task definition
|
|
27
|
+
(`TASK_SECRET_OVERRIDES_JSON`) and `services/updates/signing.service.ts` decodes
|
|
28
|
+
it. Runtime secrets are SSM-only (oxy-infra `docs/runbooks/46-app-secrets-in-ssm.md`);
|
|
29
|
+
it is NOT a GitHub Actions secret.
|
|
30
|
+
- **Offline backup**: `~/.config/oxy/oxy-updates-code-signing-private-key.b64`
|
|
31
|
+
(mode 0600) on the platform owner's machine, next to the Android release
|
|
32
|
+
keystore, and into the same USB vault.
|
|
33
|
+
|
|
34
|
+
Without the key, oxy-api answers every manifest request with 503 and refuses
|
|
35
|
+
every publish; it never serves an unsigned manifest.
|
|
36
|
+
|
|
37
|
+
## Provisioning (done 2026-10-25; for the record and for a rotation)
|
|
38
|
+
|
|
39
|
+
From `packages/api`:
|
|
21
40
|
|
|
22
41
|
```bash
|
|
23
42
|
bun scripts/generate-updates-code-signing.ts \
|
|
24
|
-
../app-preset/certs/oxy-updates-code-signing.pem
|
|
43
|
+
../app-preset/certs/oxy-updates-code-signing.pem \
|
|
44
|
+
~/.config/oxy/oxy-updates-code-signing-private-key.b64
|
|
25
45
|
```
|
|
26
46
|
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
The script writes the certificate here and the private key to the second path
|
|
48
|
+
with mode 0600. It refuses a key path inside a git work tree or one that already
|
|
49
|
+
exists, and it never prints the key. Then:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
aws ssm put-parameter --profile oxy --region us-west-2 --type SecureString \
|
|
53
|
+
--name /oxy/oxy-api/UPDATES_CODE_SIGNING_PRIVATE_KEY \
|
|
54
|
+
--value file://$HOME/.config/oxy/oxy-updates-code-signing-private-key.b64
|
|
55
|
+
```
|
|
29
56
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
workflow syncs it to SSM `/oxy/oxy-api/UPDATES_CODE_SIGNING_PRIVATE_KEY`, and
|
|
33
|
-
oxy-api reads it in `services/updates/signing.service.ts`.
|
|
34
|
-
2. Commit **only** the certificate. The private key is never written to disk by
|
|
35
|
-
the script and must never enter the repo.
|
|
36
|
-
3. Clear the terminal scrollback.
|
|
57
|
+
`--value file://` keeps the key out of the shell history and the terminal.
|
|
58
|
+
Commit **only** the certificate.
|
|
37
59
|
|
|
38
|
-
Verify the server
|
|
39
|
-
stop returning HTTP 500.
|
|
60
|
+
Verify the server, after a deploy, with the key bound:
|
|
40
61
|
|
|
41
62
|
```bash
|
|
42
|
-
curl -s -o /dev/null
|
|
43
|
-
-H 'expo-protocol-version: 1' -H 'expo-platform:
|
|
44
|
-
-H 'expo-runtime-version: 1.
|
|
45
|
-
-H 'expo-expect-signature: sig, keyid="main", alg="rsa-v1_5-sha256"' \
|
|
63
|
+
curl -s -D - -o /dev/null \
|
|
64
|
+
-H 'expo-protocol-version: 1' -H 'expo-platform: android' \
|
|
65
|
+
-H 'expo-runtime-version: 1.3.0' -H 'expo-channel-name: production' \
|
|
46
66
|
https://api.oxy.so/updates/v1/apps/<clientId>/manifest
|
|
47
67
|
```
|
|
48
68
|
|
|
69
|
+
It must answer 200 (a 503 means the key is not bound), and the multipart part
|
|
70
|
+
must carry `expo-signature: sig="…", keyid="main"` that verifies against this
|
|
71
|
+
certificate. The deploy's post-deploy smoke checks exactly that.
|
|
72
|
+
|
|
49
73
|
## Rotation
|
|
50
74
|
|
|
51
75
|
The certificate is baked into a native binary at build time, so a rotation only
|
|
52
76
|
reaches devices that install a NEW binary carrying the new certificate. Rotate by
|
|
53
|
-
generating a new pair, shipping the new certificate in a store
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
generating a new pair to a NEW key path, shipping the new certificate in a store
|
|
78
|
+
release of every OTA app first (the plugin's `certificatePath` covers an overlap
|
|
79
|
+
where one binary must trust the incoming certificate early), and only switching
|
|
80
|
+
the SSM parameter once that release has taken over. Devices still on the old
|
|
81
|
+
binary reject manifests signed by the new key, and stop receiving updates.
|
|
82
|
+
|
|
83
|
+
Binaries built before this certificate was committed verify nothing (every
|
|
84
|
+
Commons build up to and including the 1.3.0 test builds; Accounts likewise).
|
|
85
|
+
Commons' first signed runtime is 1.4.0. Never publish an update for a runtime
|
|
86
|
+
version that only such binaries run: they would run it unverified.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIC8zCCAdugAwIBAgIJNavjOrAeD36HMA0GCSqGSIb3DQEBCwUAMCMxITAfBgNV
|
|
3
|
+
BAMMGE94eSBVcGRhdGVzIENvZGUgU2lnbmluZzAeFw0yNjEwMjQyMzEzMzdaFw0z
|
|
4
|
+
NjEwMjQyMzEzMzdaMCMxITAfBgNVBAMMGE94eSBVcGRhdGVzIENvZGUgU2lnbmlu
|
|
5
|
+
ZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALmY5biytPgR37i0MKhy
|
|
6
|
+
+3F7cr6tEQ0QpHV9XOZdXlMKWWZXM9tI8lv+apFL1jUdgRkLL/1WP+1IW6c8vz4W
|
|
7
|
+
GSVJSurKfe4uO8Chp7SLiDIM/aUDMfi++7iGV5GbJB8351XOSK6pw77keszjdjjW
|
|
8
|
+
U1lzwnWzl58Ok6XgwOT7Y9316FbCaNc4Zm6Zo/YA0elYCi1Bzg8xmPwEuE/pS6sD
|
|
9
|
+
+eyXc6i6ulaAPwTPdMkq95e/oKBkWsyHJPEVqaIZYnANB5ysJVYrHwm/6UiFOrlc
|
|
10
|
+
jGtQZ6Nd4b2tOvwLB2MXVo5V8ruOx1k9uR+SbzHV8CuBGjDT6tI3dHzP3WWFzznn
|
|
11
|
+
AN8CAwEAAaMqMCgwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
|
|
12
|
+
BwMDMA0GCSqGSIb3DQEBCwUAA4IBAQA+n7UgCUqsZehbhnxQuo5rKTb2YVtjcJQ5
|
|
13
|
+
ju9G0N2MwCtCLW4Ra3zGqwSHm6vzRiGCTdU4vj05wSj0/4xWauQoV83Y72fWWixq
|
|
14
|
+
CqxM3rpscYBvOdpd98qU7Rfv32ROIcT7dU7GEcgRlasujOn9EPK3jdx/UjYxwZQB
|
|
15
|
+
k0AHchz8uNeEd0B2iGgQS9igcb57RI4C+D2gZlpb+BMPM5cNqefn2Dk1B0V3J2bv
|
|
16
|
+
A73yiP/9QoL3J1kIpToKafVwNI3yxkWPhz6VPN9dinkvseJHNF4AV+wRciRq1FlW
|
|
17
|
+
zrIo1oeMMhO5FEFMyo3FsPmtUvQVvw6y7TVpiiGzp5EcCv/C+q5r
|
|
18
|
+
-----END CERTIFICATE-----
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/app-preset",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "The Oxy distro of Expo — centralized Expo config plugin, Metro/Babel/ESLint factories, Tailwind base CSS and TypeScript bases shared by every Oxy app (Mention, Homiio, Allo, accounts, …). A zero-build package: apps replace copy-pasted config with a single dependency bump.",
|
|
5
5
|
"main": "./app.plugin.js",
|
|
6
6
|
"publishConfig": {
|
package/plugin/withOxyUpdates.js
CHANGED
|
@@ -39,12 +39,14 @@
|
|
|
39
39
|
* (`certs/oxy-updates-code-signing.pem`) rather than copied into every app repo,
|
|
40
40
|
* so a key rotation is one preset bump instead of thirteen.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* certificate is baked into the native build
|
|
46
|
-
*
|
|
47
|
-
*
|
|
42
|
+
* **It fails closed.** The default is `codeSigning: 'require'`: a build whose
|
|
43
|
+
* certificate is missing or is not a PEM certificate throws, because a binary
|
|
44
|
+
* built without it can never verify a manifest signature for its whole lifetime
|
|
45
|
+
* (the certificate is baked into the native build) and would run whatever an
|
|
46
|
+
* attacker between it and the server sent. The server side matches: oxy-api
|
|
47
|
+
* signs every manifest and directive and serves nothing without its key.
|
|
48
|
+
* `'auto'` (warn when absent) and `false` (no verification) exist for local
|
|
49
|
+
* development only and must be asked for explicitly.
|
|
48
50
|
*
|
|
49
51
|
* @param {import('expo/config').ExpoConfig} config
|
|
50
52
|
* @param {object} options
|
|
@@ -52,9 +54,10 @@
|
|
|
52
54
|
* (`oxy_dk_...`) identifying this app to the update server. Required.
|
|
53
55
|
* @param {string} [options.apiOrigin='https://api.oxy.so'] Origin serving `/updates/v1`.
|
|
54
56
|
* @param {string} [options.channel='production'] Release channel this binary tracks.
|
|
55
|
-
* @param {'
|
|
56
|
-
*
|
|
57
|
-
*
|
|
57
|
+
* @param {'require'|'auto'|false} [options.codeSigning='require'] `require`
|
|
58
|
+
* throws unless a valid certificate is present; `auto` (development only)
|
|
59
|
+
* wires signing when present and warns when not; `false` (development only)
|
|
60
|
+
* skips verification entirely.
|
|
58
61
|
* @param {string} [options.certificatePath] Absolute path to a different
|
|
59
62
|
* certificate than the bundled one. Normally unset; it exists for the overlap
|
|
60
63
|
* window of a key rotation, where one binary has to trust an incoming
|
|
@@ -92,7 +95,7 @@ module.exports = function withOxyUpdates(config, options = {}) {
|
|
|
92
95
|
clientId,
|
|
93
96
|
apiOrigin = DEFAULT_API_ORIGIN,
|
|
94
97
|
channel = DEFAULT_CHANNEL,
|
|
95
|
-
codeSigning = '
|
|
98
|
+
codeSigning = 'require',
|
|
96
99
|
certificatePath = CERTIFICATE_PATH,
|
|
97
100
|
runtimeVersionPolicy = 'appVersion',
|
|
98
101
|
} = options;
|
|
@@ -117,8 +120,29 @@ module.exports = function withOxyUpdates(config, options = {}) {
|
|
|
117
120
|
updates.url = `${origin}/updates/v1/apps/${clientId}/manifest`;
|
|
118
121
|
updates.requestHeaders = { ...updates.requestHeaders, 'expo-channel-name': channel };
|
|
119
122
|
|
|
123
|
+
if (codeSigning !== false && codeSigning !== 'auto' && codeSigning !== 'require') {
|
|
124
|
+
throw new Error(
|
|
125
|
+
`[${PLUGIN_NAME}] \`codeSigning\` must be 'require' (the default), 'auto' or false; got ` +
|
|
126
|
+
`${JSON.stringify(codeSigning)}.`,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
120
130
|
if (codeSigning !== false) {
|
|
121
|
-
|
|
131
|
+
const certificate = fs.existsSync(certificatePath)
|
|
132
|
+
? fs.readFileSync(certificatePath, 'utf8')
|
|
133
|
+
: null;
|
|
134
|
+
if (
|
|
135
|
+
certificate !== null &&
|
|
136
|
+
!/-----BEGIN CERTIFICATE-----[\s\S]+-----END CERTIFICATE-----/.test(certificate)
|
|
137
|
+
) {
|
|
138
|
+
// Never wire a file expo-updates cannot parse: the binary would fail every
|
|
139
|
+
// update check, or worse, a later native change could treat it as absent.
|
|
140
|
+
throw new Error(
|
|
141
|
+
`[${PLUGIN_NAME}] ${certificatePath} is not a PEM certificate. It must be the PUBLIC ` +
|
|
142
|
+
'certificate written by oxy-api `scripts/generate-updates-code-signing.ts`.',
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
if (certificate !== null) {
|
|
122
146
|
const projectRoot = config._internal?.projectRoot;
|
|
123
147
|
if (typeof projectRoot !== 'string') {
|
|
124
148
|
throw new Error(
|
|
@@ -133,10 +157,11 @@ module.exports = function withOxyUpdates(config, options = {}) {
|
|
|
133
157
|
updates.codeSigningMetadata = { keyid: CODE_SIGNING_KEY_ID, alg: CODE_SIGNING_ALG };
|
|
134
158
|
} else if (codeSigning === 'require') {
|
|
135
159
|
throw new Error(
|
|
136
|
-
`[${PLUGIN_NAME}]
|
|
137
|
-
`${certificatePath}
|
|
138
|
-
'
|
|
139
|
-
'
|
|
160
|
+
`[${PLUGIN_NAME}] the Oxy Updates code-signing certificate is missing at ` +
|
|
161
|
+
`${certificatePath}, and an OTA-enabled build without it would accept unsigned ` +
|
|
162
|
+
'updates for its whole lifetime. Use an @oxy.so/app-preset that ships ' +
|
|
163
|
+
'`certs/oxy-updates-code-signing.pem` (see certs/README.md). For a local development ' +
|
|
164
|
+
"build only, pass `{ codeSigning: 'auto' }` or `{ codeSigning: false }`.",
|
|
140
165
|
);
|
|
141
166
|
} else {
|
|
142
167
|
const warning =
|