Skip to content

The clickjacking attack, SSE, CSS-animations #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 71 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
e3ffff5
Update article.md
astropsy999 May 24, 2022
ceb3946
Update article.md
astropsy999 May 24, 2022
f6aafd1
Update article.md
astropsy999 May 25, 2022
0f3f2a9
Update article.md
astropsy999 May 25, 2022
ba4c2b9
Update article.md
astropsy999 May 25, 2022
9a855d9
Update article.md
astropsy999 May 26, 2022
ca0b538
Update article.md
astropsy999 May 26, 2022
52e5ab9
Update article.md
astropsy999 May 26, 2022
7d621a6
Update article.md
astropsy999 May 26, 2022
b310810
Update index.html
astropsy999 May 26, 2022
46d37a3
Update article.md
astropsy999 Jun 4, 2022
d5d59f6
Update article.md
astropsy999 Jun 4, 2022
3fe04de
Update article.md
astropsy999 Jun 5, 2022
d161dd1
Update index.html
astropsy999 Jun 5, 2022
52bf3af
Update article.md
astropsy999 Jun 5, 2022
8f3e3fe
Update article.md
astropsy999 Jun 6, 2022
ac9996b
Update article.md
astropsy999 Jun 6, 2022
3bd140e
Update article.md
astropsy999 Jun 7, 2022
18a38a3
Update iframe.html
astropsy999 Jun 7, 2022
75d1f7c
Update index.html
astropsy999 Jun 7, 2022
d9660ab
Update iframe.html
astropsy999 Jun 7, 2022
fb08989
Update facebook.html
astropsy999 Jun 7, 2022
0ef68a9
Update index.html
astropsy999 Jun 7, 2022
6e53413
Update facebook.html
astropsy999 Jun 7, 2022
c80ed0f
Update index.html
astropsy999 Jun 7, 2022
469e2d3
Update article.md
astropsy999 Jun 8, 2022
f84fa7d
Merge branch 'master' into master
astropsy999 Jun 8, 2022
d4c6a64
Update article.md
astropsy999 Jun 8, 2022
935199a
Update article.md
astropsy999 Jun 9, 2022
5f35c46
Update article.md
astropsy999 Jun 10, 2022
999ab9d
Update task.md
astropsy999 Jun 12, 2022
fafe785
Update task.md
astropsy999 Jun 12, 2022
76007bc
Update index.html
astropsy999 Jun 12, 2022
84362d4
Update index.html
astropsy999 Jun 12, 2022
22fdad6
Update index.html
astropsy999 Jun 12, 2022
d051d1e
Update index.html
astropsy999 Jun 12, 2022
f0f4d93
Update index.html
astropsy999 Jun 12, 2022
58e0228
Update index.html
astropsy999 Jun 12, 2022
d3cdbac
Update index.html
astropsy999 Jun 12, 2022
410a0e1
Update index.html
astropsy999 Jun 12, 2022
18f9da2
Update 3-frames-and-windows/06-clickjacking/article.md
astropsy999 Jul 3, 2022
a6806c0
Update 3-frames-and-windows/06-clickjacking/article.md
astropsy999 Jul 3, 2022
82cd9d5
Update 3-frames-and-windows/06-clickjacking/article.md
astropsy999 Jul 3, 2022
6b1b439
Update 3-frames-and-windows/06-clickjacking/article.md
astropsy999 Jul 3, 2022
64ccba1
Update 3-frames-and-windows/06-clickjacking/article.md
astropsy999 Jul 3, 2022
e2a2219
Update 3-frames-and-windows/06-clickjacking/article.md
astropsy999 Jul 3, 2022
ab9ef8d
Update 3-frames-and-windows/06-clickjacking/article.md
astropsy999 Jul 3, 2022
af25da9
Update 3-frames-and-windows/06-clickjacking/clickjacking-visible.view…
astropsy999 Jul 3, 2022
3a10141
Update 3-frames-and-windows/06-clickjacking/clickjacking-visible.view…
astropsy999 Jul 3, 2022
08ed6b1
Update 3-frames-and-windows/06-clickjacking/clickjacking.view/index.html
astropsy999 Jul 3, 2022
74de077
Apply suggestions from code review
dolgachio Jul 12, 2022
494b88d
Update 5-network/12-server-sent-events/article.md
astropsy999 Jul 21, 2022
f3db6f5
Update 5-network/12-server-sent-events/article.md
astropsy999 Jul 21, 2022
afeb15b
Update 5-network/12-server-sent-events/article.md
astropsy999 Jul 21, 2022
10e610c
Update 5-network/12-server-sent-events/article.md
astropsy999 Jul 21, 2022
5d29d2d
Update 5-network/12-server-sent-events/article.md
astropsy999 Jul 21, 2022
118c6cf
Update 7-animation/2-css-animations/article.md
astropsy999 Jul 21, 2022
c0b84c4
Update 7-animation/2-css-animations/article.md
astropsy999 Jul 21, 2022
ab8be27
Update 7-animation/2-css-animations/article.md
astropsy999 Jul 21, 2022
5ae6e12
Update 7-animation/2-css-animations/article.md
astropsy999 Jul 21, 2022
d2973b3
Update 7-animation/2-css-animations/article.md
astropsy999 Jul 21, 2022
1da1d54
Update 5-network/12-server-sent-events/article.md
astropsy999 Jul 28, 2022
2078a03
Update 5-network/12-server-sent-events/article.md
astropsy999 Jul 28, 2022
9a56401
Update 5-network/12-server-sent-events/article.md
astropsy999 Jul 28, 2022
400fbf6
Update 5-network/12-server-sent-events/article.md
astropsy999 Jul 28, 2022
51a327f
Update 6-data-storage/03-indexeddb/article.md
astropsy999 Jul 28, 2022
80213a9
Update 6-data-storage/03-indexeddb/article.md
astropsy999 Jul 28, 2022
51fc021
Update 6-data-storage/03-indexeddb/article.md
astropsy999 Jul 28, 2022
6529a81
Update 6-data-storage/03-indexeddb/article.md
astropsy999 Jul 28, 2022
fd843a1
Update 7-animation/2-css-animations/article.md
astropsy999 Jul 28, 2022
4e193b5
Apply suggestions from code review
dolgachio Aug 4, 2022
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
150 changes: 75 additions & 75 deletions 3-frames-and-windows/06-clickjacking/article.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<body style="margin:10px;padding:10px">

