Skip to content

Commit 7dadc11

Browse files
isaacmbrownmchammer01ahpook
authored
[EDI] How the dependency graph recognizes dependencies (#59506)
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com> Co-authored-by: Eric Sorenson <ahpook@github.com>
1 parent 0066749 commit 7dadc11

File tree

9 files changed

+146
-55
lines changed

9 files changed

+146
-55
lines changed

content/code-security/concepts/supply-chain-security/about-the-dependency-graph.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ contentType: concepts
2323

2424
{% data reusables.dependabot.about-the-dependency-graph %}
2525

26-
When you push a commit to {% data variables.product.github %} that changes or adds a supported manifest or lock file to the default branch, the dependency graph is automatically updated.{% ifversion fpt or ghec %} In addition, the graph is updated when anyone pushes a change to the repository of one of your dependencies.{% endif %}
27-
2826
For information on the supported ecosystems and manifest files, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/dependency-graph-supported-package-ecosystems#supported-package-ecosystems).
2927

30-
{% data reusables.dependency-submission.dependency-submission-link %}
31-
3228
When you create a pull request containing changes to dependencies that targets the default branch, {% data variables.product.prodname_dotcom %} uses the dependency graph to add dependency reviews to the pull request. These indicate whether the dependencies contain vulnerabilities and, if so, the version of the dependency in which the vulnerability was fixed. For more information, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review).
3329

30+
## How the dependency graph is built
31+
32+
The dependency graph automatically parses dependencies by analyzing manifests and lock files in your repository. You can also submit data yourself. For more information, see [AUTOTITLE](/code-security/concepts/supply-chain-security/dependency-graph-data).
33+
3434
## Dependency graph availability
3535

3636
{% ifversion fpt or ghec %}
@@ -45,17 +45,6 @@ When you create a pull request containing changes to dependencies that targets t
4545
{% ifversion ghes %}
4646
For more information about configuration of the dependency graph, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-the-dependency-graph).{% endif %}
4747

48-
## Dependencies included
49-
50-
The dependency graph includes all the dependencies of a repository that are detailed in the manifest and lock files, or their equivalent, for supported ecosystems, as well as any dependencies that are submitted using the {% data variables.dependency-submission-api.name %}. This includes:
51-
52-
* Direct dependencies, that are explicitly defined in a manifest or lock file or have been submitted using the {% data variables.dependency-submission-api.name %}
53-
* Indirect dependencies of these direct dependencies, also known as transitive dependencies or sub-dependencies
54-
55-
The dependency graph identifies indirect dependencies{% ifversion fpt or ghec %} only if they are defined in a lock file or have been submitted using the {% data variables.dependency-submission-api.name %}. 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. If you use lock files, you 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{% else %} from the lock files{% endif %}. If your ecosystem does not have lock files, you can use pre-made actions that resolve transitive dependencies for many ecosystems. For more information, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api#using-pre-made-actions).
56-
57-
For more information on how {% data variables.product.github %} helps you understand the dependencies in your environment, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-supply-chain-security).
58-
5948
{% ifversion fpt or ghec %}
6049

6150
## Dependents and "used by" data
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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 %}

content/code-security/concepts/supply-chain-security/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ children:
1212
- about-supply-chain-security
1313
- best-practices-for-maintaining-dependencies
1414
- about-the-dependency-graph
15+
- dependency-graph-data
1516
- about-dependency-review
1617
- about-dependabot-alerts
1718
- about-metrics-for-dependabot-alerts

content/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/configuring-automatic-dependency-submission-for-your-repository.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,7 @@ topics:
1515
contentType: how-tos
1616
---
1717

18-
## About automatic dependency submission
19-
20-
> [!NOTE]
21-
> Automatic dependency submission does not support all package ecosystems. For the current list of supported ecosystems, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/dependency-graph-supported-package-ecosystems).
22-
23-
Dependency graph analyzes the manifest and lock files in a repository, in order to help users understand the upstream packages that their software project depends on. However, in some ecosystems, the resolution of transitive dependencies occurs at build-time and {% data variables.product.company_short %} isn't able to automatically discover all dependencies based on the contents of the repository alone.
24-
25-
When you enable automatic dependency submission for a repository, {% data variables.product.company_short %} automatically identifies the transitive dependencies in the repository and will submit these dependencies to {% data variables.product.company_short %} using the {% data variables.dependency-submission-api.name %}. You can then explore these dependencies using the dependency graph. {% data variables.product.prodname_dependabot %} will notify you about security updates for these dependencies by generating {% data variables.product.prodname_dependabot_alerts %} .
26-
27-
Using automatic dependency submission counts toward your {% data variables.product.prodname_actions %} minutes. For more information, see [AUTOTITLE](/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
28-
29-
Optionally, you can choose to configure self-hosted runners or {% data variables.product.company_short %}-hosted {% data variables.actions.hosted_runners %} for automatic dependency submission. For more information, see [Accessing private registries with self-hosted runners](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-automatic-dependency-submission-for-your-repository#accessing-private-registries-with-self-hosted-runners) and [Using GitHub-hosted larger runners for automatic dependency submission](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-automatic-dependency-submission-for-your-repository#using-github-hosted-larger-runners-for-automatic-dependency-submission
30-
).
18+
Automatic dependency submission is a method of submitting data to the dependency graph. It allows you to automatically resolve and submit indirect dependencies that are not captured by static analysis. For more information, see [AUTOTITLE](/code-security/concepts/supply-chain-security/dependency-graph-data).
3119

3220
## Prerequisites
3321

content/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/using-the-dependency-submission-api.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ redirect_from:
1616
contentType: how-tos
1717
---
1818

19-
## About the {% data variables.dependency-submission-api.name %}
20-
21-
{% data reusables.dependency-submission.about-dependency-submission %}
22-
23-
Dependencies are submitted to the {% data variables.dependency-submission-api.name %} in the form of a snapshot. A snapshot is a set of dependencies associated with a commit SHA and other metadata, that reflects the current state of your repository for a commit. Snapshots can be generated from the dependencies detected at build time. For technical details on using the {% data variables.dependency-submission-api.name %} over the network, see [AUTOTITLE](/rest/dependency-graph/dependency-submission).
19+
The {% data variables.dependency-submission-api.name %} is a method of submitting data to the dependency graph. It allows you to submit dependencies that are not captured by static analysis. For more information, see [AUTOTITLE](/code-security/concepts/supply-chain-security/dependency-graph-data).
2420

2521
## Submitting dependencies at build-time
2622

0 commit comments

Comments
 (0)