-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean-and-tag-ia.js
More file actions
107 lines (90 loc) · 2.68 KB
/
clean-and-tag-ia.js
File metadata and controls
107 lines (90 loc) · 2.68 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
'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 très spécifiques pour l'IA
const realIAKeywords = [
'chatgpt',
'chat gpt',
'gpt-4',
'gpt4',
'claude',
'gemini',
'copilot',
'openai',
'anthropic',
'hugging face',
'stable diffusion',
'midjourney',
'dall-e',
'ai girlfriend',
'ai companion',
'ai chatbot',
'mylovely',
'cutiesai',
'machine learning',
'deep learning',
'neural network',
'transformer',
'llm',
'large language model'
];
// Faux positifs à exclure
const falsePositives = [
'taj',
'traitement d\'antécédents judiciaires'
];
let removedCount = 0;
let addedCount = 0;
console.log(`Traitement de ${db.breaches.length} fuites...`);
db.breaches.forEach((breach, index) => {
if (!breach || breach.IsRetired) {
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();
// Vérifier si c'est un faux positif
const isFalsePositive = falsePositives.some(fp => textToSearch.includes(fp.toLowerCase()));
const hasRealIAKeyword = !isFalsePositive && realIAKeywords.some(keyword => {
const regex = new RegExp(`\\b${keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b`, 'i');
return regex.test(textToSearch);
});
// Supprimer le tag IA s'il existe
if (breach.tags && Array.isArray(breach.tags)) {
const iaIndex = breach.tags.indexOf('IA');
if (iaIndex !== -1) {
breach.tags.splice(iaIndex, 1);
removedCount++;
}
}
// Ajouter le tag IA seulement si c'est vraiment une brèche IA
if (hasRealIAKeyword) {
if (!breach.tags) {
breach.tags = [];
}
if (!Array.isArray(breach.tags)) {
breach.tags = [breach.tags];
}
breach.tags.push('IA');
addedCount++;
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✅ Nettoyage et tagging IA terminé !');
console.log(` - ${removedCount} tag(s) IA supprimé(s)`);
console.log(` - ${addedCount} tag(s) IA ajouté(s) (brèches vraiment liées à l'IA)`);