Skip to content

Commit f945944

Browse files
chore: update verify_fips_deps script to account for additional features
1 parent 32bd38c commit f945944

1 file changed

Lines changed: 26 additions & 11 deletions

File tree

scripts/verify_fips_deps.sh

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,49 @@
11
#!/bin/bash
22
# verify_fips_deps.sh
33
# Script to verify that the fips feature doesn't include ring and uses the proper crypto library
4-
# Usage: ./verify_fips_deps.sh [package_name] (defaults to ddcommon if not specified)
4+
# Usage: ./verify_fips_deps.sh [package_name] [additional_features]
5+
# Examples:
6+
# ./verify_fips_deps.sh # Checks ddcommon with fips feature
7+
# ./verify_fips_deps.sh datadog-trace-utils # Checks trace-utils with fips feature
8+
# ./verify_fips_deps.sh datadog-trace-utils compression # Checks trace-utils with fips,compression features
59

610
set -e
711

812
# Default to ddcommon if no package is specified
913
PACKAGE=${1:-ddcommon}
14+
shift 2>/dev/null || true
1015

11-
echo "Checking ${PACKAGE} with fips feature..."
16+
# Additional features to include
17+
ADDITIONAL_FEATURES="$@"
18+
FEATURES="fips"
1219

13-
# Check if aws-lc-fips-sys is included with FIPS feature
14-
FIPS_SYS_COUNT=$(cargo tree -p ${PACKAGE} --features fips | grep -c "aws-lc-fips-sys" || true)
20+
# Add additional features if specified
21+
if [ -n "$ADDITIONAL_FEATURES" ]; then
22+
FEATURES="$FEATURES,$ADDITIONAL_FEATURES"
23+
fi
24+
25+
echo "Checking ${PACKAGE} with features: ${FEATURES}..."
26+
27+
# Check if aws-lc-fips-sys is included
28+
FIPS_SYS_COUNT=$(cargo tree -p ${PACKAGE} --features ${FEATURES} | grep -c "aws-lc-fips-sys" || true)
1529

1630
if [ "$FIPS_SYS_COUNT" -eq 0 ]; then
1731
echo "❌ ERROR: aws-lc-fips-sys is not included when fips feature is enabled"
1832
exit 1
1933
else
20-
echo "✅ aws-lc-fips-sys is correctly included with fips feature"
34+
echo "✅ aws-lc-fips-sys is correctly included with features: ${FEATURES}"
2135
fi
2236

23-
# Check if ring is included with FIPS feature (should not be)
24-
RING_COUNT=$(cargo tree -p ${PACKAGE} --features fips | grep -c "ring" || true)
37+
# Check if ring is included (should not be for runtime dependencies)
38+
RING_COUNT=$(cargo tree -p ${PACKAGE} --features ${FEATURES} -e=no-dev -i ring | grep -c "ring" || true)
2539

2640
if [ "$RING_COUNT" -eq 0 ]; then
27-
echo "✅ ring is correctly NOT included with fips feature"
41+
echo "✅ ring is correctly NOT included with features: ${FEATURES} (in runtime dependencies)"
2842
else
29-
echo "❌ ERROR: ring is included when fips feature is enabled"
43+
echo "❌ ERROR: ring is included with features: ${FEATURES} (in runtime dependencies)"
44+
cargo tree -p ${PACKAGE} --features ${FEATURES} --no-dev-dependencies -i ring
3045
exit 1
3146
fi
3247

33-
echo "All checks passed! ${PACKAGE} FIPS feature doesn't include ring."
34-
exit 0
48+
echo "All checks passed! ${PACKAGE} with features ${FEATURES} doesn't include ring in runtime dependencies."
49+
exit 0

0 commit comments

Comments
 (0)