Visitar URL original
Dependency submission graph updates · Issue #410 · gradle/actions · GitHub
Skip to content

Dependency submission graph updates #410

Open

Description

@pexa-slee

Hi all,

I was updating a spring dependency recently to resolve a CVE. The dependency submission action ran on main. Now when I look at the dependency graph, I see two versions of the same dependency. The alert was raised correctly on the old version of Spring MVC. But now it is resolved, I was expecting that the graph would be overridden with the new version and the dependabot alert would automatically close.

The version of the action we are using is v4 gradle/actions/dependency-submission@v4

Screenshot 2024-10-02 at 2 24 55 PM

Or is this the assumed behaviour?

Regards,

Activity

  1. bigdaz commented on Oct 2, 2024

    @bigdaz
    Member

    The most likely explanation is that you have 2 different versions of the dependency in your dependency graph.

  2. pexa-slee commented on Oct 3, 2024

    @pexa-slee
    Author

    The most likely explanation is that you have 2 different versions of the dependency in your dependency graph.

    Good point. Let me confirm by running the list of dependencies and see what are the transitives.

  3. pexa-slee commented on Oct 3, 2024

    @pexa-slee
    Author

    I can confirm the repo in question is on 6.1.13

    ./gradlew -q dependencies > dependencies.txt

    ❯ cat dependencies.txt | grep spring-webmvc
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    |    \--- org.springframework:spring-webmvc:6.1.13
    |    |    \--- org.springframework:spring-webmvc:5.3.31 -> 6.1.13 (*)
    
  4. bigdaz commented on Oct 6, 2024

    @bigdaz
    Member

    Please read the FAQ linked above. In particular you'll need to follow the instructions in the linked HOW-TO.

    Running gradle dependencies is not sufficient to determine all of the dependency versions in your project.

  5. pexa-slee commented on Oct 9, 2024

    @pexa-slee
    Author

    I'm going down a bit of a rabbit hole here...

    So I enabled debug logging for the task running off the main branch as stated here

    I see in the logs references to org.springframework:spring-webmvc:6.1.11

    Examples:

    Detected dependency 'org.springframework:spring-webmvc:6.1.11': project = ':', configuration = 'compileClasspath'
    Detected dependency 'org.springframework:spring-webmvc:6.1.11': project = ':', configuration = 'implementationDependenciesMetadata'
    Detected dependency 'org.springframework:spring-webmvc:6.1.11': project = ':', configuration = 'productionRuntimeClasspath'
    
    

    Now, locally I have run the recommended cmds to see if this dep does exist

    Examples

     ./gradlew dependencyInsight --configuration  productionRuntimeClasspath --dependency org.springframework:spring-webmvc:6.1.11
     ./gradlew dependencyInsight --configuration  compileClasspath  --dependency org.springframework:spring-webmvc:6.1.11
     ./gradlew dependencyInsight --configuration  intTestCompileClasspath  --dependency org.springframework:spring-webmvc:6.1.11
     ./gradlew dependencyInsight --configuration  runtimeClasspath  --dependency org.springframework:spring-webmvc:6.1.11
     ./gradlew dependencyInsight --configuration  implementationDependenciesMetadata  --dependency org.springframework:spring-webmvc:6.1.11
    
    

    I get no results back

    Example response:

    > Task :dependencyInsight
    No dependencies matching given input were found in configuration ':compileClasspath'
    
    

    Now if I run with version 6.1.13, I can see that it does exist:

    ./gradlew dependencyInsight --configuration  compileClasspath  --dependency org.springframework:spring-webmvc:6.1.13                  
    
    > Task :dependencyInsight
    org.springframework:spring-webmvc:6.1.13 (selected by rule)
      Variant apiElements:
        | Attribute Name                     | Provided     | Requested    |
        |------------------------------------|--------------|--------------|
        | org.gradle.status                  | release      |              |
        | org.gradle.category                | library      | library      |
        | org.gradle.dependency.bundling     | external     | external     |
        | org.gradle.jvm.environment         | standard-jvm | standard-jvm |
        | org.gradle.jvm.version             | 17           | 21           |
        | org.gradle.libraryelements         | jar          | classes      |
        | org.gradle.usage                   | java-api     | java-api     |
        | org.jetbrains.kotlin.platform.type | jvm          | jvm          |
    
    org.springframework:spring-webmvc:6.1.13
    \--- org.springframework.boot:spring-boot-starter-web:3.3.4
         \--- compileClasspath (requested org.springframework.boot:spring-boot-starter-web)
    
    org.springframework:spring-webmvc:5.3.31 -> 6.1.13
    \--- org.springdoc:springdoc-openapi-webmvc-core:1.8.0
         \--- org.springdoc:springdoc-openapi-ui:1.8.0
              \--- compileClasspath
    
    
  6. bigdaz commented on Oct 10, 2024

    @bigdaz
    Member

    That's very strange: I don't really understand how both versions can be resolved in the compileClasspath configuration for the same project.

    The best and simplest way to track down this dependency would be to generate a Build Scan. This will quickly point to the cause of a dependency being resolved. If you can share a Build Scan link, then I can investigate further. There might be a bug in the dependency-graph plugin, but I'd need a way to reproduce it.

    If you can't generate a Build Scan, then you might want to try running the buildEnvironment task as described here to see if it reveals anything.

  7. pexa-slee commented on Oct 14, 2024

    @pexa-slee
    Author

    Screenshot 2024-10-14 at 11 40 26 AM
    Screenshot 2024-10-14 at 11 40 43 AM

    here are the results of the scan

  8. pexa-slee commented on Oct 27, 2024

    @pexa-slee
    Author

    Hi @bigdaz , have you had a chance to look at my previous comment yet?

  9. bigdaz commented on Oct 31, 2024

    @bigdaz
    Member

    Sorry, just back from vacations.
    Thanks for the build-scan screenshots. They clearly demonstrate that there's a disconnect between what's being reported in the scans and the generated dependency graph. At this stage I don't have any explanation for this.

    We might be able to get a better idea by inspecting the full dependency graph that is submitted to GitHub. Unfortunately the full transitive graph is not visible in the GitHub UI, so we'll need to inspect the report that is submitted.

    You can generate the report by changing your workflow to include dependency-graph: generate-and-upload as demonstrated here. You should be able to then download the dependency-graph file as a workflow artifact. If you can share that I may be able deduce what's going on. You can either remove any sensitive information and share it here, or send it directly to daz@gradle.com.

  10. pexa-slee commented on Nov 8, 2024

    @pexa-slee
    Author

    Not a problem @bigdaz

    I just emailed you with the report.

  11. bigdaz commented on Nov 13, 2024

    @bigdaz
    Member

    @pexa-slee Thanks for sending the report. The file contains org.springframework:spring-webmvc:6.1.13 but contains no mention of version 6.1.11. This means that the old version has been submitted to GitHub as part of the dependency graph, but the version has not been overwritten by the newer version.

    GitHub uses the 'correlator' value in the submitted file to determine if it should append or replace the existing dependency graph with a newly submitted one. You can read more about 'correlator' under 'Properties of job' here.

    So I can see 2 ways that the old dependency graph containing spring-webmvc:6.1.11 is retained:

    1. There is another job submitting a different dependency graph with a different correlator.
    2. The correlator changed between submitting the job with '6.1.11' and '6.1.13'

    The current job correlator is service_build_and_test-test, so if you renamed the workflow or job that could cause the correlator to change.

    Unfortunately, GitHub doesn't provide any way to see the correlator that submitted a particular dependency. However, the GItHub engineers informed me that the old dependency graph should eventually "time out" when new graphs are being submitted, even if these have a different correlator value.

    Some questions:

    • Is spring-webmvc:6.1.11 still listed in your dependency graph?
    • Are there any other jobs that may also be submitting a dependency graph to GitHub?
  12. lislei commented on Dec 9, 2024

    @lislei

    I'm not sure if I have the same issue. We have observed duplicate dependencies as well - #482.
    @pexa-slee have you integrated the dependency-review workflow as well?

  13. added and removed on Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions