Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
d5266f3
ci(secu): check dependency actions
sc979 Dec 16, 2025
5752401
fix
sc979 Dec 16, 2025
13e9764
fix
sc979 Dec 16, 2025
8318bdf
fix
sc979 Dec 16, 2025
202c864
fix
sc979 Dec 16, 2025
8463185
fix
sc979 Dec 16, 2025
468a5d8
fix
sc979 Dec 16, 2025
ae2d325
v2
sc979 Dec 16, 2025
34a19bc
saveMe
sc979 Dec 16, 2025
af59d6a
v3
sc979 Dec 16, 2025
049dcd3
fix
sc979 Dec 16, 2025
0ec618d
test
sc979 Dec 16, 2025
454bd3a
test
sc979 Dec 16, 2025
8e068e1
fix
sc979 Dec 16, 2025
cae9418
fix
sc979 Dec 16, 2025
bef7f1c
todo
sc979 Dec 16, 2025
acc6a43
v5
sc979 Dec 17, 2025
2708053
add codeowner
sc979 Dec 17, 2025
e8d3726
fix
sc979 Dec 17, 2025
8d5bbee
to revert
sc979 Dec 17, 2025
bd05339
fix
sc979 Dec 17, 2025
d9127b5
torevert
sc979 Dec 17, 2025
798de65
torevert
sc979 Dec 17, 2025
936016e
fix
sc979 Dec 17, 2025
4115efa
fix
sc979 Dec 17, 2025
4b058a9
fix
sc979 Dec 17, 2025
c9404a7
fix
sc979 Dec 17, 2025
a9b980f
to delete
sc979 Dec 17, 2025
bdbbb98
fix
sc979 Dec 17, 2025
ff71b27
fix
sc979 Dec 17, 2025
3d04d9d
fix
sc979 Dec 17, 2025
345200a
fix
sc979 Dec 17, 2025
8f901c3
fix
sc979 Dec 17, 2025
109e151
fix
sc979 Dec 17, 2025
d3ed557
fix
sc979 Dec 17, 2025
7b194a2
fix
sc979 Dec 17, 2025
ac3fa2d
debug
sc979 Dec 17, 2025
c4fe84f
remove restrict perms
sc979 Dec 17, 2025
2bf9ae9
triggers
sc979 Dec 17, 2025
945a8a8
fix
sc979 Dec 17, 2025
d50e9fd
fix
sc979 Dec 17, 2025
3e320da
convert as string
sc979 Dec 17, 2025
0bdbd31
fix
sc979 Dec 17, 2025
c4e8512
fix
sc979 Dec 17, 2025
094e133
fix
sc979 Dec 17, 2025
7e3f7d6
fix
sc979 Dec 17, 2025
474819a
fix
sc979 Dec 17, 2025
b8a3595
fix
sc979 Dec 17, 2025
3ba1817
fix
sc979 Dec 17, 2025
f9d386d
fix
sc979 Dec 17, 2025
6f55ca3
fix
sc979 Dec 17, 2025
f91cfd9
fix
sc979 Dec 17, 2025
c0c86a8
fix
sc979 Dec 17, 2025
ecccdcc
fix
sc979 Dec 17, 2025
7d3b830
fix
sc979 Dec 17, 2025
7c465e0
fix
sc979 Dec 17, 2025
db9f91e
fix
sc979 Dec 17, 2025
2facc99
force bin
sc979 Dec 17, 2025
07cc9fd
replace IFS
sc979 Dec 17, 2025
536e72a
replace IFS
sc979 Dec 17, 2025
c168711
replace IFS
sc979 Dec 17, 2025
f6fffa4
fix
sc979 Dec 17, 2025
7cde321
fix
sc979 Dec 17, 2025
4576afd
fix
sc979 Dec 17, 2025
9cbcc64
fix
sc979 Dec 17, 2025
7f10f33
fix
sc979 Dec 17, 2025
200f727
fix
sc979 Dec 17, 2025
de7e648
fix
sc979 Dec 17, 2025
50b5b02
fix
sc979 Dec 17, 2025
a4b60e6
v6
sc979 Dec 17, 2025
7fd7029
fix
sc979 Dec 17, 2025
974c51d
v7
sc979 Dec 18, 2025
e221499
fix
sc979 Dec 18, 2025
66978a0
fix
sc979 Dec 18, 2025
bc4eafc
change triggers
sc979 Dec 18, 2025
8438b1a
fix
sc979 Dec 18, 2025
4c3822e
fix
sc979 Dec 18, 2025
7085c5e
fix
sc979 Dec 18, 2025
8888e4d
fix
sc979 Dec 18, 2025
4854644
fix
sc979 Dec 18, 2025
acfd2f6
fix
sc979 Dec 18, 2025
ad38ec0
fix
sc979 Dec 18, 2025
c768f16
fix
sc979 Dec 18, 2025
1d484ac
blacklist part2
sc979 Jan 13, 2026
c324c10
fix
sc979 Jan 13, 2026
cb59634
fix
sc979 Jan 13, 2026
f9da185
fix
sc979 Jan 13, 2026
5b3d076
fix
sc979 Jan 13, 2026
5f55b72
fix
sc979 Jan 13, 2026
82de0a1
Empty
sc979 Jan 13, 2026
5033484
Empty
sc979 Jan 13, 2026
f73a411
fix
sc979 Jan 13, 2026
86be4e8
fix
sc979 Jan 13, 2026
6440149
fix
sc979 Jan 13, 2026
6de70ee
fix
sc979 Jan 13, 2026
957c86e
fix
sc979 Jan 13, 2026
9f7d25e
fix
sc979 Jan 13, 2026
11a7bf1
fix
sc979 Jan 13, 2026
030ad69
fix
sc979 Jan 13, 2026
745f907
fix
sc979 Jan 13, 2026
80cb3e7
fix
sc979 Jan 13, 2026
c06cd76
fix
sc979 Jan 13, 2026
6c00f5f
ignore count
sc979 Jan 13, 2026
3e70296
ignore count
sc979 Jan 13, 2026
c46470c
remove debug
sc979 Jan 13, 2026
d549dd9
blacklist + scan
sc979 Jan 13, 2026
66127c0
add retries
sc979 Jan 13, 2026
6d3f4d9
use latest version
sc979 Jan 13, 2026
15f355c
fix
sc979 Jan 13, 2026
de90fd7
fix
sc979 Jan 13, 2026
9330f8a
fix
sc979 Jan 13, 2026
bfd5141
fix
sc979 Jan 13, 2026
69c61b6
fix
sc979 Jan 13, 2026
bd7c142
fix
sc979 Jan 13, 2026
e100d78
fix
sc979 Jan 13, 2026
758afea
fix
sc979 Jan 13, 2026
f26cf00
test me
sc979 Jan 13, 2026
19a032e
new test
sc979 Jan 13, 2026
a2b79a6
log level
sc979 Jan 14, 2026
4346312
fix
sc979 Jan 14, 2026
6851132
fix
sc979 Jan 14, 2026
bcbb5b0
fix
sc979 Jan 14, 2026
d58582e
fix
sc979 Jan 14, 2026
d6094e2
fix
sc979 Jan 14, 2026
cfbc259
fix
sc979 Jan 14, 2026
93fbde1
fix
sc979 Jan 14, 2026
2ccae69
fix
sc979 Jan 14, 2026
e0446a9
fix
sc979 Jan 14, 2026
4401d9b
fix
sc979 Jan 14, 2026
9df3644
fix
sc979 Jan 14, 2026
3c0e089
fix
sc979 Jan 14, 2026
3a78f7c
fix
sc979 Jan 14, 2026
9e0acc4
fix
sc979 Jan 14, 2026
9c7464a
fix
sc979 Jan 14, 2026
3b38b2c
fix
sc979 Jan 14, 2026
fbd229a
fix
sc979 Jan 14, 2026
d534d35
fix
sc979 Jan 14, 2026
dfe2918
fix
sc979 Jan 14, 2026
2f0685d
fix
sc979 Jan 14, 2026
6d2df17
fix
sc979 Jan 14, 2026
6644fae
fix
sc979 Jan 14, 2026
6e0ce58
fix
sc979 Jan 14, 2026
df4919b
fix
sc979 Jan 14, 2026
190332c
fix
sc979 Jan 14, 2026
9d7e719
fix
sc979 Jan 14, 2026
43009b3
fix
sc979 Jan 14, 2026
b383150
fix
sc979 Jan 14, 2026
ae30c6c
exclude version lower than requirement
sc979 Jan 19, 2026
d516566
test me
sc979 Jan 19, 2026
0295e75
test me
sc979 Jan 19, 2026
10d5fbd
test me
sc979 Jan 19, 2026
812bb07
fix
sc979 Jan 19, 2026
b22bf07
fix
sc979 Jan 19, 2026
40e8681
fix
sc979 Jan 19, 2026
53b0545
fix
sc979 Jan 19, 2026
26e32cb
fix
sc979 Jan 19, 2026
0ae6548
fix
sc979 Jan 19, 2026
4ae007f
fix
sc979 Jan 19, 2026
bad9d8b
fix2
sc979 Jan 19, 2026
0f45d30
fix3
sc979 Jan 19, 2026
f4bd9c8
fix3
sc979 Jan 19, 2026
4f97649
fix4
sc979 Jan 19, 2026
8bca4b5
fix
sc979 Jan 19, 2026
457a9bb
fix
sc979 Jan 19, 2026
8a82393
fix
sc979 Jan 19, 2026
c3422ed
fix2
sc979 Jan 19, 2026
b583605
remove safe-chain
sc979 Jan 19, 2026
13ecb3d
fix
sc979 Jan 19, 2026
e86c95e
fix
sc979 Jan 19, 2026
edc6e10
fix
sc979 Jan 19, 2026
5397b82
test comment
sc979 Jan 21, 2026
9ec1031
fix comment
sc979 Jan 21, 2026
079fa53
add permissions
sc979 Jan 21, 2026
f4ac5ea
add permissions
sc979 Jan 21, 2026
aee08c6
enh comment
sc979 Jan 21, 2026
d6c9eb2
enh comment
sc979 Jan 21, 2026
7ffbc33
enh comment
sc979 Jan 21, 2026
bda5756
enh comment
sc979 Jan 21, 2026
8d8073d
remove useless
sc979 Jan 21, 2026
7fa26fc
enh debug
sc979 Jan 21, 2026
d857b84
fix
sc979 Jan 21, 2026
912a12f
fix
sc979 Jan 21, 2026
1fdcfa7
fix
sc979 Jan 21, 2026
bbc9067
remove debug
sc979 Jan 21, 2026
19f7ad9
missing lockfile
sc979 Jan 21, 2026
57bd536
fix
sc979 Jan 21, 2026
2895fc6
add token
sc979 Jan 21, 2026
86dfb0e
fix
sc979 Jan 21, 2026
55b082d
fix
sc979 Jan 21, 2026
4cedea8
remove PAT usage
sc979 Jan 21, 2026
c2d74ee
do not fail comment
sc979 Jan 21, 2026
3450ab9
change find depth
sc979 Jan 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @centreon/owners-security
227 changes: 154 additions & 73 deletions .github/workflows/dependency-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
name: dependency-checks

