<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>43301</bug_id>
          
          <creation_ts>2022-07-20 23:14:35 +0300</creation_ts>
          <short_desc>Просмотр приложенных к багу изображений в браузере</short_desc>
          <delta_ts>2022-10-04 18:06:52 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Infrastructure</classification>
          <product>Infrastructure</product>
          <component>bugzilla.altlinux.org</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Vitaly Chikunov">vt</reporter>
          <assigned_to name="Олег Соловьев">mcpain</assigned_to>
          <cc>jenya</cc>
    
    <cc>ldv</cc>
    
    <cc>rider</cc>
          
          <qa_contact name="Andrey Cherepanov">cas</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>213002</commentid>
    <comment_count>0</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-07-20 23:14:35 +0300</bug_when>
    <thetext>Есть ла возможность сделать так, чтоб приложенные изображения просматривались в браузере, а не скачивались? Это было бы гораздо удобнее (и например пользователю лишний раз проверить, что он приложил правильное изображение.)

Пример бага https://bugzilla.altlinux.org/43005

ps. Один из вариантов это поменять `Content-Disposition: attachment` для картинок на `inline` или вообще убрать его. Но, может можно сделать что-то еще лучше типа предпросмотра thumbnails.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214636</commentid>
    <comment_count>1</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-09-08 13:04:34 +0300</bug_when>
    <thetext>То же самое могло бы быть и для текстовых вложений.

Например, здесь приложен лог файл в текстовом формате и который скачивается как un-def-5.19-on-NanoPC-T4.txt -- https://bugzilla.altlinux.org/43732

Всё это увеличило бы удобство пользования багзиллой имеющей не самый приятный пользовательский интерфейс.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214651</commentid>
    <comment_count>2</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2022-09-08 15:20:09 +0300</bug_when>
    <thetext>Олег, это же прекрасная идея, посмотри в фоне, можно ли что-то такое прикрутить как гляделку в браузере.

Там ещё и pdf можно точно смотреть.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214652</commentid>
    <comment_count>3</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-09-08 15:24:17 +0300</bug_when>
    <thetext>Это даже не гляделка, а просто поменять 1 хедер &quot;Content-Disposition:&quot; в зависимости от Content-Type типа, который сейчас отдается правильно.

Например, в том баге хедеры такие

  &lt; content-disposition: attachment; filename=&quot;=?UTF-8?Q?un-def-5=2E19-on-NanoPC-T4=2Etxt?=&quot;
  &lt; content-type: text/plain; name=&quot;=?UTF-8?Q?un-def-5=2E19-on-NanoPC-T4=2Etxt?=&quot;; charset=

Вот из-за &quot;content-disposition: attachment&quot; и происходит скачка вместо просмотра.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214653</commentid>
    <comment_count>4</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2022-09-08 15:34:14 +0300</bug_when>
    <thetext>А, так это вообще про другое.
Да, Олег, это выглядит быстрым исправлением, почини пожалуйста.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214656</commentid>
    <comment_count>5</comment_count>
    <who name="Олег Соловьев">mcpain</who>
    <bug_when>2022-09-08 15:38:26 +0300</bug_when>
    <thetext>Вы слишком глубоко копаете

allow_attachment_display
    If this option is on, users will be able to view attachments from their browser, if their browser supports the attachment&apos;s MIME type. If this option is off, users are forced to download attachments, even if the browser is able to display them.

    If you do not trust your users (e.g. if your Bugzilla is public), you should either leave this option off, or configure and set the :param:`attachment_base` parameter (see below). Untrusted users may upload attachments that could be potentially damaging if viewed directly in the browser.

attachment_base
    When the :param:`allow_attachment_display` parameter is on, it is possible for a malicious attachment to steal your cookies or perform an attack on Bugzilla using your credentials.

    If you would like additional security on attachments to avoid this, set this parameter to an alternate URL for your Bugzilla that is not the same as :param:`urlbase` or :param:`sslbase`. That is, a different domain name that resolves to this exact same Bugzilla installation.

    Note that if you have set the :param:`cookiedomain` parameter, you should set :param:`attachment_base` to use a domain that would not be matched by :param:`cookiedomain`.

    For added security, you can insert ``%bugid%`` into the URL, which will be replaced with the ID of the current bug that the attachment is on, when you access an attachment. This will limit attachments to accessing only other attachments on the same bug. Remember, though, that all those possible domain names (such as 1234.your.domain.com) must point to this same Bugzilla instance. To set this up you need to investigate wildcard DNS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214660</commentid>
    <comment_count>6</comment_count>
    <who name="Олег Соловьев">mcpain</who>
    <bug_when>2022-09-08 15:46:19 +0300</bug_when>
    <thetext>Пока можно allow_attachment_display поставить в 1 и тогда можно будет просматривать вложения в браузере.

pdf - в отдельной вкладке, не скачивая.


