-
Notifications
You must be signed in to change notification settings - Fork 3.1k
test(e2e): restore messaging bash parity #5806
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
Changes from all commits
5078ec5
09a6cec
bc59e1e
8fdb454
f6a00eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -267,6 +267,26 @@ process.exit(Array.isArray(channels) && channels.some((c) => c?.channelId === "w | |||||||||||||
| ); | ||||||||||||||
| expectExitZero(whatsappRebuild, "M-WA4: rebuild completed after WhatsApp channel add"); | ||||||||||||||
|
|
||||||||||||||
| const whatsappPolicyPost = await runHost( | ||||||||||||||
| host, | ||||||||||||||
| "openshell", | ||||||||||||||
| ["policy", "get", "--full", SANDBOX_NAME], | ||||||||||||||
| { | ||||||||||||||
| artifactName: "whatsapp-policy-post-rebuild-messaging-providers", | ||||||||||||||
| env: state.env, | ||||||||||||||
| redactionValues, | ||||||||||||||
| timeoutMs: 60_000, | ||||||||||||||
| }, | ||||||||||||||
| ); | ||||||||||||||
| const whatsappPolicyPostText = outputText(whatsappPolicyPost); | ||||||||||||||
| check( | ||||||||||||||
| policyTextHasHost(whatsappPolicyPostText, "web.whatsapp.com") && | ||||||||||||||
| policyTextHasHost(whatsappPolicyPostText, "whatsapp.net") && | ||||||||||||||
| policyTextHasHost(whatsappPolicyPostText, "raw.githubusercontent.com") && | ||||||||||||||
| /\/usr\/local\/bin\/node|\/usr\/bin\/node/.test(whatsappPolicyPostText), | ||||||||||||||
| "M-WA5: WhatsApp policy preset survived rebuild with Node binary scope", | ||||||||||||||
| ); | ||||||||||||||
|
|
||||||||||||||
| const providerList = await runHost(host, "openshell", ["provider", "list"], { | ||||||||||||||
| artifactName: "provider-list-messaging-providers", | ||||||||||||||
| env: state.env, | ||||||||||||||
|
|
@@ -882,10 +902,15 @@ req.setTimeout(30000, () => { req.destroy(); console.log("TIMEOUT"); }); | |||||||||||||
| fakeGateway.captureFile, | ||||||||||||||
| (row) => row.event === "identify", | ||||||||||||||
| ); | ||||||||||||||
| check(fs.existsSync(fakeGateway.captureFile), "M13f: fake Gateway capture file exists"); | ||||||||||||||
| const gatewayCaptureText = fs.readFileSync(fakeGateway.captureFile, "utf8"); | ||||||||||||||
|
Comment on lines
+905
to
+906
Contributor
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. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Guard the file read with a hard precondition.
Suggested fix- check(fs.existsSync(fakeGateway.captureFile), "M13f: fake Gateway capture file exists");
- const gatewayCaptureText = fs.readFileSync(fakeGateway.captureFile, "utf8");
+ if (!fs.existsSync(fakeGateway.captureFile)) {
+ throw new Error("M13f: fake Gateway capture file exists");
+ }
+ const gatewayCaptureText = fs.readFileSync(fakeGateway.captureFile, "utf8");📝 Committable suggestion
Suggested change
🧰 Tools🪛 ast-grep (0.44.0)[warning] 905-905: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use. (detect-non-literal-fs-filename-typescript) 🤖 Prompt for AI Agents |
||||||||||||||
| check( | ||||||||||||||
| gatewayIdentify?.tokenMatchesExpected === true && | ||||||||||||||
| gatewayIdentify?.tokenLooksPlaceholder === false, | ||||||||||||||
| "M13f: fake Gateway received host-side Discord token after relay rewrite", | ||||||||||||||
| gatewayIdentify?.tokenLooksPlaceholder === false && | ||||||||||||||
| !Object.prototype.hasOwnProperty.call(gatewayIdentify, "token") && | ||||||||||||||
| !gatewayCaptureText.includes(state.tokens.discord) && | ||||||||||||||
| !gatewayCaptureText.includes("openshell:resolve:env:"), | ||||||||||||||
| "M13f: fake Gateway proved placeholder-to-token rewrite without logging the raw token", | ||||||||||||||
| ); | ||||||||||||||
|
|
||||||||||||||
| const gatewayPort = await sandboxOutput( | ||||||||||||||
|
|
||||||||||||||
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.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add the required SPDX header to this file.
This changed
.test.tsfile is missing the repository-mandated SPDX copyright and license header.Suggested header
As per coding guidelines,
**/*.{js,ts,tsx,sh}must include the SPDX copyright and Apache-2.0 license header.📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Coding guidelines