Boris Lebon
Boris Lebon Design
Boris Lebon Design
Designer & developer
Spécialiste web indépendant
Web, mobile, desktop
Gestion de projet
Fullstack
Nutresia SA
Mon employeur actuel
Startup suisse, inventeur du concept le plus innovant de plats de chef fait automatiquement à la maison par un cuiseur intelligent.
Tim Berners-Lee TimBL
The inventor of the World Wide Web in Geneva CERN.
Brendan Eich
Creator of JavaScript, co-founder of Mozilla and CEO of Brave Software.
Mathias Bynens
Web standards enthusiast from Belgium working by Opera Software.
Quelle est
la première page web?
// Comparaison, ici en JavaScript
function compare(a, b) {
return a === b;
}
// Comparaison, ici en JavaScript
function compare(a, b) {
return a === b;
}
compare('Meetups', 'Meetups');
// → true
compare('Meetups', 'Meetupz');
// → false
compare('Liip', 'Stars');
// → false
compare('CSS', 'XSS');
// → false
@ 1000 μs
@ 1000 μs
@ 100 μs
@ 200 μs
// Implémentation d'exemple avec optimisations
function compare(a, b) {
const lengthA = a.length;
if (lengthA !== b.length) {
return false; // Optimisation de performance #1
}
for (let index = 0; index < lengthA; index++) {
if (a.charCodeAt(index) !== b.charCodeAt(index)) {
return false; // Optimisation de performance #2
}
}
return true; // Pire cas au niveau performance
}
function compare(a, b) {
return a === b;
}
compare('Meetups', 'Meetups');
// → true
compare('Meetups', 'Meetupz');
// → false
compare('Liip', 'Stars');
// → false
compare('CSS', 'XSS');
// → false
@ 1000 μs
@ 1000 μs [Opt. #2]
@ 100 μs [Opt. #1]
@ 200 μs [Opt. #2]
Attaque par canal auxiliaire
Attaque temporelle
function compare($userInput, $secret) {
// ...
};
function compare(a, b) {
const lengthA = a.length;
if (lengthA !== b.length) {
return false; // Optimisation de performance #1
// → Permet à l'attaquant de trouver la taille
}
for (let index = 0; index < lengthA; index++) {
if (a.charCodeAt(index) !== b.charCodeAt(index)) {
return false; // Optimisation de performance #2
// → Permet à l'attaquant de trouver chaque caractère,
// un par un (sauf le dernier)
}
}
return true; // Pire cas au niveau performance
}
function safeCompare(a, b) {
const lengthA = a.length;
let result = 0;
if (lengthA !== b.length) {
b = a;
result = 1;
}
for (let index = 0; index < lengthA; index++) {
result |= (
a.charCodeAt(index) ^ b.charCodeAt(index)
); // XOR
}
return result === 0;
}
const image = new Image();
image.onerror = stopTimer;
startTimer();
image.src = 'https://example.com/admin';
const image = new Image();
image.onerror = function() {
const end = performance.now();
const delta = end - start;
alert(`Loading took ${ delta } milliseconds.`);
};
const start = performance.now();
image.src = 'https://example.com/admin';
750 ms
1250 ms
const image = new Image();
image.onerror = function() {
const end = performance.now();
const delta = end - start;
alert(`Loading took ${ delta } milliseconds.`);
};
const start = performance.now();
image.src = 'https://example.com/admin';
Attaques temporelles modernes
Attaque d'analyse vidéo
const video = document.createElement('video');
// `suspend` event → téléchargement terminé
video.onsuspend = startTimer;
// `error` event → analyse terminée
video.onerror = stopTimer;
video.src = 'https://example.com/admin';
Attaque de mise en cache
const url = 'https://example.com/admin';
const dummyRequest = new Request('dummy');
fetch(url, {
'credentials': 'include',
'mode': 'no-cors'
}).then(function(response) {
// Le téléchargement est terminé
startTimer();
return cache.put(dummyRequest, response.clone());
}).then(function() {
// La ressource est en cache.
stopTimer();
});
30 ms
= 28 ans
15 ms
≠ 28 ans
Arjen Lenstra, cryptologue néerlandais, prof. EPFL et ancien banquier. Un casseur de RSA à l'aide de 200 playstation.
Quel est le language dont le plus de module est publié?
npm (JavaScript, Node.js)
Douglas Crockford
JSON inventor, JSLint & JSMin creator, JavaScript enthousiast, senior architect at Paypal and...
interesting and hilarous :)
By Boris Lebon