on:
pull_request:
workflow_call:
inputs:
comment:
description: 'Component path'
required: false
default: ""
type: string

permissions:
pull-requests: write
contents: read

jobs:
dependency-scan:
name: Run internal dependency script
name: Run PNPM usage analysis
runs-on: ${{ github.repository_visibility != 'public' && 'centreon-security' || 'ubuntu-24.04' }}

steps:
Expand All @@ -14,124 +25,194 @@ jobs:
with:
fetch-depth: 0

- name: Run dependency scan
- name: Check dependencies type and managers version
run: |
if [ -f compromised-packages.txt ]; then rm -f compromised-packages.txt; fi
wget https://raw.githubusercontent.com/centreon/security-tools/main/blacklist/compromised-packages.txt
# Check override
if [ "${{ vars.OVERRIDE_ALL_DEPENDENCY_SCAN }}" == "true" ]; then
echo "[DEBUG] - Global scan override enabled"
return 0
elif [[ "${{ vars.OVERRIDE_PNPM_COMPLIANCE }}" == "true" ]]; then
echo "[DEBUG] - PNPM scan override enabled"
return 0
fi

# Check date
current_timestamp=$(date +%s)
DUE_DATE="${{ vars.OVERRIDE_DEPENDENCY_ENFORCEMENT_DATE }}"
input_timestamp=$(date -d "$DUE_DATE" +%s)