<input type="button" onclick="alert('Like pressed on facebook.html!')" value="I LIKE IT !">
<input type="button" onclick="alert('Лайк натиснуто на facebook.html!')" value="I LIKE IT !">

</body>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
}
</style>

<div>Click to get rich now:</div>
<div>Натисніть, щоб розбагатіти:</div>

<!-- The url from the victim site -->
<!-- URL-адреса з сайту-жертви -->
<iframe src="facebook.html"></iframe>

<button>Click here!</button>
<button>Натисніть тут!</button>

<div>...And you're cool (I'm a cool hacker actually)!</div>
<div>...І ти крутий (насправді я крутий хакер)!</div>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<body style="margin:10px;padding:10px">

<input type="button" onclick="alert('Like pressed on facebook.html!')" value="I LIKE IT !">
<input type="button" onclick="alert('Лайк натиснуто на facebook.html!')" value="I LIKE IT !">

</body>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
}
</style>

<div>Click to get rich now:</div>
<div>Натисніть, щоб розбагатіти:</div>

<!-- The url from the victim site -->
<!-- URL-адреса з сайту-жертви -->
<iframe src="facebook.html"></iframe>

<button>Click here!</button>
<button>Натисніть тут!</button>

<div>...And you're cool (I'm a cool hacker actually)!</div>
<div>...І ти крутий (насправді я крутий хакер)!</div>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<body>

<div id="protector">
<a href="/" target="_blank">Go to the site</a>
<a href="/" target="_blank">Перейти на сайт</a>
</div>

<script>
Expand All @@ -31,11 +31,11 @@

</script>

This text is always visible.
Цей текст завжди видно.

But if the page was open inside a document from another domain, the div over it would prevent any actions.
Але якщо сторінка була відкрита всередині документа з іншого домену, div над нею завадить будь-яким діям.

<button onclick="alert(1)">Click wouldn't work in that case</button>
<button onclick="alert(1)">Клік у даному випадку не спрацює</button>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<body>

<div>Changes top.location to javascript.info</div>
<div>Змінює top.location на javascript.info</div>

<script>
top.location = 'https://javascript.info';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

window.onbeforeunload = function() {
window.onbeforeunload = null;
return "Want to leave without learning all the secrets (he-he)?";
return "Хочете піти, не дізнавшись усіх секретів (хе-хе)?";
};

document.body.insertAdjacentHTML('beforeend', '<iframe src="iframe.html">');
Expand All @@ -31,11 +31,11 @@

<body>

<p>After a click on the button the visitor gets a "strange" question about whether they want to leave.</p>
<p>Після натискання на кнопку відвідувач отримує "дивне" запитання про те, чи хоче він піти.</p>

<p>Probably they would respond "No", and the iframe protection is hacked.</p>
<p>Ймовірно, він відповів би "ні", а захист iframe зламано.</p>

<button onclick="attack()">Add a "protected" iframe</button>
<button onclick="attack()">Додайте "захищений" iframe</button>

</body>
</html>
224 changes: 112 additions & 112 deletions 5-network/12-server-sent-events/article.md

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions 5-network/12-server-sent-events/eventsource.view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
<script>
let eventSource;

