Skip to content

Commit c368620

Browse files
committed
Don't use the token to generate a unique id
1 parent 7b84952 commit c368620

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

dist/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2725,7 +2725,8 @@ function sha256(message) {
27252725
return hash.digest('hex');
27262726
}
27272727
const getStateInstance = (options) => {
2728-
const cacheKey = sha256(JSON.stringify(options));
2728+
const json = JSON.stringify(options, (key, value) => key === 'repoToken' ? undefined : value);
2729+
const cacheKey = sha256(json);
27292730
const storage = new state_cache_storage_1.StateCacheStorage(cacheKey);
27302731
return new state_1.State(storage, options);
27312732
};

src/services/state.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ function sha256(message: string): string {
1111
}
1212

1313
export const getStateInstance = (options: IIssuesProcessorOptions): IState => {
14-
const cacheKey = sha256(JSON.stringify(options));
14+
const json = JSON.stringify(options, (key, value) =>
15+
key === 'repoToken' ? undefined : value
16+
);
17+
const cacheKey = sha256(json);
1518
const storage = new StateCacheStorage(cacheKey);
1619
return new State(storage, options);
1720
};

0 commit comments

Comments
 (0)