create-disposabl-app 0.17.6 → 0.18.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 +4 -0
- package/dist/disposabl.js +42 -9
- package/dist/index.js +64 -18
- package/dist/templates/default/apps/mobile/README.md +40 -0
- package/dist/templates/default/apps/mobile/app.config.js +46 -2
- package/dist/templates/default/apps/mobile/package.json +7 -1
- package/dist/templates/default/apps/mobile/plugins/with-android-signing.js +23 -1
- package/dist/templates/default/apps/mobile/scripts/fresh-android.mjs +24 -0
- package/dist/templates/default/apps/mobile/scripts/play-aab.mjs +176 -0
- package/dist/templates/default/apps/mobile/scripts/verify-play-aab.mjs +77 -0
- package/dist/templates/default/bun.lock +12 -3
- package/dist/templates/default/bunfig.toml +1 -0
- package/dist/templates/default/package.json +6 -2
- package/dist/templates/default/packages/backend/convex/files/guard.ts +2 -0
- package/dist/templates/default/packages/backend/convex/http.ts +11 -1
- package/dist/templates/default/packages/backend/convex/schema.ts +10 -0
- package/dist/templates/default/packages/backend/convex/telemetry.ts +12 -16
- package/dist/templates/default/packages/cli/telemetry.ts +40 -3
- package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +2 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/account-deletion.tsx +111 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/consent-identity.tsx +50 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/legal-page.tsx +12 -1
- package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry-lease.ts +200 -0
- package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry.ts +8 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/consent.tsx +23 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/legal/delete-account.tsx +6 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/legal/support.tsx +33 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/pricing.tsx +13 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +19 -2
- package/dist/templates/default/packages/disposabl-kit/client/vite.config.ts +1 -0
- package/dist/templates/default/packages/disposabl-kit/legal/README.md +1 -1
- package/dist/templates/default/packages/disposabl-kit/legal/config.ts +32 -4
- package/dist/templates/default/packages/disposabl-kit/legal/index.ts +2 -2
- package/dist/templates/default/packages/disposabl-kit/legal/publisher.ts +6 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +13 -9
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/paywall.ts +28 -4
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/policy.ts +31 -14
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/web-checkout.ts +45 -34
- package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-links.tsx +14 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/expo-plugin.cjs +3 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/index.ts +4 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +55 -8
- package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +147 -124
- package/dist/templates/default/packages/disposabl-kit/server/billing-handoff.ts +113 -95
- package/dist/templates/default/packages/disposabl-kit/server/files-functions.ts +70 -54
- package/dist/templates/default/packages/disposabl-kit/server/http.ts +49 -21
- package/dist/templates/default/packages/disposabl-kit/server/lib/platform-spec.ts +25 -1
- package/dist/templates/default/packages/disposabl-kit/server/lib/telemetry.ts +375 -69
- package/dist/templates/default/packages/sdk/README.md +2 -0
- package/dist/templates/default/packages/sdk/src/analytics.ts +7 -2
- package/dist/templates/default/packages/skill/SKILL.md +4 -2
- package/dist/templates/default/packages/skill/references/store-submissions.md +25 -0
- package/dist/templates/default/packages/tests/README.md +28 -1
- package/dist/templates/default/packages/tests/account-deletion-ui.test.ts +21 -0
- package/dist/templates/default/packages/tests/auth-email-setup.test.ts +45 -0
- package/dist/templates/default/packages/tests/components/account-deletion.test.mjs +82 -0
- package/dist/templates/default/packages/tests/components/consent-identity.test.mjs +175 -0
- package/dist/templates/default/packages/tests/components/mobile-deletion-link.test.mjs +40 -0
- package/dist/templates/default/packages/tests/components/mobile-theme.test.mjs +56 -3
- package/dist/templates/default/packages/tests/components/pricing-identity.test.mjs +113 -0
- package/dist/templates/default/packages/tests/components/support-page.test.mjs +36 -0
- package/dist/templates/default/packages/tests/consent-identity.test.ts +13 -0
- package/dist/templates/default/packages/tests/desktop-macos-release.test.ts +153 -145
- package/dist/templates/default/packages/tests/flows/legal.e2e.ts +40 -3
- package/dist/templates/default/packages/tests/helpers/auth-email-setup/probe.test.mjs +44 -0
- package/dist/templates/default/packages/tests/helpers/mobile-simulator/preflight.py +80 -0
- package/dist/templates/default/packages/tests/helpers/mobile-simulator/test_preflight.py +57 -0
- package/dist/templates/default/packages/tests/mobile-android-e2e-network.test.ts +81 -1
- package/dist/templates/default/packages/tests/mobile-android-signing.test.ts +52 -0
- package/dist/templates/default/packages/tests/mobile-deletion-link.test.ts +21 -0
- package/dist/templates/default/packages/tests/mobile-ios-reachability-pin.test.ts +84 -0
- package/dist/templates/default/packages/tests/mobile-simulator-preflight.test.ts +16 -0
- package/dist/templates/default/packages/tests/native-billing.test.ts +288 -0
- package/dist/templates/default/packages/tests/pricing-identity.test.ts +13 -0
- package/dist/templates/default/packages/tests/sdk-analytics.test.ts +28 -2
- package/dist/templates/default/packages/tests/support-page.test.ts +13 -0
- package/dist/templates/default/packages/tests/telemetry.test.ts +389 -18
- package/dist/templates/default/packages/tests/ui-telemetry-lease.test.ts +346 -0
- package/dist/templates/default/patches/convex-mcp-account-erasure-alpha7.patch +466 -0
- package/dist/templates/default/vendor/README.md +61 -1
- package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.1.patch +890 -0
- package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.1.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.2.patch +1060 -0
- package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.2.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.4.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.5.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.6.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.7.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.8.tgz +0 -0
- package/dist/templates/default/vendor/convex-auth-core-erasure-disposabl.6.patch +115 -0
- package/dist/templates/default/vendor/convex-auth-identity-cutoff-disposabl.7.patch +442 -0
- package/dist/templates/default/vendor/convex-auth-identity-erasure-disposabl.8.md +11 -0
- package/dist/templates/default/vendor/convex-auth-identity-erasure-disposabl.8.patch +78 -0
- package/dist/templates/default/vendor/convex-auth-marker-disposabl.4.patch +169 -0
- package/dist/templates/default/vendor/convex-auth-marker-password-disposabl.5.patch +126 -0
- package/package.json +1 -1
|
@@ -12,32 +12,35 @@ import { tmpdir } from "node:os";
|
|
|
12
12
|
import { join, resolve } from "node:path";
|
|
13
13
|
import { spawnSync } from "node:child_process";
|
|
14
14
|
|
|
15
|
-
test(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
writeFileSync(join(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
15
|
+
test(
|
|
16
|
+
"macOS signed release verifies before enabling publication and cleans credentials",
|
|
17
|
+
{ timeout: 30_000 },
|
|
18
|
+
() => {
|
|
19
|
+
const root = mkdtempSync(join(tmpdir(), "macos-release-test-"));
|
|
20
|
+
try {
|
|
21
|
+
const bin = join(root, "bin");
|
|
22
|
+
mkdirSync(bin);
|
|
23
|
+
mkdirSync(join(root, "dist", "release"), { recursive: true });
|
|
24
|
+
writeFileSync(join(root, "dist", "release", "app.zip"), "fixture");
|
|
25
|
+
writeFileSync(join(root, "dist", "release", "app.dmg"), "fixture");
|
|
26
|
+
const mock = (name: string, body: string) =>
|
|
27
|
+
writeFileSync(join(bin, name), `#!/bin/bash\nset -e\n${body}\n`, {
|
|
28
|
+
mode: 0o755,
|
|
29
|
+
});
|
|
30
|
+
mock("security", 'echo "$1" >> "$CALLS"');
|
|
31
|
+
mock(
|
|
32
|
+
"base64",
|
|
33
|
+
`node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>process.stdout.write(Buffer.from(s.trim(),"base64")))'`,
|
|
34
|
+
);
|
|
35
|
+
mock("bun", 'echo build >> "$CALLS"');
|
|
36
|
+
mock("ditto", 'mkdir -p "$4/Test.app"');
|
|
37
|
+
mock(
|
|
38
|
+
"hdiutil",
|
|
39
|
+
'if [[ "$1" == attach ]]; then [[ "${FAIL_STAGE:-}" != attach ]] || exit 1; mkdir -p "$5/Test.app"; else [[ "${FAIL_STAGE:-}" != detach ]] || exit 1; rm -rf "$2/Test.app"; echo detach >> "$CALLS"; fi',
|
|
40
|
+
);
|
|
41
|
+
mock(
|
|
42
|
+
"codesign",
|
|
43
|
+
`target="\${@: -1}"
|
|
41
44
|
if [[ "$1" == "-dv" ]]; then
|
|
42
45
|
hash=abc123
|
|
43
46
|
if [[ "$target" == */mount/* && "\${FAIL_STAGE:-}" == mismatch ]]; then hash=def456; fi
|
|
@@ -46,141 +49,146 @@ else
|
|
|
46
49
|
[[ "\${FAIL_VERIFY:-}" != true ]] || exit 1
|
|
47
50
|
[[ "$target" != */mount/* || "\${FAIL_STAGE:-}" != signature ]] || exit 1
|
|
48
51
|
fi`,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
const script = resolve(
|
|
68
|
-
import.meta.dirname,
|
|
69
|
-
"../../.github/scripts/macos-release.sh",
|
|
70
|
-
);
|
|
71
|
-
const run = (fail: boolean, signingConfig = config, stage = "") => {
|
|
72
|
-
rmSync(join(root, "env"), { force: true });
|
|
73
|
-
return spawnSync("bash", [script], {
|
|
74
|
-
cwd: root,
|
|
75
|
-
encoding: "utf8",
|
|
76
|
-
env: {
|
|
77
|
-
...process.env,
|
|
78
|
-
PATH: `${bin}:${process.env.PATH}`,
|
|
79
|
-
RUNNER_TEMP: root,
|
|
80
|
-
GITHUB_ENV: join(root, "env"),
|
|
81
|
-
CALLS: join(root, "calls"),
|
|
82
|
-
MACOS_SIGNING_CONFIG: signingConfig,
|
|
83
|
-
FAIL_VERIFY: String(fail),
|
|
84
|
-
FAIL_STAGE: stage,
|
|
85
|
-
},
|
|
52
|
+
);
|
|
53
|
+
mock(
|
|
54
|
+
"xcrun",
|
|
55
|
+
'echo staple >> "$CALLS"; [[ "${@: -1}" != */mount/* || "${FAIL_STAGE:-}" != staple ]]',
|
|
56
|
+
);
|
|
57
|
+
mock(
|
|
58
|
+
"spctl",
|
|
59
|
+
'echo assess >> "$CALLS"; [[ "${@: -1}" != */mount/* || "${FAIL_STAGE:-}" != assess ]]',
|
|
60
|
+
);
|
|
61
|
+
const config = JSON.stringify({
|
|
62
|
+
certificateBase64: "Y2VydA==",
|
|
63
|
+
certificatePassword: "fixture-password",
|
|
64
|
+
identity: "Developer ID Application: Test (ABCDE12345)",
|
|
65
|
+
teamId: "ABCDE12345",
|
|
66
|
+
apiKeyBase64: "a2V5",
|
|
67
|
+
apiKeyId: "KEY",
|
|
68
|
+
apiIssuer: "ISSUER",
|
|
86
69
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
assert.equal(
|
|
112
|
-
readdirSync(root).some((name) => name.startsWith("macos-signing.")),
|
|
113
|
-
false,
|
|
114
|
-
);
|
|
115
|
-
for (const stage of ["signature", "staple", "assess", "mismatch"]) {
|
|
116
|
-
const invalidDmg = run(false, config, stage);
|
|
117
|
-
assert.notEqual(invalidDmg.status, 0, stage);
|
|
118
|
-
assert.doesNotMatch(
|
|
70
|
+
const script = resolve(
|
|
71
|
+
import.meta.dirname,
|
|
72
|
+
"../../.github/scripts/macos-release.sh",
|
|
73
|
+
);
|
|
74
|
+
const run = (fail: boolean, signingConfig = config, stage = "") => {
|
|
75
|
+
rmSync(join(root, "env"), { force: true });
|
|
76
|
+
return spawnSync("bash", [script], {
|
|
77
|
+
cwd: root,
|
|
78
|
+
encoding: "utf8",
|
|
79
|
+
env: {
|
|
80
|
+
...process.env,
|
|
81
|
+
PATH: `${bin}:${process.env.PATH}`,
|
|
82
|
+
RUNNER_TEMP: root,
|
|
83
|
+
GITHUB_ENV: join(root, "env"),
|
|
84
|
+
CALLS: join(root, "calls"),
|
|
85
|
+
MACOS_SIGNING_CONFIG: signingConfig,
|
|
86
|
+
FAIL_VERIFY: String(fail),
|
|
87
|
+
FAIL_STAGE: stage,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const success = run(false);
|
|
92
|
+
assert.equal(success.status, 0, success.stderr);
|
|
93
|
+
assert.match(
|
|
119
94
|
readFileSync(join(root, "env"), "utf8"),
|
|
120
|
-
/MACOS_NOTARIZE=true
|
|
95
|
+
/MACOS_NOTARIZE=true\n$/,
|
|
96
|
+
);
|
|
97
|
+
assert.match(
|
|
98
|
+
readFileSync(join(root, "calls"), "utf8"),
|
|
99
|
+
/delete-keychain/,
|
|
121
100
|
);
|
|
101
|
+
rmSync(join(root, "env"));
|
|
102
|
+
const failed = run(true);
|
|
103
|
+
assert.notEqual(failed.status, 0);
|
|
122
104
|
assert.equal(
|
|
123
|
-
|
|
105
|
+
(failed.stdout + failed.stderr).includes("fixture-password"),
|
|
124
106
|
false,
|
|
125
107
|
);
|
|
126
|
-
}
|
|
127
|
-
assert.equal(
|
|
128
|
-
readFileSync(join(root, "calls"), "utf8").match(/^detach$/gm)?.length,
|
|
129
|
-
5,
|
|
130
|
-
);
|
|
131
|
-
for (const stage of ["attach", "detach"]) {
|
|
132
|
-
assert.notEqual(run(false, config, stage).status, 0, stage);
|
|
133
108
|
assert.doesNotMatch(
|
|
134
109
|
readFileSync(join(root, "env"), "utf8"),
|
|
135
110
|
/MACOS_NOTARIZE=true/,
|
|
136
111
|
);
|
|
137
|
-
|
|
138
|
-
|
|
112
|
+
assert.equal(
|
|
113
|
+
readFileSync(join(root, "calls"), "utf8").match(/delete-keychain/g)
|
|
114
|
+
?.length,
|
|
115
|
+
2,
|
|
116
|
+
);
|
|
117
|
+
assert.equal(
|
|
118
|
+
readdirSync(root).some((name) => name.startsWith("macos-signing.")),
|
|
119
|
+
false,
|
|
139
120
|
);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
assert.
|
|
144
|
-
|
|
145
|
-
|
|
121
|
+
for (const stage of ["signature", "staple", "assess", "mismatch"]) {
|
|
122
|
+
const invalidDmg = run(false, config, stage);
|
|
123
|
+
assert.notEqual(invalidDmg.status, 0, stage);
|
|
124
|
+
assert.doesNotMatch(
|
|
125
|
+
readFileSync(join(root, "env"), "utf8"),
|
|
126
|
+
/MACOS_NOTARIZE=true/,
|
|
146
127
|
);
|
|
147
128
|
assert.equal(
|
|
148
|
-
|
|
149
|
-
|
|
129
|
+
readdirSync(root).some((name) => name.startsWith("macos-signing.")),
|
|
130
|
+
false,
|
|
150
131
|
);
|
|
151
|
-
// This is a mock directory, not a real mounted volume.
|
|
152
|
-
rmSync(remaining, { recursive: true });
|
|
153
132
|
}
|
|
133
|
+
assert.equal(
|
|
134
|
+
readFileSync(join(root, "calls"), "utf8").match(/^detach$/gm)?.length,
|
|
135
|
+
5,
|
|
136
|
+
);
|
|
137
|
+
for (const stage of ["attach", "detach"]) {
|
|
138
|
+
assert.notEqual(run(false, config, stage).status, 0, stage);
|
|
139
|
+
assert.doesNotMatch(
|
|
140
|
+
readFileSync(join(root, "env"), "utf8"),
|
|
141
|
+
/MACOS_NOTARIZE=true/,
|
|
142
|
+
);
|
|
143
|
+
const directories = readdirSync(root).filter((name) =>
|
|
144
|
+
name.startsWith("macos-signing."),
|
|
145
|
+
);
|
|
146
|
+
assert.equal(directories.length, stage === "detach" ? 1 : 0);
|
|
147
|
+
for (const directory of directories) {
|
|
148
|
+
const remaining = join(root, directory);
|
|
149
|
+
assert.equal(
|
|
150
|
+
spawnSync("test", ["-e", join(remaining, "AuthKey.p8")]).status,
|
|
151
|
+
1,
|
|
152
|
+
);
|
|
153
|
+
assert.equal(
|
|
154
|
+
spawnSync("test", ["-e", join(remaining, "certificate.p12")])
|
|
155
|
+
.status,
|
|
156
|
+
1,
|
|
157
|
+
);
|
|
158
|
+
// This is a mock directory, not a real mounted volume.
|
|
159
|
+
rmSync(remaining, { recursive: true });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const incomplete = run(false, JSON.stringify({ identity: "incomplete" }));
|
|
163
|
+
assert.notEqual(incomplete.status, 0);
|
|
164
|
+
assert.equal(spawnSync("test", ["-e", join(root, "env")]).status, 1);
|
|
165
|
+
const unsigned = run(false, "");
|
|
166
|
+
assert.equal(unsigned.status, 0, unsigned.stderr);
|
|
167
|
+
assert.equal(spawnSync("test", ["-e", join(root, "env")]).status, 1);
|
|
168
|
+
const leftover = join(root, "macos-signing.12345678");
|
|
169
|
+
const otherJob = join(root, "macos-signing.87654321");
|
|
170
|
+
mkdirSync(leftover);
|
|
171
|
+
mkdirSync(otherJob);
|
|
172
|
+
writeFileSync(join(leftover, "AuthKey.p8"), "fixture");
|
|
173
|
+
const cleanup = spawnSync("bash", [script, "cleanup"], {
|
|
174
|
+
cwd: root,
|
|
175
|
+
encoding: "utf8",
|
|
176
|
+
env: {
|
|
177
|
+
...process.env,
|
|
178
|
+
PATH: `${bin}:${process.env.PATH}`,
|
|
179
|
+
RUNNER_TEMP: root,
|
|
180
|
+
MACOS_SIGNING_DIRECTORY: leftover,
|
|
181
|
+
CALLS: join(root, "calls"),
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
assert.equal(cleanup.status, 0, cleanup.stderr);
|
|
185
|
+
assert.equal(spawnSync("test", ["-e", leftover]).status, 1);
|
|
186
|
+
assert.equal(spawnSync("test", ["-d", otherJob]).status, 0);
|
|
187
|
+
} finally {
|
|
188
|
+
rmSync(root, { recursive: true, force: true });
|
|
154
189
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
assert.equal(spawnSync("test", ["-e", join(root, "env")]).status, 1);
|
|
158
|
-
const unsigned = run(false, "");
|
|
159
|
-
assert.equal(unsigned.status, 0, unsigned.stderr);
|
|
160
|
-
assert.equal(spawnSync("test", ["-e", join(root, "env")]).status, 1);
|
|
161
|
-
const leftover = join(root, "macos-signing.12345678");
|
|
162
|
-
const otherJob = join(root, "macos-signing.87654321");
|
|
163
|
-
mkdirSync(leftover);
|
|
164
|
-
mkdirSync(otherJob);
|
|
165
|
-
writeFileSync(join(leftover, "AuthKey.p8"), "fixture");
|
|
166
|
-
const cleanup = spawnSync("bash", [script, "cleanup"], {
|
|
167
|
-
cwd: root,
|
|
168
|
-
encoding: "utf8",
|
|
169
|
-
env: {
|
|
170
|
-
...process.env,
|
|
171
|
-
PATH: `${bin}:${process.env.PATH}`,
|
|
172
|
-
RUNNER_TEMP: root,
|
|
173
|
-
MACOS_SIGNING_DIRECTORY: leftover,
|
|
174
|
-
CALLS: join(root, "calls"),
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
assert.equal(cleanup.status, 0, cleanup.stderr);
|
|
178
|
-
assert.equal(spawnSync("test", ["-e", leftover]).status, 1);
|
|
179
|
-
assert.equal(spawnSync("test", ["-d", otherJob]).status, 0);
|
|
180
|
-
} finally {
|
|
181
|
-
rmSync(root, { recursive: true, force: true });
|
|
182
|
-
}
|
|
183
|
-
});
|
|
190
|
+
},
|
|
191
|
+
);
|
|
184
192
|
|
|
185
193
|
test("macOS workflow publishes only verified signed artifacts", () => {
|
|
186
194
|
const parsed = spawnSync(
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { test } from "@e2e-dev/web";
|
|
2
2
|
import { expect } from "e2e";
|
|
3
|
+
import { authenticationEnabled } from "../../disposabl-kit/features";
|
|
4
|
+
import { legalConfig } from "../../disposabl-kit/legal";
|
|
3
5
|
|
|
4
6
|
for (const [path, title] of [
|
|
5
7
|
["/legal/privacy", "Privacy policy"],
|
|
@@ -31,8 +33,43 @@ test(
|
|
|
31
33
|
).toBeVisible();
|
|
32
34
|
await app.open("/legal/delete-account");
|
|
33
35
|
await expect(screen.getByRole("heading", "Privacy contact")).toBeVisible();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
if (legalConfig.privacyEmail)
|
|
37
|
+
await expect(
|
|
38
|
+
screen.getByRole("link", legalConfig.privacyEmail),
|
|
39
|
+
).toBeVisible();
|
|
40
|
+
else
|
|
41
|
+
await expect(
|
|
42
|
+
screen.getByText(
|
|
43
|
+
"The publisher has not provided a privacy contact yet.",
|
|
44
|
+
),
|
|
45
|
+
).toBeVisible();
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
test(
|
|
50
|
+
"support is public and deletion directs guests to sign in",
|
|
51
|
+
{ platforms: ["web"] },
|
|
52
|
+
async ({ app, screen }) => {
|
|
53
|
+
await app.open("/support");
|
|
54
|
+
await expect(screen.getByRole("heading", "Support")).toBeVisible();
|
|
55
|
+
if (legalConfig.privacyEmail)
|
|
56
|
+
await expect(
|
|
57
|
+
screen.getByRole("link", legalConfig.privacyEmail),
|
|
58
|
+
).toBeVisible();
|
|
59
|
+
else
|
|
60
|
+
await expect(
|
|
61
|
+
screen.getByText(
|
|
62
|
+
"The publisher has not provided a support contact yet.",
|
|
63
|
+
),
|
|
64
|
+
).toBeVisible();
|
|
65
|
+
await app.open("/legal/delete-account");
|
|
66
|
+
if (authenticationEnabled) {
|
|
67
|
+
await expect(
|
|
68
|
+
screen.getByRole("link", "Sign in", { exact: true }).last(),
|
|
69
|
+
).toBeVisible();
|
|
70
|
+
await expect(
|
|
71
|
+
screen.getByText("Sign in to manage your account deletion request."),
|
|
72
|
+
).toBeVisible();
|
|
73
|
+
}
|
|
37
74
|
},
|
|
38
75
|
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { expect, mock, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
// Use the checkout's installed package; observe arguments without replacing its behavior.
|
|
4
|
+
const { setupEmailPassword } =
|
|
5
|
+
await import("@convex-dev/auth/methods/email-password/server");
|
|
6
|
+
let options;
|
|
7
|
+
mock.module("@convex-dev/auth/methods/email-password/server", () => ({
|
|
8
|
+
setupEmailPassword: (core, value) => {
|
|
9
|
+
options = value;
|
|
10
|
+
return setupEmailPassword(core, value);
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
globalThis.fetch = () => {
|
|
14
|
+
throw new Error("Network forbidden in email setup test");
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
test("email module honors the deployment origin and optional sender", async () => {
|
|
18
|
+
if (process.env.EXPECT_INVALID === "1") {
|
|
19
|
+
await expect(import("../../../backend/convex/authEmail")).rejects.toThrow(
|
|
20
|
+
"setupEmailPassword: urls.signUp",
|
|
21
|
+
);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const actual = await import("../../../backend/convex/authEmail");
|
|
25
|
+
const origin = process.env.EXPECT_ORIGIN;
|
|
26
|
+
expect(options.urls).toEqual({
|
|
27
|
+
signUp: `${origin}/verify-email`,
|
|
28
|
+
changeEmail: `${origin}/verify-email`,
|
|
29
|
+
recovery: `${origin}/reset-password`,
|
|
30
|
+
});
|
|
31
|
+
for (const name of [
|
|
32
|
+
"signUpWithEmailPassword",
|
|
33
|
+
"completeSignUp",
|
|
34
|
+
"signInWithEmailPassword",
|
|
35
|
+
"changePassword",
|
|
36
|
+
"startPasswordRecovery",
|
|
37
|
+
"checkPasswordRecovery",
|
|
38
|
+
"completePasswordRecovery",
|
|
39
|
+
])
|
|
40
|
+
expect(actual[name]).toBeDefined();
|
|
41
|
+
expect(() => options.emailSender.apiKey).toThrow(
|
|
42
|
+
"Email delivery is not configured.",
|
|
43
|
+
);
|
|
44
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Inspect an isolated iOS simulator fixture; build records are attestations, not proof of a build."""
|
|
3
|
+
import argparse
|
|
4
|
+
import hashlib
|
|
5
|
+
import json
|
|
6
|
+
import plistlib
|
|
7
|
+
import re
|
|
8
|
+
import subprocess
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from urllib.parse import urlsplit
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def run(*args):
|
|
14
|
+
return subprocess.run(args, check=True, capture_output=True, text=True).stdout
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def inspect(app, record, source, app_id, group, backend, site, hermesc):
|
|
18
|
+
for url in (backend, site):
|
|
19
|
+
parsed = urlsplit(url)
|
|
20
|
+
if parsed.scheme != 'http' or parsed.hostname != '127.0.0.1' or not parsed.port or parsed.path or parsed.query or parsed.fragment or parsed.username:
|
|
21
|
+
raise ValueError('backend and site must be explicit HTTP 127.0.0.1 ports')
|
|
22
|
+
if not app_id.endswith('.preview') or group != 'local.' + app_id:
|
|
23
|
+
raise ValueError('expected isolated preview app ID and local keychain group')
|
|
24
|
+
info = plistlib.loads((app / 'Info.plist').read_bytes())
|
|
25
|
+
if info['CFBundleIdentifier'] != app_id:
|
|
26
|
+
raise ValueError('bundle ID mismatch')
|
|
27
|
+
binary = app / info['CFBundleExecutable']
|
|
28
|
+
if 'platform IOSSIMULATOR' not in run('xcrun', 'vtool', '-arch', 'arm64', '-show-build', str(binary)):
|
|
29
|
+
raise ValueError('arm64 iOS simulator platform required')
|
|
30
|
+
sections = run('otool', '-arch', 'arm64', '-l', str(binary))
|
|
31
|
+
if not all('sectname ' + name in sections for name in ('__entitlements', '__ents_der')):
|
|
32
|
+
raise ValueError('missing simulated entitlement sections')
|
|
33
|
+
output = run('otool', '-arch', 'arm64', '-s', '__TEXT', '__entitlements', str(binary))
|
|
34
|
+
raw = bytearray()
|
|
35
|
+
for line in output.splitlines():
|
|
36
|
+
parts = line.split()
|
|
37
|
+
if parts and re.fullmatch(r'[0-9a-fA-F]{16}', parts[0]):
|
|
38
|
+
for word in parts[1:]:
|
|
39
|
+
if not re.fullmatch(r'[0-9a-fA-F]{8}', word):
|
|
40
|
+
raise ValueError('unexpected entitlement section format')
|
|
41
|
+
raw.extend(bytes.fromhex(word)[::-1])
|
|
42
|
+
start, end = raw.find(b'<?xml'), raw.find(b'</plist>')
|
|
43
|
+
if start < 0 or end < 0:
|
|
44
|
+
raise ValueError('missing simulator entitlement plist')
|
|
45
|
+
entitlements = plistlib.loads(raw[start:end + len(b'</plist>')])
|
|
46
|
+
if entitlements.get('application-identifier') != group or entitlements.get('keychain-access-groups') != [group]:
|
|
47
|
+
raise ValueError('simulator entitlement identity mismatch')
|
|
48
|
+
if plistlib.loads((app / 'Expo.plist').read_bytes()).get('EXUpdatesEnabled') is not False:
|
|
49
|
+
raise ValueError('updates must be disabled')
|
|
50
|
+
bundle = (app / 'main.jsbundle').read_bytes()
|
|
51
|
+
# Hermes packs adjacent strings without delimiters. Use its string table,
|
|
52
|
+
# not raw substrings, so a longer port or path cannot satisfy the check.
|
|
53
|
+
dump = run(hermesc, '-b', '-dump-bytecode', str(app / 'main.jsbundle'))
|
|
54
|
+
strings = set(re.findall(r'^s\d+\[ASCII, \d+\.\.\d+\]: ([^\r\n]*)$', dump, re.MULTILINE))
|
|
55
|
+
if not all(url in strings for url in (backend, site)):
|
|
56
|
+
raise ValueError('embedded backend URLs missing')
|
|
57
|
+
expected = {'source_revision': run('git', '-C', str(source), 'rev-parse', 'HEAD').strip(),
|
|
58
|
+
'js_sha256': hashlib.sha256(bundle).hexdigest(), 'app_id': app_id,
|
|
59
|
+
'backend': backend, 'site': site, 'e2e': True, 'telemetry_disabled': True,
|
|
60
|
+
'updates_disabled': True, 'payments_disabled': True}
|
|
61
|
+
flags = ('e2e', 'telemetry_disabled', 'updates_disabled', 'payments_disabled')
|
|
62
|
+
if not isinstance(record, dict) or any(type(record.get(flag)) is not bool for flag in flags) or record != expected or not re.fullmatch(r'[0-9a-f]{40}', expected['source_revision']):
|
|
63
|
+
raise ValueError('build record does not match requested inputs and embedded JS')
|
|
64
|
+
return expected
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def main():
|
|
68
|
+
p = argparse.ArgumentParser(description=__doc__)
|
|
69
|
+
for arg in ('app', 'record', 'source', 'app-id', 'group', 'backend', 'site', 'hermesc'):
|
|
70
|
+
p.add_argument('--' + arg, required=True)
|
|
71
|
+
a = p.parse_args()
|
|
72
|
+
try:
|
|
73
|
+
result = inspect(Path(a.app), json.loads(Path(a.record).read_text()), Path(a.source), a.app_id, a.group, a.backend, a.site, a.hermesc)
|
|
74
|
+
print(json.dumps(result, indent=2))
|
|
75
|
+
except (ValueError, KeyError, OSError, subprocess.CalledProcessError) as e:
|
|
76
|
+
p.exit(1, f'preflight failed: {e}\n')
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == '__main__':
|
|
80
|
+
main()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
import plistlib
|
|
3
|
+
import tempfile
|
|
4
|
+
import unittest
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from unittest.mock import patch
|
|
7
|
+
import preflight
|
|
8
|
+
|
|
9
|
+
class TestPreflight(unittest.TestCase):
|
|
10
|
+
def test_sections_platform_identity_and_flags(self):
|
|
11
|
+
with tempfile.TemporaryDirectory() as directory:
|
|
12
|
+
p = Path(directory)
|
|
13
|
+
(p / 'Info.plist').write_bytes(plistlib.dumps({'CFBundleIdentifier': 'app.test.preview', 'CFBundleExecutable': 'App'}))
|
|
14
|
+
(p / 'Expo.plist').write_bytes(plistlib.dumps({'EXUpdatesEnabled': False}))
|
|
15
|
+
data = b'http://127.0.0.1:1000 http://127.0.0.1:1001'
|
|
16
|
+
(p / 'main.jsbundle').write_bytes(data)
|
|
17
|
+
record = dict(source_revision='a'*40, js_sha256=hashlib.sha256(data).hexdigest(), app_id='app.test.preview', backend='http://127.0.0.1:1000', site='http://127.0.0.1:1001', e2e=True, telemetry_disabled=True, updates_disabled=True, payments_disabled=True)
|
|
18
|
+
ent = plistlib.dumps({'application-identifier':'local.app.test.preview', 'keychain-access-groups':['local.app.test.preview']})
|
|
19
|
+
ent += b'\0' * (-len(ent) % 4)
|
|
20
|
+
section = '0000000100000000 ' + ' '.join(ent[i:i+4][::-1].hex() for i in range(0,len(ent),4))
|
|
21
|
+
def fake(*args):
|
|
22
|
+
if args[0] == 'git': return 'a'*40
|
|
23
|
+
if args[0] == 'xcrun': return 'platform IOSSIMULATOR'
|
|
24
|
+
if args[0] == 'hermesc': return '\n'.join(f's{i}[ASCII, 0..20]: {url}' for i, url in enumerate((p / 'main.jsbundle').read_text().split()))
|
|
25
|
+
return section if '-s' in args else 'sectname __entitlements\nsectname __ents_der'
|
|
26
|
+
args = (p, record, p, 'app.test.preview', 'local.app.test.preview', record['backend'], record['site'], 'hermesc')
|
|
27
|
+
with patch.object(preflight, 'run', fake):
|
|
28
|
+
preflight.inspect(*args)
|
|
29
|
+
with self.assertRaises(ValueError): preflight.inspect(*args[:4], 'local.wrong.app.test.preview', *args[5:])
|
|
30
|
+
with self.assertRaises(ValueError): preflight.inspect(*args[:5], 'http://example.com:1000', *args[6:])
|
|
31
|
+
record['e2e'] = False
|
|
32
|
+
with self.assertRaises(ValueError): preflight.inspect(*args)
|
|
33
|
+
record['e2e'] = True
|
|
34
|
+
for flag in ('e2e', 'telemetry_disabled', 'updates_disabled', 'payments_disabled'):
|
|
35
|
+
record[flag] = 1
|
|
36
|
+
with self.assertRaises(ValueError): preflight.inspect(*args)
|
|
37
|
+
record[flag] = True
|
|
38
|
+
for suffix in (b'0', b'/private', b'?secret=1'):
|
|
39
|
+
extended = data.replace(b':1000', b':1000' + suffix)
|
|
40
|
+
(p / 'main.jsbundle').write_bytes(extended)
|
|
41
|
+
record['js_sha256'] = hashlib.sha256(extended).hexdigest()
|
|
42
|
+
with self.assertRaises(ValueError): preflight.inspect(*args)
|
|
43
|
+
(p / 'main.jsbundle').write_bytes(data)
|
|
44
|
+
record['js_sha256'] = hashlib.sha256(data).hexdigest()
|
|
45
|
+
wrong_group = 'local.other.app.test.preview'
|
|
46
|
+
wrong_ent = plistlib.dumps({'application-identifier': wrong_group, 'keychain-access-groups': [wrong_group]})
|
|
47
|
+
wrong_ent += b'\0' * (-len(wrong_ent) % 4)
|
|
48
|
+
section = '0000000100000000 ' + ' '.join(wrong_ent[i:i+4][::-1].hex() for i in range(0,len(wrong_ent),4))
|
|
49
|
+
with self.assertRaises(ValueError): preflight.inspect(*args[:4], wrong_group, *args[5:])
|
|
50
|
+
for bad in ('missing', 'platform'):
|
|
51
|
+
def failure(*cmd):
|
|
52
|
+
if cmd[0] == 'xcrun': return 'platform IOS' if bad == 'platform' else 'platform IOSSIMULATOR'
|
|
53
|
+
if cmd[0] == 'otool' and '-l' in cmd: return ''
|
|
54
|
+
return fake(*cmd)
|
|
55
|
+
with patch.object(preflight, 'run', failure), self.assertRaises(ValueError): preflight.inspect(*args)
|
|
56
|
+
|
|
57
|
+
if __name__ == '__main__': unittest.main()
|