Commit 226279c
fix: exclude transitive devDependencies from Yarn Berry SBOM using BFS reachability
The previous implementation only filtered devDependencies at the root edge,
but still processed all non-root nodes unconditionally. This meant transitive
dependencies of devDeps (e.g., jest -> some-test-util) would leak into the SBOM.
Uses BFS from root production deps to compute the reachable set, then skips
unreachable nodes and edges during SBOM emission. Also adds a test fixture
with a transitive devDep to expose the issue.
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>1 parent 31a5cab commit 226279c
File tree
2 files changed
+74
-9
lines changed- src
- main/java/io/github/guacsec/trustifyda/providers
- test/resources/tst_manifests/yarn-berry/deps_with_mixed_dep_types
2 files changed
+74
-9
lines changedLines changed: 72 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
112 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
113 | 168 | | |
114 | 169 | | |
115 | 170 | | |
116 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
117 | 176 | | |
118 | 177 | | |
119 | 178 | | |
120 | 179 | | |
121 | 180 | | |
122 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
123 | 186 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | 187 | | |
132 | 188 | | |
133 | 189 | | |
134 | 190 | | |
135 | 191 | | |
136 | 192 | | |
137 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
138 | 202 | | |
139 | 203 | | |
140 | 204 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
0 commit comments