Skip to content

Commit

Permalink
feat(osv): pass GitHub token for DB download (#26808)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
  • Loading branch information
jporzucek and viceice authored Jan 26, 2024
1 parent 38becc0 commit 16c7b94
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/workers/repository/process/vulnerabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
VersioningApi,
get as getVersioning,
} from '../../../modules/versioning';
import { find } from '../../../util/host-rules';
import { sanitizeMarkdown } from '../../../util/markdown';
import * as p from '../../../util/promises';
import { regEx } from '../../../util/regex';
Expand Down Expand Up @@ -46,7 +47,13 @@ export class Vulnerabilities {
private constructor() {}

private async initialize(): Promise<void> {
this.osvOffline = await OsvOffline.create();
// hard-coded logic to use authentication for github.com based on the githubToken for api.github.com
const gitHubHostRule = find({
hostType: 'github',
url: 'https://api.github.com/',
});

this.osvOffline = await OsvOffline.create(gitHubHostRule?.token);
}

static async create(): Promise<Vulnerabilities> {
Expand Down

0 comments on commit 16c7b94

Please sign in to comment.