Skip to content

Commit 18565dc

Browse files
JeromeBuclaude
andcommitted
fix(ci): update IOC scanner to use pnpm-lock.yaml instead of yarn.lock
Also fix remaining yarn→pnpm references in e2e start script, and add @octokit/types as direct api devDependency (was only resolved via hoisting, broke CI's stricter resolution). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1f3364b commit 18565dc

4 files changed

Lines changed: 35 additions & 35 deletions

File tree

api/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"keywords": [],
4545
"homepage": "https://github.com/codegouvfr/sill",
4646
"devDependencies": {
47+
"@octokit/types": "^16.0.0",
4748
"@types/compression": "^1.7.2",
4849
"@types/cookie-parser": "^1.4.9",
4950
"@types/cors": "^2.8.12",
@@ -67,8 +68,8 @@
6768
"run-exclusive": "^2.2.19",
6869
"superjson": "^1.12.2",
6970
"ts-node": "^10.9.1",
70-
"typescript": "^5.7.3",
7171
"tsx": "^4.19.0",
72+
"typescript": "^5.7.3",
7273
"vitest": "^1.2.2"
7374
},
7475
"dependencies": {

e2e/scripts/start-e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const main = async () => {
160160

161161
console.log("Starting containers and building API in parallel...");
162162

163-
const apiBuildPromise = execCommand("yarn", ["build"], { cwd: API_DIR });
163+
const apiBuildPromise = execCommand("pnpm", ["build"], { cwd: API_DIR });
164164

165165
const pgPromise = new PostgreSqlContainer("postgres:16-alpine").start();
166166

@@ -202,7 +202,7 @@ const main = async () => {
202202

203203
try {
204204
console.log("Running migrations...");
205-
await execCommand("yarn", ["migrate", "latest"], { cwd: API_DIR, env: apiEnv });
205+
await execCommand("pnpm", ["migrate", "latest"], { cwd: API_DIR, env: apiEnv });
206206

207207
console.log("Seeding database...");
208208
await execCommand("node", ["dist/scripts/seed.js"], { cwd: API_DIR, env: apiEnv });

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/scan-dependencies.js

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/usr/bin/env node
22

33
/**
4-
* Shai-Hulud 2.0 IOC Scanner for Yarn projects
5-
* Scans package.json and yarn.lock against DataDog's consolidated IOC list
4+
* Shai-Hulud 2.0 IOC Scanner
5+
* Scans package.json and pnpm-lock.yaml against DataDog's consolidated IOC list
66
*/
77

88
const fs = require("fs");
99
const path = require("path");
1010

1111
const IOC_FILE = "iocs.csv";
1212
const PACKAGE_JSON_PATHS = ["package.json", "api/package.json", "web/package.json"];
13-
const YARN_LOCK_PATH = "yarn.lock";
13+
const PNPM_LOCK_PATH = "pnpm-lock.yaml";
1414

1515
/**
1616
* Parse IOC CSV file
@@ -63,10 +63,11 @@ function extractDependencies(packageJsonPath) {
6363
}
6464

6565
/**
66-
* Parse yarn.lock to get resolved versions
67-
* Simplified parser - extracts package@version pairs
66+
* Parse pnpm-lock.yaml to get resolved versions
67+
* Extracts package@version pairs from the packages: section
68+
* Format: ' @scope/name@1.2.3:' or ' name@1.2.3:'
6869
*/
69-
function parseYarnLock(lockPath) {
70+
function parsePnpmLock(lockPath) {
7071
if (!fs.existsSync(lockPath)) {
7172
console.error(`ERROR: ${lockPath} not found`);
7273
process.exit(1);
@@ -76,31 +77,26 @@ function parseYarnLock(lockPath) {
7677
const lines = content.split("\n");
7778
const packages = [];
7879

79-
let currentPackage = null;
80-
let currentVersion = null;
80+
let inPackagesSection = false;
8181

8282
for (const line of lines) {
83-
// Package declaration line (e.g., "package-name@^1.0.0:")
84-
if (line.match(/^[^ ].*:$/)) {
85-
const pkgLine = line.slice(0, -1); // Remove trailing :
86-
// Extract package name (before @)
87-
const atIndex = pkgLine.lastIndexOf("@");
88-
if (atIndex > 0) {
89-
currentPackage = pkgLine.substring(0, atIndex);
90-
}
83+
if (line === "packages:") {
84+
inPackagesSection = true;
85+
continue;
9186
}
92-
// Version line (e.g., " version "1.2.3"")
93-
else if (line.trim().startsWith('version "')) {
94-
const versionMatch = line.match(/version "([^"]+)"/);
95-
if (versionMatch && currentPackage) {
96-
currentVersion = versionMatch[1];
97-
packages.push({
98-
name: currentPackage,
99-
version: currentVersion
100-
});
101-
currentPackage = null;
102-
currentVersion = null;
103-
}
87+
88+
if (inPackagesSection && line.length > 0 && !line.startsWith(" ")) {
89+
break;
90+
}
91+
92+
if (!inPackagesSection) continue;
93+
94+
const match = line.match(/^\s{2}'?(@?[^@']+)@([^':]+)'?:/);
95+
if (match) {
96+
packages.push({
97+
name: match[1],
98+
version: match[2]
99+
});
104100
}
105101
}
106102

@@ -153,9 +149,9 @@ function scanDependencies() {
153149
}
154150
}
155151

156-
// Parse yarn.lock for resolved versions
157-
const resolvedDeps = parseYarnLock(YARN_LOCK_PATH);
158-
console.log(`✓ Scanned ${YARN_LOCK_PATH}: ${resolvedDeps.length} resolved packages\n`);
152+
// Parse pnpm-lock.yaml for resolved versions
153+
const resolvedDeps = parsePnpmLock(PNPM_LOCK_PATH);
154+
console.log(`✓ Scanned ${PNPM_LOCK_PATH}: ${resolvedDeps.length} resolved packages\n`);
159155

160156
// Check for matches
161157
const matches = [];
@@ -167,7 +163,7 @@ function scanDependencies() {
167163
matches.push({
168164
package: pkg.name,
169165
version: pkg.version,
170-
source: "yarn.lock",
166+
source: "pnpm-lock.yaml",
171167
ioc: ioc
172168
});
173169
}

0 commit comments

Comments
 (0)