Skip to content

Commit 20f2ddd

Browse files
committed
fix: replace Math.random() with secure RNG in analytics filters
1 parent e24f17b commit 20f2ddd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/components/JobCCDashboard/JobAnalytics/JobAnalytics.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ function JobAnalytics({ darkMode, role, hasPermission: hasPerm }) {
501501
if (!analyticsData?.deviceBreakdown) return [];
502502
const multiplier =
503503
selectedRole === 'All Roles' ? 1 : 1 + ROLE_OPTIONS.indexOf(selectedRole) * 0.05;
504-
const dateFactor = dateRange ? 1 + Math.random() * 0.1 : 1;
504+
const dateFactor = dateRange ? 1 + AnalyticsService.secureRandom(0, 10) / 100 : 1;
505505

506506
return analyticsData.deviceBreakdown.map(d => ({
507507
...d,
@@ -515,7 +515,7 @@ function JobAnalytics({ darkMode, role, hasPermission: hasPerm }) {
515515
if (!analyticsData?.trafficSources) return [];
516516
const multiplier =
517517
selectedRole === 'All Roles' ? 1 : 1 + ROLE_OPTIONS.indexOf(selectedRole) * 0.05;
518-
const dateFactor = dateRange ? 1 + Math.random() * 0.1 : 1;
518+
const dateFactor = dateRange ? 1 + AnalyticsService.secureRandom(0, 10) / 100 : 1;
519519

520520
return analyticsData.trafficSources.map(t => ({
521521
...t,

0 commit comments

Comments
 (0)