Skip to content

Commit 9bbd2a9

Browse files
authored
Update module.yaml
Signed-off-by: stlef14 <stlef14@users.noreply.github.com>
1 parent f2f76cd commit 9bbd2a9

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

scanners/boostsecurityio/trivy-sbom/module.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff 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."

0 commit comments

Comments
 (0)