Skip to content

Commit b442537

Browse files
committed
Limit OverlayAnalysis to internal repos
1 parent 93e8729 commit b442537

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/config-utils.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ const calculateAugmentationMacro = test.macro({
815815
const actualAugmentationProperties =
816816
await configUtils.calculateAugmentation(
817817
getCachedCodeQL(),
818+
{ owner: "github", repo: "repo" },
818819
createFeatures([]),
819820
rawPacksInput,
820821
rawQueriesInput,
@@ -946,6 +947,7 @@ const calculateAugmentationErrorMacro = test.macro({
946947
() =>
947948
configUtils.calculateAugmentation(
948949
getCachedCodeQL(),
950+
{ owner: "github", repo: "repo" },
949951
createFeatures([]),
950952
rawPacksInput,
951953
rawQueriesInput,

src/config-utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ export async function getDefaultConfig({
494494

495495
const augmentationProperties = await calculateAugmentation(
496496
codeql,
497+
repository,
497498
features,
498499
packsInput,
499500
queriesInput,
@@ -608,6 +609,7 @@ async function loadConfig({
608609

609610
const augmentationProperties = await calculateAugmentation(
610611
codeql,
612+
repository,
611613
features,
612614
packsInput,
613615
queriesInput,
@@ -651,6 +653,7 @@ async function loadConfig({
651653
* the config file sent to the CLI.
652654
*
653655
* @param codeql The CodeQL object.
656+
* @param repository The repository to analyze.
654657
* @param features The feature enablement object.
655658
* @param rawPacksInput The packs input from the action configuration.
656659
* @param rawQueriesInput The queries input from the action configuration.
@@ -669,6 +672,7 @@ async function loadConfig({
669672
// exported for testing.
670673
export async function calculateAugmentation(
671674
codeql: CodeQL,
675+
repository: RepositoryNwo,
672676
features: FeatureEnablement,
673677
rawPacksInput: string | undefined,
674678
rawQueriesInput: string | undefined,
@@ -691,6 +695,7 @@ export async function calculateAugmentation(
691695
);
692696
const overlayDatabaseMode = await getOverlayDatabaseMode(
693697
codeql,
698+
repository,
694699
features,
695700
languages,
696701
sourceRoot,
@@ -760,6 +765,7 @@ function parseQueriesFromInput(
760765
*/
761766
async function getOverlayDatabaseMode(
762767
codeql: CodeQL,
768+
repository: RepositoryNwo,
763769
features: FeatureEnablement,
764770
languages: Language[],
765771
sourceRoot: string,
@@ -781,7 +787,12 @@ async function getOverlayDatabaseMode(
781787
`Setting overlay database mode to ${overlayDatabaseMode} ` +
782788
"from the CODEQL_OVERLAY_DATABASE_MODE environment variable.",
783789
);
784-
} else if (await features.getValue(Feature.OverlayAnalysis, codeql)) {
790+
} else if (
791+
// TODO: Remove the repository owner check once support for overlay analysis
792+
// stabilizes, and no more backward-incompatible changes are expected.
793+
["github", "dsp-testing"].includes(repository.owner) &&
794+
(await features.getValue(Feature.OverlayAnalysis, codeql))
795+
) {
785796
if (isAnalyzingPullRequest()) {
786797
overlayDatabaseMode = OverlayDatabaseMode.Overlay;
787798
logger.info(

0 commit comments

Comments
 (0)