Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/codeql-queries/cli-project-evaluator-settings.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import java

from MethodCall mc, Field f, Method m
where
// find all calls to Project.getEvaluatorSettings in CliCommand
mc.getCompilationUnit().getFile().getBaseName() = "CliCommand.kt" and
mc.getMethod().getName() = "getEvaluatorSettings" and
mc.getMethod().getDeclaringType().getName() = "Project" and

// find CliCommand.evaluatorSettings field delegate
f.getFile().getBaseName() = "CliCommand.kt" and
f.getName() = "evaluatorSettings$delegate" and

// exclude the allowed call in CliCommand.evaluatorSettings
m = f.getInitializer().(MethodCall).getArgument(0).(LambdaExpr).getAnonymousClass().getAMember() and
m != mc.getCaller()
select mc, "CliCommand must access project evaluator settings via this.evaluatorSettings, not via this.project"
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) {
}

protected val externalProperties: Map<String, String> by lazy {
cliOptions.externalProperties ?: evaluatorSettings?.externalProperties ?: emptyMap()
cliOptions.externalProperties ?: project?.evaluatorSettings?.externalProperties ?: emptyMap()
}

protected val moduleCacheDir: Path? by lazy {
Expand Down
Loading