|
| 1 | +--- |
| 2 | +title: How the dependency graph recognizes dependencies |
| 3 | +intro: 'The dependency graph automatically analyzes manifest files. You can submit data for dependencies that cannot be detected automatically.' |
| 4 | +product: '{% data reusables.gated-features.dependency-graph %}' |
| 5 | +versions: |
| 6 | + fpt: '*' |
| 7 | + ghes: '*' |
| 8 | + ghec: '*' |
| 9 | +topics: |
| 10 | + - Dependency graph |
| 11 | + - Dependencies |
| 12 | + - Repositories |
| 13 | +shortTitle: Dependency graph data |
| 14 | +contentType: concepts |
| 15 | +--- |
| 16 | + |
| 17 | +The dependency graph can identify your project's dependencies using the following methods. |
| 18 | + |
| 19 | +| Method | How it works | |
| 20 | +| ------ | ------------ | |
| 21 | +| **Static analysis** | Parses manifest and lock files in your repository | |
| 22 | +| {% ifversion fpt or ghec %} | |
| 23 | +| **{% data variables.product.prodname_dependabot %} graph jobs** | Uses a {% data variables.product.prodname_dependabot %} {% data variables.product.prodname_actions %} workflow to generate dependency snapshots | |
| 24 | +| {% endif %} | |
| 25 | +| {% ifversion maven-transitive-dependencies %} | |
| 26 | +| **Automatic submission** | Runs a built-in {% data variables.product.prodname_actions %} workflow to resolve build-time dependencies | |
| 27 | +| {% endif %} |
| 28 | +| **{% data variables.dependency-submission-api.name_caps %}** | Accepts dependency data you submit programmatically | |
| 29 | + |
| 30 | +Once dependencies are in the graph, you can receive {% data variables.product.prodname_dependabot_alerts %} and {% data variables.product.prodname_dependabot_security_updates %} for any known vulnerabilities. |
| 31 | + |
| 32 | +## Static analysis |
| 33 | + |
| 34 | +When you enable the dependency graph, {% data variables.product.github %} scans your repository for supported manifest files and parses each package's name and version. The graph updates when you change a supported manifest or lock file on your default branch{% ifversion fpt or ghec %}, or when a dependency changes in its own repository{% endif %}. |
| 35 | + |
| 36 | +Static analysis can identify: |
| 37 | + |
| 38 | +* **Direct dependencies** explicitly defined in a manifest or lock file |
| 39 | +* **Indirect dependencies**—dependencies of these direct dependencies, also called "transitive dependencies"—but only if they are defined in a manifest or lock file, not if they are resolved at build time |
| 40 | + |
| 41 | +For the most reliable graph, you should use lock files (or their equivalent), because they define exactly which versions of the direct and indirect dependencies you currently use. Lock files also ensure that all contributors to the repository are using the same versions, which will make it easier for you to test and debug code.{% ifversion fpt or ghec %} In addition, indirect dependencies inferred from manifest files (rather than lock files) are excluded from vulnerability checks.{% endif %} |
| 42 | + |
| 43 | +{% ifversion maven-transitive-dependencies %} |
| 44 | + |
| 45 | +## Automatic dependency submission |
| 46 | + |
| 47 | +Some ecosystems resolve indirect dependencies at build time, so static analysis can't see the full dependency tree. When you enable automatic dependency submission for a repository, {% data variables.product.company_short %} automatically identifies the transitive dependencies in the repository for supported ecosystems. See [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/dependency-graph-supported-package-ecosystems). |
| 48 | + |
| 49 | +In the background, automatic dependency submission runs a {% data variables.product.prodname_actions %} workflow that generates the complete tree and uploads it using the {% data variables.dependency-submission-api.name %}.{% ifversion fpt or ghec %} Automatic dependency submission runs on {% data variables.product.github %}-hosted runners by default and counts toward your {% data variables.product.prodname_actions %} minutes. Optionally, you can choose to run it on self-hosted runners or {% data variables.actions.hosted_runners %}.{% endif %} |
| 50 | + |
| 51 | +To enable automatic dependency submission, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-automatic-dependency-submission-for-your-repository). |
| 52 | + |
| 53 | +{% endif %} |
| 54 | + |
| 55 | +{% ifversion fpt or ghec %} |
| 56 | + |
| 57 | +## {% data variables.product.prodname_dependabot %} graph jobs |
| 58 | + |
| 59 | +This method uses a special type of {% data variables.product.prodname_dependabot %} job that builds a dependency snapshot and uploads it to the dependency submission API. This is currently only supported for **Go** dependencies. |
| 60 | + |
| 61 | +This approach is similar to automatic dependency submission, but does not incur charges for {% data variables.product.prodname_actions %} minutes. It can also access organization-wide configurations for private registries you've set up for {% data variables.product.prodname_dependabot %}. |
| 62 | + |
| 63 | +{% endif %} |
| 64 | + |
| 65 | +## The {% data variables.dependency-submission-api.name %} |
| 66 | + |
| 67 | +You can call the {% data variables.dependency-submission-api.name %} in your own script or workflow. This is useful if: |
| 68 | + |
| 69 | +* You need to submit transitive dependencies that cannot be detected from lock files. |
| 70 | +* You need to create custom logic or are using an external CI/CD system. |
| 71 | + |
| 72 | +Dependencies are submitted to the {% data variables.dependency-submission-api.name %} in the form of a snapshot. This is a list of dependencies associated with a commit SHA and other metadata, reflecting the current state of your repository. |
| 73 | + |
| 74 | +If you are calling the API in a {% data variables.product.prodname_actions %} workflow, you can use a pre-made action for your ecosystem that automatically gathers the dependencies and submits them to the API. Otherwise, you can write your own action or call the API from an external system. |
| 75 | + |
| 76 | +{% data reusables.dependency-submission.about-dependency-submission %} |
| 77 | + |
| 78 | +For more information, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api). |
| 79 | + |
| 80 | +## Prioritization |
| 81 | + |
| 82 | +{% data reusables.dependency-graph.deduplication %} |
0 commit comments