Skip to content

Commit 6c9f018

Browse files
Copilotpragnya17
andcommitted
Fix: Exclude SPDX files outside BuildDropPath from files section
Co-authored-by: pragnya17 <59893188+pragnya17@users.noreply.github.com>
1 parent 994ce54 commit 6c9f018

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Microsoft.Sbom.Api/Executors/FileInfoWriter.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ private async Task Generate(IList<ISbomConfig> filesArraySupportingSboms, Intern
7676
config.Recorder.RecordSPDXFileId(fileId);
7777
}
7878

79-
await result.Writer.WriteAsync((generationResult?.Document, config.JsonSerializer));
79+
// Only include files in the files section if they are within the BuildDropPath
80+
// Files outside the BuildDropPath should only be processed as external document references
81+
if (!sbomFile.IsOutsideDropPath)
82+
{
83+
await result.Writer.WriteAsync((generationResult?.Document, config.JsonSerializer));
84+
}
8085
}
8186
}
8287
catch (Exception e)

0 commit comments

Comments
 (0)