# Setup vars
ERROR_LOG="error_log.txt"
DEP_LIST="compromised-packages.txt"
LOCKFILES=($(find ./ -name "package-lock.json" -o -name "pnpm-lock.yaml" -o -name "yarn.lock"))
touch "$ERROR_LOG"
FORCE_FAIL="false"
ENFORCEMENT="false"
SKIP="false"
if [ "$current_timestamp" -ge "$input_timestamp" ]; then
echo "[DEBUG]: Deadline passed."
ENFORCEMENT="true"
fi

function checkPnpmLockfile() {
# Find dependency formated as
# "name@version:"
if grep -qF "$NAME@$VERSION" "$LOCKFILE"; then
echo "$NAME:$VERSION was found in $LOCKFILE"
echo "::error:: $NAME:$VERSION was found in $LOCKFILE" >> "$ERROR_LOG"
function message_type() {
MSG="$1"
if [ $ENFORCEMENT == "true" ]; then
echo "[ERROR] : $MSG"
FORCE_FAIL="true"
else
echo -n "."
echo "[WARNING] : $MSG"
fi
echo "$MSG" >> "$ERROR_LOG"
}

function checkNpmLockfile() {
# Find dependencies formated as
# "@accordproject/concerto-linter-default-ruleset": {
# "version": "3.24.1",
local package="$1"
local version="$2"
local extractedDep

extractedDep=$(awk -v name="$package" -v version="$version" '
/"dependencies": *{/ { in_deps=1; next }
in_deps && /"[^"]+": *{/ {
match($0, /"([^"]+)": *{/, arr)
dep = arr[1]
getline
if ($0 ~ /"version":/) {
match($0, /"version": *"([^"]+)"/, ver)
if (dep == name && ver[1] == version) {
print dep " " ver[1]
}
}
}
' "$LOCKFILE"
)
if [[ "$extractedDep" == "$package $version" ]]; then
echo "$package:$version" "Was found in $LOCKFILE"
echo "::error:: $package:$version Was found in $LOCKFILE" >> "$ERROR_LOG"
# Compare pnpm version used in lockfile
function compare_version() {
SKIP="false"
MIN_LOCKFILE_VERSION="8.9.9"
LOCKFILE_VERSION=$(grep -E '^lockfileVersion:' "$LOC_FILE" \
| awk '{print $2}' \
| tr -d "'\"")
# Compare versions
version_ge() {
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
}
if version_ge "$MIN_LOCKFILE_VERSION" "$LOCKFILE_VERSION"; then
message_type "PNPM lockfile update is required : lockfileVersion $LOCKFILE_VERSION < $MIN_LOCKFILE_VERSION found in **$LOC_FILE**"
else
echo -n "."
SKIP="true"
fi
}

