codebattle icon indicating copy to clipboard operation
codebattle copied to clipboard

Bug: Пользователь может вставлять код в свой редактор, скопированный извне своего редактора

Open G413X opened this issue 1 year ago • 1 comments

Summary

Пользователь может вставлять код в свой редактор, скопированный извне своего редактора, что может быть использовано нечестным образом

Reproduction steps

1. Авторизоваться
2. Вступить в бой с ботом
3. Выделить тест из окна редактора бота и скопировать по ctrl c
4. Вставить в окно своего редактора по ctrl v

Аналогично можно скопипастить любой текст из внешних источников

Expected result

В окно редактора пользователя невозможно вставить какой-либо текст, который скопирован извне редактора пользователя

Actual result

В окно редактора пользователя можно скопипастить любой текст, включая код решения оппонента

https://github.com/hexlet-codebattle/codebattle/assets/150356257/41e8067a-40a5-4d37-b85e-4966fe87b020

Browsers

Chrome

OS

Windows

G413X avatar Jul 10 '24 15:07 G413X

Копирование кода оппонента исправлено, но в решение можно скопировать любой текст извне игрового поля. CodeBattle: current version : 11a596a Browser: Chrome версии 126.0.6478.183 (64 бит) ОС: Windows 10 Pro

makeevsemen avatar Jul 23 '24 12:07 makeevsemen

The user can paste the copied code into the editor from any source prerequisites: | User is authorized The user copied the code of the completed task and saved it to notepad test-data: | Task "cub_sum" Language ruby 3.3.0 Code def solution(num) return 0 if num < 0

solution(num - 1) + num * num * num end steps:

  1. Click on the "Create a game"
  2. Select game type "with a bot"
  3. Select task "cub_sum"
  4. Click on the "Create a battle"
  5. Select language ruby 3.3.0
  6. Paste the copied code into the editor
  7. Click on the "Check"

expected-result: | The user can't paste the copied code into the editor from any source actual-result: | The user can paste the copied code into the editor from any source. Victory in 5 seconds

Current version: c655ad4 Browsers: Google Chrome, Version 130.0.6943.98 OS: Windows 10, Version 19045.5487

kostaleks avatar Feb 19 '25 02:02 kostaleks

Summary: The user can copy code into his editor from the outside sources

Environment: Chromium 135.0.7049.84 (Official Build) snap (64-bit) OS Ubuntu 24.04.2 LTS version: 376ef8e

Steps-to-reproduce:

  1. Open the page
  2. Create a game with a bot/other user/friend
  3. Select opponent's code
  4. Copy with the “Ctrl + C” command
  5. Paste the copied text into your code editor using the “Ctrl + V” command

Expected-result: User can't paste anything into his code editor

Actual-result: User copied a text

Michael57e avatar Jun 27 '25 09:06 Michael57e