Flag allowInsecureProtocols not taken into account (Gradle 7.5.1)

Hello,
I am using Gradle 7.5.1 and I have the following repositories section in my build.gradle file (one section is inside the buildscript section, while the other one is at the same level with buildscript). The repositories are hosted by my company internally, and they are over http (NOT https), therefore I have used the allowInsecureProtocol flag:

buildscript {
    repositories {
        maven {
                url "<http url>"
                allowInsecureProtocol = true
        }
    }
}

repositories {
        maven {
                url "<http url>"
                allowInsecureProtocol = true
        }

I run ./buildew clean assemble and the build fails with the below error, related to the second repositories section. It’s as if the flag allowInsecureProtocol is completely ignored:

* What went wrong:
A problem occurred evaluating root project 'opensearch_security'.
> repository [maven] on project with path [:] is not using a secure protocol for artifacts on [<http url>]

If I remove the flag from the first repositories section, the error is different to the first one, so I guess that different mechanisms are used to check the flag for the 2 sections (and maybe this is where my issue comes from):

* What went wrong:
A problem occurred configuring root project 'opensearch_security'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(<http url>)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. 

Any ideas as to why the flag is not taken in the second repositories section and what I could do to finish my build succesfully?
Thanks.
Alex

Are you sure it is that repository it is complaining about?
Try adding a name to it, then you should see that name in the error if it is really about that repository iirc.

Hello,
Thanks for answering.
I modified the second section of repositories from my build.gradle file as follows:

repositories {
        maven {
                url "<http url>"
                allowInsecureProtocol = true
                name = 'mySecureRepository'
        }
}

You can see the error I get below. I references that exact repository:

* What went wrong:
A problem occurred evaluating root project 'opensearch_security'.
> repository [mySecureRepository] on project with path [:] is not using a secure protocol for artifacts on [<http url>]

Thanks

Then unfortunately all I can say is, that here it works fine with 7.5.1.
Can you maybe provide an MCVE?