Но появляется риск &quot;тибринга&quot; кук специально оформленными вложениями, для этого можно будет сделать ещё и attachment_base. Например, https://attach.bugzilla.altlinux.org/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214668</commentid>
    <comment_count>7</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-09-08 17:25:20 +0300</bug_when>
    <thetext>1. Что такое &quot;тибринг кук&quot; я не знаю и не нагуглилось.
2. Я говорил только о картинках и текстовых файлах. Хотя pdf тоже хорошая идея.
3. Не слышал, чтоб текстовыми файлами можно было взломать браузер или поменять куки.
4. Картиночных сайтов так же полно и вроде бы не было последнее время взломов через картинки (хотя в древности они были). Все равно картинку потом открыть через браузер или через еще менее защищенное приложение просмотрщика картинок (без сандбоксинга и которое кодит 1 энтузиаст, а не гугл).
5. PDF сейчас через браузер просматривать так же безопаснее всего.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214669</commentid>
    <comment_count>8</comment_count>
    <who name="Олег Соловьев">mcpain</who>
    <bug_when>2022-09-08 17:33:46 +0300</bug_when>
    <thetext>(In reply to Vitaly Chikunov from comment #7)
&gt; 1. Что такое &quot;тибринг кук&quot; я не знаю и не нагуглилось.

по-русски: &quot;украсть печеньку&quot;.
Чем полезна её подмена -- я не представляю, но кража печенек для меня вполне понятная атака.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214672</commentid>
    <comment_count>9</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-09-08 18:07:59 +0300</bug_when>
    <thetext>Да кража куки я поняло. Но как её сделать через текстовое вложение или обычные картинки не знаю. Какие-то необычные вложения со скритптовыми языками, типа svg, конечно не надо разрешать.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214673</commentid>
    <comment_count>10</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-09-08 18:08:30 +0300</bug_when>
    <thetext>Опечатка - &quot;я понял&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214674</commentid>
    <comment_count>11</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-09-08 18:12:58 +0300</bug_when>
    <thetext>Ну вот раз авторы багзиллы считают, что включать &quot;allow_attachment_display&quot; не безопасно -- значит это нельзя включать! А лучше сделать &quot;глубже&quot; и в то же время проще -- только для определенных content-types заменять Content-Disposition attachment на inline.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214676</commentid>
    <comment_count>12</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-09-08 18:23:44 +0300</bug_when>
    <thetext>Им (авторам багзиллы) виднее, потому что, возможно, &quot;allow_attachment_display&quot; разрешает и просмотр _всех_ типов вложений, включая, скажем, text/html, а там уже полный доступ к кукам. Я же предлагал изначальное разрешать только для некоторых безопасных типов, а разрешать для всех видов вложение даже и не думал предлагать.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214677</commentid>
    <comment_count>13</comment_count>
    <who name="Олег Соловьев">mcpain</who>
    <bug_when>2022-09-08 18:43:27 +0300</bug_when>
    <thetext>(In reply to Vitaly Chikunov from comment #12)
&gt; Им (авторам багзиллы) виднее, потому что, возможно,
&gt; &quot;allow_attachment_display&quot; разрешает и просмотр _всех_ типов вложений,
&gt; включая, скажем, text/html, а там уже полный доступ к кукам. Я же предлагал
&gt; изначальное разрешать только для некоторых безопасных типов, а разрешать для
&gt; всех видов вложение даже и не думал предлагать.

А рядом настройка attachment_base, которая поменяет домен с аттачами и украсть печеньку не выйдет</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214678</commentid>
    <comment_count>14</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2022-09-08 18:49:07 +0300</bug_when>
    <thetext>т.е. - нужно сделать отдельный домен для attach и включить обе настойки.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214679</commentid>
    <comment_count>15</comment_count>
    <who name="Олег Соловьев">mcpain</who>
    <bug_when>2022-09-08 18:54:03 +0300</bug_when>
    <thetext>(In reply to Anton Farygin from comment #14)
&gt; т.е. - нужно сделать отдельный домен для attach и включить обе настойки.

багзилла позволяет ещё туда bugid добавить, чтобы было 43301.bugattach.altlinux.org</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>214686</commentid>
    <comment_count>16</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2022-09-08 21:09:04 +0300</bug_when>
    <thetext>(In reply to Anton Farygin from comment #14)
&gt; т.е. - нужно сделать отдельный домен для attach и включить обе настойки.

Вообще-то адрес attachments.bugzilla.a.o существует с 2009 года.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>215588</commentid>
    <comment_count>17</comment_count>
    <who name="Олег Соловьев">mcpain</who>
    <bug_when>2022-10-04 17:25:00 +0300</bug_when>
    <thetext>Пока используется attachments.b.a.o</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>215590</commentid>
    <comment_count>18</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2022-10-04 18:06:52 +0300</bug_when>
    <thetext>(In reply to Олег Соловьев from comment #17)
&gt; Пока используется attachments.b.a.o

Спасибо большое!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>