Skip to content

Commit 7baf700

Browse files
authored
Security fixes (#3351)
1 parent e710e9b commit 7baf700

File tree

5 files changed

+259
-367
lines changed

5 files changed

+259
-367
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
"@types/jest": "30.0.0",
142142
"@types/markdown-it": "14.1.2",
143143
"@types/mjml": "4.7.4",
144-
"@types/node": "24.10.4",
144+
"@types/node": "25.0.3",
145145
"@types/react": "19.2.7",
146146
"@types/react-copy-to-clipboard": "5.0.7",
147147
"@types/react-dom": "19.2.3",

src/scripts/canvas.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as d3 from 'd3';
22

3-
import { random } from '@scripts/shared';
4-
53
export type Dots = d3.Selection<SVGCircleElement, any, SVGSVGElement, any>;
64
export type Canvas = d3.Selection<SVGSVGElement, unknown, HTMLElement, any>;
75

@@ -15,7 +13,7 @@ type Data = {
1513

1614
let circleIndex = 0;
1715

18-
const rand = (modifier: number): number => random() * modifier;
16+
const rand = (modifier: number): number => Math.random() * modifier;
1917
const eventType: string = 'ontouchstart' in document ? 'touchmove' : 'mousemove';
2018
const dispatcher: d3.Dispatch<EventTarget> = d3.dispatch('remove-circle');
2119
const { innerHeight, innerWidth } = window;

src/scripts/music.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Power4, TweenMax } from 'gsap';
22
import { createNoise2D } from 'simplex-noise';
33

4-
import { onThemeChange, random } from './shared';
4+
import { onThemeChange } from './shared';
55

66
let src: MediaElementAudioSourceNode;
77

@@ -121,8 +121,8 @@ export const music = (container: HTMLDivElement): MusicFunctions => {
121121
constructor(index: number) {
122122
this.index = index;
123123

124-
this.xR = random();
125-
this.yR = random();
124+
this.xR = Math.random();
125+
this.yR = Math.random();
126126

127127
this.i = 0;
128128
this.value = 0;

src/scripts/shared.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ export type PaginationData<T> = {
1414
menu: Project[] | undefined;
1515
};
1616

17-
export const random = (): number => {
18-
const crypto = window.crypto;
19-
const array = new Uint32Array(1);
20-
21-
return crypto.getRandomValues(array)[0] / (Math.pow(2, 32) - 1);
22-
};
23-
2417
export const formatDate = (date: number | string, formatter = 'dd MMM yyyy'): string => {
2518
if (!date) {
2619
return '';

0 commit comments

Comments
 (0)