function start() { // when "Start" button pressed
function start() { // коли кнопку "Пуск" натиснуто
if (!window.EventSource) {
// IE or an old browser
alert("The browser doesn't support EventSource.");
// для IE чи іншого старого браузера
alert("Браузер не підтримує EventSource.");
return;
}

eventSource = new EventSource('digits');

eventSource.onopen = function(e) {
log("Event: open");
log("Подія: open");
};

eventSource.onerror = function(e) {
log("Event: error");
log("Подія: error");
if (this.readyState == EventSource.CONNECTING) {
log(`Reconnecting (readyState=${this.readyState})...`);
log(`Повторне з’єднання (readyState=${this.readyState})...`);
} else {
log("Error has occured.");
log("Сталася помилка.");
}
};

eventSource.addEventListener('bye', function(e) {
log("Event: bye, data: " + e.data);
log("Подія: bye, дані: " + e.data);
});

eventSource.onmessage = function(e) {
log("Event: message, data: " + e.data);
log("Подія: message, дані: " + e.data);
};
}

function stop() { // when "Stop" button pressed
function stop() { // коли кнопку "Стоп" натиснуто
eventSource.close();
log("eventSource.close()");
}
Expand All @@ -44,7 +44,7 @@
}
</script>

<button onclick="start()">Start</button> Press the "Start" to begin.
<button onclick="start()">Пуск</button> Натісніть "Пуск" для початку.
<div id="logElem" style="margin: 6px 0"></div>

<button onclick="stop()">Stop</button> "Stop" to finish.
<button onclick="stop()">Стоп</button> "Стоп" для зупинки.
7 changes: 4 additions & 3 deletions 6-data-storage/03-indexeddb/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ let openRequest = indexedDB.open(name, version);
```

- `name` -- рядок, ім’я бази даних.

- `version` -- версія є цілим числом, типово `1` (пояснення нижче).

У нас може бути багато баз даних з різними іменами, але всі вони існують лише в межах поточного вебсайту (протокол/домен/порт). Різні вебсайти не мають доступу до баз даних один одного.
Expand Down Expand Up @@ -660,9 +661,9 @@ let request = store.openCursor(query, [direction]);

- **`query`** є ключем або діапазоном ключів, як і для `getAll`.
- **`direction`** є необов’язковим аргументом, що вказує який порядок використовувати:
- `"next"` -- типово, курсор піднімається від найнижчого ключа до найвищчого.
- `"prev"` -- зворотний порядок: вниз від запису з найбільшим ключем.
- `"nextunique"`, `"prevunique"` -- те саме, що й вище, але пропускає записи з тим же ключем, який вже був (лише для курсорів за індексами, наприклад, для кількох книг із ціною=5 буде повернута лише перша).
- `"next"` -- типово, курсор піднімається від найнижчого ключа до найвищчого.
- `"prev"` -- зворотний порядок: вниз від запису з найбільшим ключем.
- `"nextunique"`, `"prevunique"` -- те саме, що й вище, але пропускає записи з тим же ключем, який вже був (лише для курсорів за індексами, наприклад, для кількох книг із ціною=5 буде повернута лише перша).

**Основна відмінність курсору полягає в тому, що `request.onsuccess` запускається кілька разів: один раз для кожного результату.**

Expand Down
16 changes: 8 additions & 8 deletions 7-animation/2-css-animations/4-animate-circle-callback/task.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

# Animated circle with callback
# Коло анімоване за допомогою функції.

In the task <info:task/animate-circle> an animated growing circle is shown.
У завданні <info:task/animate-circle> показана анімація зростання кола.

Now let's say we need not just a circle, but to show a message inside it. The message should appear *after* the animation is complete (the circle is fully grown), otherwise it would look ugly.
Припустимо, що нам потрібно показати повідомлення всередині нього. Повідомлення має з’явитися *після* завершення анімації (коли коло повністю виросло), інакше це виглядатиме погано.

In the solution of the task, the function `showCircle(cx, cy, radius)` draws the circle, but gives no way to track when it's ready.
У вирішенні завдання функція `showCircle(cx, cy, radius)` малює коло, але не дає можливості відстежити, коли воно готове.

Add a callback argument: `showCircle(cx, cy, radius, callback)` to be called when the animation is complete. The `callback` should receive the circle `<div>` as an argument.
Додайте аргументом функцію зворотного виклику: `showCircle(cx, cy, radius, callback)`, яка буде викликатися після завершення анімації. Вона має отримувати коло `<div>` як аргумент.

Here's the example:
Ось приклад:

```js
showCircle(150, 150, 100, div => {
Expand All @@ -18,8 +18,8 @@ showCircle(150, 150, 100, div => {
});
```

Demo:
Демо:

[iframe src="solution" height=260]

Take the solution of the task <info:task/animate-circle> as the base.
За основу візьмемо рішення задачі <info:task/animate-circle>
Loading