Skip to content

Commit 359290e

Browse files
committed
Replace Math.random() in CDS extractor
Addresses a code scanning alert related to the recent introduction of the `Math.random()` function when creating a session ID for CDS extractor logging. Replaces `Math.random()` with `Data.now()` in an effort to remove any perception that the "session ID" is in any way used in a "security context".
1 parent 1c5d011 commit 359290e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

extractors/cds/tools/src/logging/cdsExtractorLog.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ let sourceRootDirectory: string | undefined;
1010
/**
1111
* Unique session ID for this CDS extractor run to help distinguish
1212
* between multiple concurrent or sequential runs in logs.
13+
* Uses the extractor start timestamp for uniqueness.
1314
*/
14-
const sessionId = Math.random().toString(36).substring(2, 8);
15+
const sessionId = Date.now().toString();
1516

1617
/**
1718
* Start time of the CDS extractor session for performance tracking.

0 commit comments

Comments
 (0)