Skip to content

Potential fix for code scanning alert no. 4240: Semicolon insertion#2725

Open
MSNev wants to merge 3 commits intomainfrom
alert-autofix-4240
Open

Potential fix for code scanning alert no. 4240: Semicolon insertion#2725
MSNev wants to merge 3 commits intomainfrom
alert-autofix-4240

Conversation

@MSNev
Copy link
Copy Markdown
Collaborator

@MSNev MSNev commented Apr 21, 2026

Potential fix for https://github.com/microsoft/ApplicationInsights-JS/security/code-scanning/4240

Add an explicit semicolon after the onComplete arrow-function assignment in _doSend in channels/applicationinsights-channel-js/src/Sender.ts.

  • General fix: when assigning function expressions/arrow functions to variables, terminate the assignment with ; explicitly rather than relying on ASI.
  • Specific fix: change line 1017 from } to }; in the _doSend(...) function.
  • No imports, new methods, or new definitions are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Collaborator Author

@MSNev MSNev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MSNev
Copy link
Copy Markdown
Collaborator Author

MSNev commented May 4, 2026

@copilot rebase

* Initial plan

* Drop Node 16 from CI matrix, add Node 22 and 24; update RELEASES.md

Agent-Logs-Url: https://github.com/microsoft/ApplicationInsights-JS/sessions/496718a3-d402-48f7-9625-67f74b12449e

Co-authored-by: MSNev <54870357+MSNev@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MSNev <54870357+MSNev@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

@copilot rebase

Rebased onto the latest main (commit 09fe57c).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot finished work on behalf of MSNev May 4, 2026 17:26
Copy link
Copy Markdown
Collaborator Author

@MSNev MSNev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MSNev MSNev marked this pull request as ready for review May 4, 2026 18:31
@MSNev MSNev requested a review from a team as a code owner May 4, 2026 18:31
Copilot AI review requested due to automatic review settings May 4, 2026 18:31
@MSNev MSNev enabled auto-merge (squash) May 4, 2026 18:31
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR addresses a code scanning alert related to Automatic Semicolon Insertion (ASI) by adding explicit semicolons after arrow-function assignments, and also updates CI Node.js versions along with corresponding release notes.

Changes:

  • Add explicit semicolons after arrow-function assignments in Sender.ts and DiagnosticLogger.ts.
  • Update CI Node.js matrix to drop 16 and add 22/24.
  • Add “Unreleased Changes” release notes documenting the CI Node.js version changes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
shared/AppInsightsCore/src/diagnostics/DiagnosticLogger.ts Adds an explicit semicolon to avoid ASI edge cases after an arrow-function assignment.
channels/applicationinsights-channel-js/src/Sender.ts Adds an explicit semicolon after the onComplete arrow-function assignment to address ASI/security scan concerns.
RELEASES.md Adds an “Unreleased Changes” section documenting CI Node.js matrix changes.
.github/workflows/ci.yml Updates CI test matrix to Node 18/20/22/24 and removes Node 16.

Comment thread RELEASES.md
Comment on lines +5 to +10
## Unreleased Changes

### CI / Tooling

- **Dropped Node.js 16 from CI matrix**: Node.js 16 is End-of-Life and several dependencies (e.g. `puppeteer`, `@pnpm/error`) now require Node.js 18 or later. The CI pipeline no longer runs against Node.js 16.
- **Added Node.js 22 and 24 to CI matrix**: The CI pipeline now tests against Node.js 18, 20, 22, and 24.
Comment thread .github/workflows/ci.yml
strategy:
matrix:
node-version: [ 16, 18, 20 ]
node-version: [ 18, 20, 22, 24 ]
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.

3 participants