Skip to content

Conversation

@vhuseinova-msft
Copy link
Contributor

Description

  • Added routes for SSR test app for better testing
  • Enabled SSR certs generation for testing the pages in the Orange app.
  • Updated teams-js interfaces

Validation

Validation performed:

Local testing, UI tests

Unit Tests added:

No new functionality for teams-js

Additional Requirements

Change file added:

Yes

@vhuseinova-msft vhuseinova-msft requested a review from a team as a code owner January 15, 2026 00:18
// Generate certificates
console.log('🔐 Generating certificates...');
execSync(
`mkcert -key-file ${path.join(certDir, 'localhost-key.pem')} -cert-file ${path.join(certDir, 'localhost.pem')} localhost 127.0.0.1`,

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
absolute path
.

Copilot Autofix

AI about 3 hours ago

In general, to fix this kind of problem you should avoid passing a single shell command string to APIs that invoke a shell (exec, execSync) when that string contains dynamic data. Instead, call the binary directly and pass dynamic values as separate arguments using execFile/execFileSync (or spawn/spawnSync), which bypass shell parsing.

Here, we can keep using mkcert but switch the certificate generation call on lines 31–34 from execSync(<string>, ...) to execFileSync('mkcert', [<args>], ...). The arguments will include -key-file, the key path, -cert-file, the cert path, and the hostnames. This preserves existing functionality (same mkcert options, same stdio behavior) while eliminating shell interpretation of certDir and the joined paths.

Concretely in tools/cli/setupSSRCerts.js:

  • Change the import on line 2 from const { execSync } = require('child_process'); to import both execSync and execFileSync, since we still need execSync for the simple literal commands (mkcert -version, mkcert -install) and will use execFileSync for the dynamic-argument call.
  • Replace the execSync(...template literal...)block starting at line 31 with anexecFileSync('mkcert', [ ... ], { stdio: 'inherit' })call, building the two file paths viapath.join(certDir, ...)` as now, but keeping them as plain string arguments instead of embedded in a shell command.

No other methods or dependencies are required beyond adding execFileSync to the existing child_process destructuring.

Suggested changeset 1
tools/cli/setupSSRCerts.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tools/cli/setupSSRCerts.js b/tools/cli/setupSSRCerts.js
--- a/tools/cli/setupSSRCerts.js
+++ b/tools/cli/setupSSRCerts.js
@@ -1,5 +1,5 @@
 /* eslint-disable */
-const { execSync } = require('child_process');
+const { execSync, execFileSync } = require('child_process');
 const fs = require('fs');
 const path = require('path');
 
@@ -28,8 +28,16 @@
 
 // Generate certificates
 console.log('🔐 Generating certificates...');
-execSync(
-  `mkcert -key-file ${path.join(certDir, 'localhost-key.pem')} -cert-file ${path.join(certDir, 'localhost.pem')} localhost 127.0.0.1`,
+execFileSync(
+  'mkcert',
+  [
+    '-key-file',
+    path.join(certDir, 'localhost-key.pem'),
+    '-cert-file',
+    path.join(certDir, 'localhost.pem'),
+    'localhost',
+    '127.0.0.1',
+  ],
   { stdio: 'inherit' },
 );
 
EOF
@@ -1,5 +1,5 @@
/* eslint-disable */
const { execSync } = require('child_process');
const { execSync, execFileSync } = require('child_process');
const fs = require('fs');
const path = require('path');

@@ -28,8 +28,16 @@

// Generate certificates
console.log('🔐 Generating certificates...');
execSync(
`mkcert -key-file ${path.join(certDir, 'localhost-key.pem')} -cert-file ${path.join(certDir, 'localhost.pem')} localhost 127.0.0.1`,
execFileSync(
'mkcert',
[
'-key-file',
path.join(certDir, 'localhost-key.pem'),
'-cert-file',
path.join(certDir, 'localhost.pem'),
'localhost',
'127.0.0.1',
],
{ stdio: 'inherit' },
);

Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/teams-js/dist/esm/packages/teams-js/src/index.js 200.58 KB (+0.03% 🔺) 4.1 s (+0.03% 🔺) 212 ms (+5.4% 🔺) 4.3 s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants