Enforce MokoStandards compliance with security workflows and documentation #44
7
.github/workflows/dependency-review.yml
vendored
7
.github/workflows/dependency-review.yml
vendored
@@ -133,12 +133,15 @@ jobs:
|
||||
|
||||
# Check requirements.txt if exists
|
||||
if [ -f "requirements.txt" ]; then
|
||||
if safety check -r requirements.txt; then
|
||||
if safety check -r requirements.txt 2>&1 | tee safety_output.txt; then
|
||||
echo "✅ No known vulnerabilities in Python dependencies" >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo "⚠️ Vulnerabilities detected in Python dependencies" >> $GITHUB_STEP_SUMMARY
|
||||
safety check -r requirements.txt || true
|
||||
cat safety_output.txt >> $GITHUB_STEP_SUMMARY || true
|
||||
rm -f safety_output.txt
|
||||
|
|
||||
exit 0
|
||||
fi
|
||||
rm -f safety_output.txt
|
||||
else
|
||||
echo "ℹ️ No requirements.txt found" >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
|
||||
3
.github/workflows/standards-compliance.yml
vendored
3
.github/workflows/standards-compliance.yml
vendored
@@ -384,7 +384,8 @@ jobs:
|
||||
echo "### Workflow YAML Syntax" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
INVALID=0
|
||||
for workflow in .github/workflows/*.yml .github/workflows/*.yaml 2>/dev/null; do
|
||||
shopt -s nullglob
|
||||
for workflow in .github/workflows/*.yml .github/workflows/*.yaml; do
|
||||
if [ -f "$workflow" ]; then
|
||||
if python3 -c "import yaml; yaml.safe_load(open('$workflow'))" 2>/dev/null; then
|
||||
|
The Python script execution on line 390 uses an f-string-like approach with the workflow path directly embedded in the command string. This could be vulnerable to command injection if workflow filenames contain special characters. Consider using subprocess or a safer approach, or at minimum validate the filename before use. The Python script execution on line 390 uses an f-string-like approach with the workflow path directly embedded in the command string. This could be vulnerable to command injection if workflow filenames contain special characters. Consider using subprocess or a safer approach, or at minimum validate the filename before use.
```suggestion
if python3 - "$workflow" << 'EOF' 2>/dev/null; then
import sys
from pathlib import Path
import yaml
workflow_path = Path(sys.argv[1])
with workflow_path.open('r', encoding='utf-8') as f:
yaml.safe_load(f)
EOF
```
|
||||
echo "✅ $(basename $workflow)" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
INGROUP: Moko-Cassiopeia.Documentation
|
||||
REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia
|
||||
FILE: docs/README.md
|
||||
VERSION: 03.05.00
|
||||
VERSION: 01.00.00
|
||||
BRIEF: Documentation index for Moko-Cassiopeia template
|
||||
PATH: /docs/README.md
|
||||
-->
|
||||
|
||||
Reference in New Issue
Block a user
The exit code handling for the safety check is confusing. On line 142, 'exit 0' is used after detecting vulnerabilities, which prevents the workflow from failing even when vulnerabilities are found. If this is intentional (to make the check informational only), it should be documented. If vulnerabilities should cause the job to fail, remove the 'exit 0' statement.