Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

includeGroupByRegex with exclusiveContent can be easily misconfigured leading to poor security #21967

Closed
codefish1 opened this issue Sep 12, 2022 · 1 comment · Fixed by #23356
Labels
a:feature A new functionality in:repository-declarations declaring repositories and filtering
Milestone

Comments

@codefish1
Copy link
Contributor

Within your build.gradle.kts file you can define exclusive content such, to limit where dependencies may be pulled form. I quite often see people use the regex like in the example below, which works, but matches to a much wider set of groups than they expect.

repositories {
  exclusiveContent {
    forRepository { maven("https://....") }
    filter {
      includeGroupByRegex("com.google.*")      
    }
  }

In this instance the regex should be something like

includeGroupByRegex("com\\.google(?:\..+|\Z)")

which will pull anything in com.goggle:foo and com.google.bar:foo

Expected Behavior

Add a new option for including, prehaps includeGroupByPrefix which automatically adds the regex for you correctly so you can just do

includeGroupByPrefix("com.google")

Current Behavior

Context

@codefish1 codefish1 added a:feature A new functionality to-triage labels Sep 12, 2022
@jbartok jbartok added in:repository-declarations declaring repositories and filtering @support and removed to-triage labels Sep 12, 2022
@yogurtearl
Copy link
Contributor

includeGroupByRegex("com.google.*")

will also match things like com_google.foo and com.googleandroid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:repository-declarations declaring repositories and filtering
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants