Skip to content

Commit ac9996b

Browse files
authored
Update article.md
94.14%
1 parent 8f3e3fe commit ac9996b

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

3-frames-and-windows/06-clickjacking/article.md

+30-30
Original file line numberDiff line numberDiff line change
@@ -105,42 +105,42 @@ window.onbeforeunload = function() {
105105

106106
[codetabs src="top-location"]
107107

108-
### Sandbox attribute
108+
### Атрибут sandbox
109109

110-
One of the things restricted by the `sandbox` attribute is navigation. A sandboxed iframe may not change `top.location`.
110+
Однією з речей, обмежених атрибутом `sandbox` є навігація. Ізольований iframe може не змінювати `top.location`.
111111

112-
So we can add the iframe with `sandbox="allow-scripts allow-forms"`. That would relax the restrictions, permitting scripts and forms. But we omit `allow-top-navigation` so that changing `top.location` is forbidden.
112+
Тож ми можемо додати iframe за допомогою `sandbox="allow-scripts allow-forms"`. Це послабить обмеження, дозволивши сценарії та форми. Але ми опускаємо `allow-top-navigation`, щоб заборонити зміну `top.location`.
113113

114-
Here's the code:
114+
Ось код:
115115

116116
```html
117117
<iframe *!*sandbox="allow-scripts allow-forms"*/!* src="facebook.html"></iframe>
118118
```
119119

120-
There are other ways to work around that simple protection too.
120+
Є й інші способи обходу цього простого захисту.
121121

122-
## X-Frame-Options
122+
## Опції X-Frame
123123

124-
The server-side header `X-Frame-Options` can permit or forbid displaying the page inside a frame.
124+
Заголовок на стороні сервера `X-Frame-Options` може дозволяти або забороняти відображення сторінки всередині фрейму.
125125

126-
It must be sent exactly as HTTP-header: the browser will ignore it if found in HTML `<meta>` tag. So, `<meta http-equiv="X-Frame-Options"...>` won't do anything.
126+
Він має бути надісланий точно як HTTP-заголовок: браузер проігнорує його, якщо знайде в HTML `<meta>` тегу. Отже, `<meta http-equiv="X-Frame-Options"...>` нічого не дасть.
127127

128-
The header may have 3 values:
128+
Заголовок може мати 3 значення:
129129

130130

131131
`DENY`
132-
: Never ever show the page inside a frame.
132+
: Ніколи не показувати сторінку всередині фрейму.
133133

134134
`SAMEORIGIN`
135-
: Allow inside a frame if the parent document comes from the same origin.
135+
: Дозволити всередині фрейму, якщо батьківський документ походить із того самого джерела.
136136

137137
`ALLOW-FROM domain`
138-
: Allow inside a frame if the parent document is from the given domain.
138+
: Дозволити всередині фрейму, якщо батьківський документ із заданого домену.
139139

140-
For instance, Twitter uses `X-Frame-Options: SAMEORIGIN`.
140+
Наприклад, Twitter використовує `X-Frame-Options: SAMEORIGIN`.
141141

142142
````online
143-
Here's the result:
143+
Ось результат:
144144
145145
```html
146146
<iframe src="https://twitter.com"></iframe>
@@ -149,16 +149,16 @@ Here's the result:
149149
<!-- ebook: prerender/ chrome headless dies and timeouts on this iframe -->
150150
<iframe src="https://twitter.com"></iframe>
151151
152-
Depending on your browser, the `iframe` above is either empty or alerting you that the browser won't permit that page to be navigating in this way.
152+
Залежно від вашого браузера, `iframe` вище або порожній, або попереджає вас про те, що браузер не дозволяє відобразити цю сторінку.
153153
````
154154

155-
## Showing with disabled functionality
155+
## Відображення з вимкненою функціональністю
156156

157-
The `X-Frame-Options` header has a side-effect. Other sites won't be able to show our page in a frame, even if they have good reasons to do so.
157+
Заголовок `X-Frame-Options` має побічний ефект. Інші сайти не зможуть показати нашу сторінку у фреймі, навіть якщо у них є для цього вагомі причини.
158158

159-
So there are other solutions... For instance, we can "cover" the page with a `<div>` with styles `height: 100%; width: 100%;`, so that it will intercept all clicks. That `<div>` is to be removed if `window == top` or if we figure out that we don't need the protection.
159+
Тому є інші рішення...Наприклад, ми можемо "покрити" сторінку `<div>` зі стилями `height: 100%; width: 100%;`, щоб він перехоплював усі клацання. Цей `<div>` можна видалити, якщо `window == top` або якщо ми зрозуміли, що захист нам не потрібен.
160160

161-
Something like this:
161+
Щось на зразок цього:
162162

163163
```html
164164
<style>
@@ -173,39 +173,39 @@ Something like this:
173173
</style>
174174

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

179179
<script>
180-
// there will be an error if top window is from the different origin
181-
// but that's ok here
180+
// буде помилка, якщо верхнє вікно має інше походження
181+
// але тут гаразд
182182
if (top.document.domain == document.domain) {
183183
protector.remove();
184184
}
185185
</script>
186186
```
187187

188-
The demo:
188+
Демо:
189189

190190
[codetabs src="protector"]
191191

192-
## Samesite cookie attribute
192+
## Атрибут cookie: samesite
193193

194-
The `samesite` cookie attribute can also prevent clickjacking attacks.
194+
Атрибут cookie `samesite` також може запобігти атакам клікджекінгу.
195195

196-
A cookie with such attribute is only sent to a website if it's opened directly, not via a frame, or otherwise. More information in the chapter <info:cookie#samesite>.
196+
Файл cookie з таким атрибутом надсилається на веб-сайт, лише якщо його відкрито безпосередньо, а не через фрейм чи іншим чином. Більше інформації в розділі <info:cookie#samesite>.
197197

198-
If the site, such as Facebook, had `samesite` attribute on its authentication cookie, like this:
198+
Якби сайт, наприклад Facebook, при аутентифікації мав атрибут `samesite` у файлі cookie , наприклад:
199199

200200
```
201201
Set-Cookie: authorization=secret; samesite
202202
```
203203

204-
...Then such cookie wouldn't be sent when Facebook is open in iframe from another site. So the attack would fail.
204+
...Тоді такий файл cookie не надсилатиметься, коли Facebook буде відкрито в iframe з іншого сайту. Тож атака не вдасться.
205205

206-
The `samesite` cookie attribute will not have an effect when cookies are not used. This may allow other websites to easily show our public, unauthenticated pages in iframes.
206+
Атрибут cookie `samesite` не матиме ефекту, якщо файли cookie не використовуються. Це може дозволити іншим веб-сайтам легко показувати наші загальнодоступні, неавтентифіковані сторінки в iframes.
207207

208-
However, this may also allow clickjacking attacks to work in a few limited cases. An anonymous polling website that prevents duplicate voting by checking IP addresses, for example, would still be vulnerable to clickjacking because it does not authenticate users using cookies.
208+
Однак це також може дозволяти атакам за допомогою clickjacking працювати в кількох обмежених випадках. Наприклад, веб-сайт анонімного опитування, який запобігає дублюванню голосування шляхом перевірки IP-адреси, все одно буде вразливим до клікджекінгу, оскільки він не автентифікує користувачів за допомогою файлів cookie.
209209

210210
## Summary
211211

0 commit comments

Comments
 (0)