-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtag-ia-breaches.js
More file actions
88 lines (74 loc) · 2.07 KB
/
tag-ia-breaches.js
File metadata and controls
88 lines (74 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
'use strict';
const fs = require('fs');
const path = require('path');
const baseDir = path.join(__dirname, '.');
const dataFile = path.join(baseDir, 'source', '_data', 'breaches.json');
console.log('Chargement des données...');
const db = JSON.parse(fs.readFileSync(dataFile, 'utf-8'));
// Mots-clés pour détecter les brèches liées à l'IA
const iaKeywords = [
'ia',
'ai',
'intelligence artificielle',
'artificial intelligence',
'chatgpt',
'chat gpt',
'gpt',
'claude',
'gemini',
'copilot',
'llm',
'large language model',
'machine learning',
'deep learning',
'neural',
'transformer',
'model',
'algorithme',
'algorithm',
'apprentissage',
'learning',
'données d\'entraînement',
'training data',
'dataset',
'données d\'apprentissage'
];
let taggedCount = 0;
console.log(`Traitement de ${db.breaches.length} fuites...`);
db.breaches.forEach((breach, index) => {
if (!breach || breach.IsRetired) {
return;
}
// Vérifier si le tag IA est déjà présent
if (breach.tags && breach.tags.includes('IA')) {
return;
}
// Chercher les mots-clés dans le nom, la description et le contenu
const textToSearch = [
breach.Name || '',
breach.Title || '',
breach.Description || '',
breach.content || '',
(breach.DataClasses || []).join(' ')
].join(' ').toLowerCase();
const hasIAKeyword = iaKeywords.some(keyword => textToSearch.includes(keyword));
if (hasIAKeyword) {
if (!breach.tags) {
breach.tags = [];
}
if (!Array.isArray(breach.tags)) {
breach.tags = [breach.tags];
}
breach.tags.push('IA');
taggedCount++;
console.log(` ✓ Tag IA ajouté : ${breach.Name}`);
}
});
// Mettre à jour la date
db.lastUpdated = new Date().toISOString();
// Sauvegarder
console.log('\nSauvegarde des modifications...');
fs.writeFileSync(dataFile, JSON.stringify(db, null, 2));
fs.writeFileSync(path.join(baseDir, 'source', 'data', 'breaches.json'), JSON.stringify(db, null, 2));
console.log('\n✅ Tagging IA terminé !');
console.log(` - ${taggedCount} brèche(s) taguée(s) avec "IA"`);