From c368620c4352fb9517b2860592b3413fb9101f04 Mon Sep 17 00:00:00 2001 From: autoantwort Date: Tue, 8 Oct 2024 01:18:09 +0200 Subject: [PATCH] Don't use the token to generate a unique id --- dist/index.js | 3 ++- src/services/state.service.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 0f2df108f..912b7fe9e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2725,7 +2725,8 @@ function sha256(message) { return hash.digest('hex'); } const getStateInstance = (options) => { - const cacheKey = sha256(JSON.stringify(options)); + const json = JSON.stringify(options, (key, value) => key === 'repoToken' ? undefined : value); + const cacheKey = sha256(json); const storage = new state_cache_storage_1.StateCacheStorage(cacheKey); return new state_1.State(storage, options); }; diff --git a/src/services/state.service.ts b/src/services/state.service.ts index 31ef93709..25719dadc 100644 --- a/src/services/state.service.ts +++ b/src/services/state.service.ts @@ -11,7 +11,10 @@ function sha256(message: string): string { } export const getStateInstance = (options: IIssuesProcessorOptions): IState => { - const cacheKey = sha256(JSON.stringify(options)); + const json = JSON.stringify(options, (key, value) => + key === 'repoToken' ? undefined : value + ); + const cacheKey = sha256(json); const storage = new StateCacheStorage(cacheKey); return new State(storage, options); };