Skip to content

Conversation

blessing-sanusi
Copy link
Collaborator

Purpose

  • ...

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

Thanusree-Microsoft and others added 10 commits July 15, 2025 17:21
docs: Update CustomizingAzdParameters.md
fix: Merge the telemetry issue changes from dev to main
fix: added current step action and function with history to execute correct task when approving parallelly
…ndard

chore: migrate model type to global standard
fix: add principalType as 'ServicePrincipal' for role assignments
fix: Prefix/Suffix fixes - dev to main
static async createPlan(
description: string
): Promise<{ plan_id: string; status: string; session_id: string }> {
const sessionId = this.generateSessionId();

Check failure

Code scanning / CodeQL

Insecure randomness High

This uses a cryptographically insecure random number generated at
Math.random()
in a security context.

Copilot Autofix

AI 3 months ago

To fix the problem, replace the use of Math.random() in the generateSessionId method with a cryptographically secure random number generator. In the browser, the recommended approach is to use window.crypto.getRandomValues. This can be used to generate a random 32-bit integer, which can then be used in place of the insecure random value. The fix should only affect the generateSessionId method in src/frontend/src/services/TaskService.tsx. No changes to the method's interface or usage are required. No new dependencies are needed, as window.crypto is available in all modern browsers.


Suggested changeset 1
src/frontend/src/services/TaskService.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/frontend/src/services/TaskService.tsx b/src/frontend/src/services/TaskService.tsx
--- a/src/frontend/src/services/TaskService.tsx
+++ b/src/frontend/src/services/TaskService.tsx
@@ -103,3 +103,6 @@
     const timestamp = new Date().getTime();
-    const random = Math.floor(Math.random() * 10000);
+    // Use cryptographically secure random number
+    const array = new Uint32Array(1);
+    window.crypto.getRandomValues(array);
+    const random = array[0] % 10000;
     return `sid_${timestamp}_${random}`;
EOF
@@ -103,3 +103,6 @@
const timestamp = new Date().getTime();
const random = Math.floor(Math.random() * 10000);
// Use cryptographically secure random number
const array = new Uint32Array(1);
window.crypto.getRandomValues(array);
const random = array[0] % 10000;
return `sid_${timestamp}_${random}`;
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@Fr4nc3 Fr4nc3 changed the base branch from main to macae-v3-dev July 31, 2025 13:54
@Fr4nc3 Fr4nc3 merged commit 58fc2e0 into macae-v3-dev Aug 4, 2025
1 of 4 checks passed
@Fr4nc3 Fr4nc3 deleted the macae-plan-api branch August 14, 2025 15:32
@github-actions
Copy link

🎉 This PR is included in version 2.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants