Use externalRepoAuth when getting a remote config

This allows users to specify a different token for retrieving the
codeql config from a different repository.

Fixes https://github.com/github/advanced-security-field/issues/185
This commit is contained in:
Andrew Eisenberg 2021-04-09 14:17:46 -07:00 committed by Andrew Eisenberg
parent 7f9fb10a74
commit 534192fa05
9 changed files with 194 additions and 19 deletions

6
lib/config-utils.js generated
View file

@ -304,7 +304,7 @@ exports.getUnknownLanguagesError = getUnknownLanguagesError;
async function getLanguagesInRepo(repository, apiDetails, logger) {
logger.debug(`GitHub repo ${repository.owner} ${repository.repo}`);
const response = await api
.getApiClient(apiDetails, true)
.getApiClient(apiDetails, { allowLocalRun: true })
.repos.listLanguages({
owner: repository.owner,
repo: repository.repo,
@ -556,7 +556,9 @@ async function getRemoteConfig(configFile, apiDetails) {
if (pieces === null || pieces.groups === undefined || pieces.length < 5) {
throw new Error(getConfigFileRepoFormatInvalidMessage(configFile));
}
const response = await api.getApiClient(apiDetails, true).repos.getContent({
const response = await api
.getApiClient(apiDetails, { allowLocalRun: true, allowExternal: true })
.repos.getContent({
owner: pieces.groups.owner,
repo: pieces.groups.repo,
path: pieces.groups.path,