function checkYarnLockfile() {
# Find dependencies formated as
# "@aashutoshrathi/word-wrap@^1.2.3":
# version "1.2.6"
local package="$1"
local version="$2"
local extractedDep
echo "[INFO] - Find manifest files"
DEP_FILES=($(find ./ -type f -name "package.json"))

# Scan node manifests
for DEP_FILE in ${DEP_FILES[@]}; do
DEP_DIR=$(dirname $DEP_FILE)
echo "[INFO] - Scanning $DEP_FILE"
LOC_FILES=($(find $DEP_DIR -maxdepth 1 -type f -name "package-lock.json" -o -name "pnpm-lock.yaml" -o -name "yarn.lock"))
COUNT=0

for LOC_FILE in ${LOC_FILES[@]}; do
COUNT=$((COUNT+1))
LOC_TYPE=$(basename $LOC_FILE)
LOC_DIR=$(dirname $LOC_FILE)
echo "[DEBUG] - COUNT = $COUNT / LocFile = $LOC_FILE"

case $LOC_TYPE in
"yarn.lock")
message_type "YARN is no longer allowed. Kindly replace the lockfile using PNPM. Found in **$LOC_FILE**"
;;
"package-lock.json")
message_type "NPM is no longer allowed. Kindly replace the lockfile using PNPM. Found in **$LOC_FILE**"
;;
"pnpm-lock.yaml")
SKIP=$(compare_version)
if [ "$SKIP" == "true" ] ; then continue; fi
;;
"")
message_type "A lockfile is required. No lockfile found in **$LOC_DIR**"
;;
esac
done
if [[ $COUNT -gt 1 ]]; then
message_type "$COUNT lockfiles were found. Kindly keep only the lockfile generated with PNPM. Found in **$LOC_DIR**"
fi
done

if [ -s "$ERROR_LOG" ]; then
if [ "FORCE_FAIL" == "true" ]; then
echo "[FATAL]: Breaking the run."
exit 1
fi
else
echo "[INFO] - OK nothing found"
fi
shell: bash

