Skip to content

Potential fix for code scanning alert no. 55: Assignment to constant#60

Merged
vectorMindAI merged 1 commit intomainfrom
alert-autofix-55
Feb 12, 2026
Merged

Potential fix for code scanning alert no. 55: Assignment to constant#60
vectorMindAI merged 1 commit intomainfrom
alert-autofix-55

Conversation

@vanshaj2023
Copy link
Member

Potential fix for https://github.com/vectorMindsAI/vectorMindsAI-v0/security/code-scanning/55

In general, to fix “assignment to constant” issues, you either (1) stop reassigning the constant and rely on the original value, or (2) change the declaration from const to a reassignable binding such as let—but only if the design truly requires mutation. Here, the currentData value is read once from req.json() and used to construct enrichedData; there is no need to re-read or reassign it. The second destructuring on line 10 is redundant and invalid as written (missing const/let/var and trying to reassign a const).

The best minimal fix that preserves existing behavior is to remove the duplicate const { currentData } = await req.json() line entirely and keep the original destructuring const { city, currentData } = await req.json(). This way, currentData is read once, remains a constant, and is then used later when building enrichedData. No imports, additional methods, or other definitions are needed; only the single spurious assignment line should be deleted in app/api/enrich/route.ts.

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>
@vanshaj2023 vanshaj2023 marked this pull request as ready for review February 12, 2026 19:51
@vectorMindAI vectorMindAI merged commit ee313bf into main Feb 12, 2026
4 of 16 checks passed
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