File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
scanners/boostsecurityio/trivy-sbom Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,29 @@ steps:
3434 TEMP_SOLN_FILE="temp"
3535 SCAN_TARGET=$TEMP_SOLN_FILE".sln"
3636
37- # Find all .csproj files once (search up to depth 5 for performance)
38- PROJECT_LIST=$(find . -maxdepth 5 -name "*.csproj" -type f)
37+ # Find all .csproj files (excluding test directories)
38+ ALL_PROJECTS=$(find . -maxdepth 5 -name "*.csproj" -type f)
39+
40+ if [ -z "$ALL_PROJECTS" ]; then
41+ echo "{}"
42+ exit 0
43+ fi
44+
45+ # Test each project - only include ones that restore successfully
46+ # This filters out template projects or any broken projects
47+ VALID_PROJECTS_FILE=$(mktemp)
48+
49+ while IFS= read -r proj; do
50+ if [ -n "$proj" ] && dotnet restore "$proj" --ignore-failed-sources --no-cache >/dev/null 2>&1; then
51+ echo "$proj" >> "$VALID_PROJECTS_FILE"
52+ fi
53+ done <<EOF
54+ $ALL_PROJECTS
55+ EOF
56+
57+ PROJECT_LIST=$(cat "$VALID_PROJECTS_FILE")
58+ rm -f "$VALID_PROJECTS_FILE"
59+
3960
4061 if [ -z "$PROJECT_LIST" ]; then
4162 echo "No projects found."
You can’t perform that action at this time.
0 commit comments