Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 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
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
194 changes: 82 additions & 112 deletions .github/workflows/dependency-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
name: dependency-checks

on:
pull_request:
workflow_call:
inputs:
module_directory:
description: 'Component path'
required: false
type: string
default: "."
# minimum_package_age_hours:
# description: 'Allowed minimum package age'
# required: false
# type: number
# default: 48

permissions:
contents: read

env:
minimum_package_age_hours: 168 # 7 days

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

steps:
Expand All @@ -14,124 +32,76 @@ jobs:
with:
fetch-depth: 0

- name: Run dependency scan
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
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"))
- name: Setup Pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
with:
version: 10

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 "."
fi
}
- name: Setup Node
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 22
package-manager-cache: true

function checkNpmLockfile() {
# Find dependencies formated as
# "@accordproject/concerto-linter-default-ruleset": {
# "version": "3.24.1",
local package="$1"
local version="$2"
local extractedDep
# https://github.com/search?q=https%3A%2F%2Fraw.githubusercontent.com%2FAikidoSec%2Fsafe-chain&type=code

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"
else
echo -n "."
fi
}
- name: Install safe-chain
#env:
# SAFE_CHAIN_VERSION: "1.2.4"
run: |
curl -fsSL https://raw.githubusercontent.com/AikidoSec/safe-chain/main/install-scripts/install-safe-chain.sh | sh -s -- --ci
shell: bash

function checkYarnLockfile() {
# Find dependencies formated as
# "@aashutoshrathi/word-wrap@^1.2.3":
# version "1.2.6"
local package="$1"
local version="$2"
local extractedDep
- name: Check dependencies
run: |
echo "[INFO] - Set min age to ${{ env.minimum_package_age_hours }}"
export SAFE_CHAIN_MINIMUM_PACKAGE_AGE_HOURS="${{ env.minimum_package_age_hours }}"

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"
else
echo -n "."
fi
}
#echo "[INFO] - Install yarn managers"
#npm install -g yarn
#echo "[INFO] - Current npm version: $(npm -v)"
#npm install -g npm@latest
#echo "[INFO] - Updated npm version: $(npm -v)"
#echo "[DEBUG] - node"
#node --version
#echo "[DEBUG] - npm"
#npm --version
#echo "[DEBUG] - yarn"
#yarn --version
#echo "[DEBUG] - scripts"
#ls -laR /home/runner/.safe-chain

function checkManifest() {
COUNT=0
echo "::info:: Testing manifest $LOCKFILE"
manifest_type=$(basename "$LOCKFILE")
MANIFESTS=$(find ./ -type f -name "package-lock.json" -o -name "pnpm-lock.yaml" -o -name "yarn.lock")
for MANIFEST in ${MANIFESTS[@]}; do
#echo "[INFO] - Scanning $MANIFEST"
#LOCATION=$(echo "$MANIFEST" | rev | cut -d/ -f1 --complement | rev)
#FILE=$(echo "$MANIFEST" | rev | cut -d/ -f1 | rev)
#echo "[DEBUG] - location = $LOCATION"
#echo "[DEBUG] - file = $FILE"
#cd "$LOCATION"

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"
;;
"package-lock.json")
checkNpmLockfile "$NAME" "$VERSION"
;;
"*")
echo "KO manifest not managed"
exit 1
esac
COUNT=$((COUNT+1))
done < "$DEP_LIST"
echo "Scanned $COUNT IOC"
}
echo "[INFO] - Scanning $MANIFEST"
#LOCATION=$(echo "$MANIFEST" | rev | cut -d/ -f1 --complement | rev)
LOCATION=$(dirname "$MANIFEST")
#FILE=$(echo "$MANIFEST" | cut -d/ -f2)
FILE=$(basename "$MANIFEST")
echo "manifest = $MANIFEST"
echo "location = $LOCATION"
echo "file = $FILE"
cd "$LOCATION"

touch "$ERROR_LOG"
for LOCKFILE in "${LOCKFILES[@]}"; do
checkManifest "$LOCKFILE"
case "$FILE" in
"yarn.lock") yarn install --frozen-lockfile ;;
"package-lock.json") npm ci ;;
"pnpm-lock.yaml") pnpm install --frozen-lockfile ;;
*) echo "dependency manager not managed" ;;
esac
cd ~-
done
if [ -s "$ERROR_LOG" ]; then
echo -e "\nFATAL Breaking the run as following dependencies were found:"
cat "$ERROR_LOG"
exit 1
else
echo "OK nothing found"
fi

shell: bash

# - name: New dependency review
# uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2
# with:
# fail-on-severity: medium
# deny-licenses: LGPL-2.0, BSD-2-Clause
Loading
Loading