- name: comment_PR
continue-on-error: true
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
with:
recreate: true
path: "error_log.txt"

dependency-blacklist:
name: Run blacklist analysis
runs-on: ${{ github.repository_visibility != 'public' && 'centreon-security' || 'ubuntu-24.04' }}

steps:
- name: Checkout Repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0

- name: Check for blacklisted dependencies
run: |
# Check override
if [ "${{ vars.OVERRIDE_DEPENDENCY_SCAN }}" == "true" ]; then
echo "[DEBUG] - Global scan override enabled"
return 0
elif [[ "${{ vars.OVERRIDE_BLACKLIST_COMPLIANCE }}" == "true" ]]; then
echo "[DEBUG] - Blacklist scan override enabled"
return 0
fi

extractedDep=$(awk -v pkg="$package" '
/^".*":$/ {
split($0, arr, ",")
dep=arr[1]
gsub(/"/, "", dep)
sub(/@[^@]*$/, "", dep)
current_pkg=dep
}
/version "/ {
match($0, /"([^"]+)"/, v)
if(current_pkg==pkg) print current_pkg, v[1]
}
' "$LOCKFILE")
if [[ "$extractedDep" == "$package $version" ]]; then
echo "$package:$version Was found in $LOCKFILE"
echo "::error:: $package:$version Was found in $LOCKFILE" >> "$ERROR_LOG"
function checkPnpmLockfile() {
# Find dependency formated as
# "name@version:"
if grep -qF "$NAME@$VERSION" "$LOCKFILE"; then
echo "$NAME:$VERSION was found in $LOCKFILE"
echo "[ERROR] - $NAME:$VERSION was found in $LOCKFILE" >> "$ERROR_LOG"
else
echo -n "."
echo -n "."
fi
}

function checkManifest() {
COUNT=0
echo "::info:: Testing manifest $LOCKFILE"
echo "[INFO] - Testing manifest $LOCKFILE"
manifest_type=$(basename "$LOCKFILE")

while IFS=':' read -r NAME VERSION; do
# ignore empty and commented lines
[[ -z "${NAME// }" ]] && continue
[[ "$NAME" =~ ^# ]] && continue
#echo "DEBUG To check $NAME $VERSION"

case "$manifest_type" in
"pnpm-lock.yaml")
checkPnpmLockfile
;;
"yarn.lock")
checkYarnLockfile "$NAME" "$VERSION"
echo "[ERROR] - dependency manager not allowed. Found in $LOCKFILE" >> "$ERROR_LOG"
;;
"package-lock.json")
checkNpmLockfile "$NAME" "$VERSION"
echo "[ERROR] - dependency manager not allowed. Found in $LOCKFILE" >> "$ERROR_LOG"
;;
"*")
echo "KO manifest not managed"
exit 1
echo "[ERROR] - dependency manager not managed. Found in $LOCKFILE" >> "$ERROR_LOG"
esac

COUNT=$((COUNT+1))
done < "$DEP_LIST"
echo "Scanned $COUNT IOC"
echo "[INFO] - Scanned $COUNT IOC"
}

DEP_LIST="compromised-packages.txt"
if [ -f "$DEP_LIST" ]; then rm -f "$DEP_LIST"; fi
wget https://raw.githubusercontent.com/centreon/security-tools/main/blacklist/"$DEP_LIST"

ERROR_LOG="error_log.txt"
touch "$ERROR_LOG"
LOCKFILES=($(find ./ -type f -name "pnpm-lock.yaml"))

for LOCKFILE in "${LOCKFILES[@]}"; do
checkManifest "$LOCKFILE"
done
if [ -s "$ERROR_LOG" ]; then
echo -e "\nFATAL Breaking the run as following dependencies were found:"
echo -e "[ERROR]: Breaking the run as following ERRORS were found:"
cat "$ERROR_LOG"
exit 1
else
echo "OK nothing found"
echo "[INFO] - OK nothing found"
fi

shell: bash
2 changes: 2 additions & 0 deletions blacklist/compromised-packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1704,3 +1704,5 @@ zapier-scripts:7.8.4
zuper-cli:1.0.1
zuper-sdk:1.0.57
zuper-stream:2.0.9
safe-chain-test:0.0.1-security
eslint-js:0.0.1-security
Loading