card-mod-format 0.14.2 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/assets/script/decko/clicks_and_hovers.js.coffee +49 -0
  3. data/assets/script/decko/decko.js.coffee +32 -0
  4. data/assets/script/decko/decko_jquery.js.coffee +25 -0
  5. data/assets/script/decko/slot.js.coffee +150 -0
  6. data/assets/script/decko/slot_ready.js.coffee +11 -0
  7. data/assets/script/decko/slotter.js.coffee +208 -0
  8. data/assets/script/jquery/jquery-ui.min.js +13 -0
  9. data/assets/script/jquery/jquery.autosize.js +274 -0
  10. data/assets/script/jquery/jquery.ui.autocomplete.html.js +41 -0
  11. data/assets/script/manifest.yml +38 -0
  12. data/assets/style/common.scss +73 -0
  13. data/assets/style/logo_and_credit.scss +24 -0
  14. data/assets/style/menu.scss +43 -0
  15. data/assets/style/messaging.scss +59 -0
  16. data/assets/style/misc.scss +90 -0
  17. data/assets/style/open_and_closed.scss +68 -0
  18. data/data/files/credit_image.svg +59 -0
  19. data/data/files/mod_format_script_asset_output/file.js +66 -0
  20. data/data/real.yml +67 -0
  21. data/lib/card/format/html_format.rb +0 -2
  22. data/lib/card/mod/format.rb +4 -0
  23. data/lib/card/path.rb +20 -20
  24. data/set/all/base.rb +1 -11
  25. data/set/all/content.rb +3 -11
  26. data/set/all/csv.rb +22 -74
  27. data/set/all/data.rb +2 -2
  28. data/set/all/demo.rb +6 -2
  29. data/set/all/error.rb +1 -1
  30. data/set/all/html/error.rb +1 -1
  31. data/set/all/html/head.rb +22 -12
  32. data/set/all/html/header.rb +10 -40
  33. data/set/all/html/header_wrap.haml +3 -4
  34. data/set/all/html/labeled.haml +1 -1
  35. data/set/all/html/menu.rb +36 -12
  36. data/set/all/html/views.rb +8 -17
  37. data/set/all/html/wrap.rb +5 -4
  38. data/set/all/html.rb +2 -3
  39. data/set/all/json.rb +1 -5
  40. data/set/right/head.rb +1 -0
  41. data/set/type/cardtype.rb +4 -6
  42. data/set/type/json.rb +1 -1
  43. data/set/type/number.rb +1 -16
  44. data/vendor/jquery_file_upload/LICENSE.txt +20 -0
  45. data/vendor/jquery_file_upload/README.md +224 -0
  46. data/vendor/jquery_file_upload/SECURITY.md +227 -0
  47. data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
  48. data/vendor/jquery_file_upload/cors/postmessage.html +85 -0
  49. data/vendor/jquery_file_upload/cors/result.html +26 -0
  50. data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +22 -0
  51. data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +17 -0
  52. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +68 -0
  53. data/vendor/jquery_file_upload/css/jquery.fileupload.css +36 -0
  54. data/vendor/jquery_file_upload/docker-compose.yml +55 -0
  55. data/vendor/jquery_file_upload/img/loading.gif +0 -0
  56. data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
  57. data/vendor/jquery_file_upload/index.html +357 -0
  58. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +126 -0
  59. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +97 -0
  60. data/vendor/jquery_file_upload/js/demo.js +75 -0
  61. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +101 -0
  62. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +347 -0
  63. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +170 -0
  64. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +759 -0
  65. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +119 -0
  66. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +101 -0
  67. data/vendor/jquery_file_upload/js/jquery.fileupload.js +1604 -0
  68. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +227 -0
  69. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +805 -0
  70. data/vendor/jquery_file_upload/package-lock.json +6853 -0
  71. data/vendor/jquery_file_upload/package.json +116 -0
  72. data/vendor/jquery_file_upload/server/gae-python/app.yaml +18 -0
  73. data/vendor/jquery_file_upload/server/gae-python/main.py +204 -0
  74. data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
  75. data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +2 -0
  76. data/vendor/jquery_file_upload/server/php/Dockerfile +44 -0
  77. data/vendor/jquery_file_upload/server/php/UploadHandler.php +1480 -0
  78. data/vendor/jquery_file_upload/server/php/index.php +15 -0
  79. data/vendor/jquery_file_upload/server/php/php.ini +5 -0
  80. data/vendor/jquery_file_upload/test/index.html +49 -0
  81. data/vendor/jquery_file_upload/test/unit.js +989 -0
  82. data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
  83. data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
  84. data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
  85. data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
  86. data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
  87. data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
  88. data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
  89. data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
  90. data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
  91. data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
  92. data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
  93. data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
  94. data/vendor/jquery_rails/CHANGELOG.md +359 -0
  95. data/vendor/jquery_rails/CONTRIBUTING.md +132 -0
  96. data/vendor/jquery_rails/Gemfile +22 -0
  97. data/vendor/jquery_rails/MIT-LICENSE +21 -0
  98. data/vendor/jquery_rails/README.md +75 -0
  99. data/vendor/jquery_rails/Rakefile +59 -0
  100. data/vendor/jquery_rails/VERSIONS.md +62 -0
  101. data/vendor/jquery_rails/jquery-rails.gemspec +26 -0
  102. data/vendor/jquery_rails/lib/jquery/assert_select.rb +149 -0
  103. data/vendor/jquery_rails/lib/jquery/rails/engine.rb +6 -0
  104. data/vendor/jquery_rails/lib/jquery/rails/version.rb +9 -0
  105. data/vendor/jquery_rails/lib/jquery/rails.rb +8 -0
  106. data/vendor/jquery_rails/lib/jquery-rails.rb +1 -0
  107. data/vendor/jquery_rails/test/assert_select_jquery_test.rb +85 -0
  108. data/vendor/jquery_rails/test/test_helper.rb +6 -0
  109. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +11008 -0
  110. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +5 -0
  111. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +1 -0
  112. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +9814 -0
  113. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +4 -0
  114. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +1 -0
  115. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +10364 -0
  116. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +2 -0
  117. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +1 -0
  118. data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +555 -0
  119. metadata +104 -7
@@ -0,0 +1,227 @@
1
+ # File Upload Security
2
+
3
+ ## Contents
4
+
5
+ - [Introduction](#introduction)
6
+ - [Purpose of this project](#purpose-of-this-project)
7
+ - [Mitigations against file upload risks](#mitigations-against-file-upload-risks)
8
+ - [Prevent code execution on the server](#prevent-code-execution-on-the-server)
9
+ - [Prevent code execution in the browser](#prevent-code-execution-in-the-browser)
10
+ - [Prevent distribution of malware](#prevent-distribution-of-malware)
11
+ - [Secure file upload serving configurations](#secure-file-upload-serving-configurations)
12
+ - [Apache config](#apache-config)
13
+ - [NGINX config](#nginx-config)
14
+ - [Secure image processing configurations](#secure-image-processing-configurations)
15
+ - [ImageMagick config](#imagemagick-config)
16
+
17
+ ## Introduction
18
+
19
+ For an in-depth understanding of the potential security risks of providing file
20
+ uploads and possible mitigations, please refer to the
21
+ [OWASP - Unrestricted File Upload](https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload)
22
+ documentation.
23
+
24
+ To securely setup the project to serve uploaded files, please refer to the
25
+ sample
26
+ [Secure file upload serving configurations](#secure-file-upload-serving-configurations).
27
+
28
+ To mitigate potential vulnerabilities in image processing libraries, please
29
+ refer to the
30
+ [Secure image processing configurations](#secure-image-processing-configurations).
31
+
32
+ By default, all sample upload handlers allow only upload of image files, which
33
+ mitigates some attack vectors, but should not be relied on as the only
34
+ protection.
35
+
36
+ Please also have a look at the
37
+ [list of fixed vulnerabilities](VULNERABILITIES.md) in jQuery File Upload, which
38
+ relates mostly to the sample server-side upload handlers and how they have been
39
+ configured.
40
+
41
+ ## Purpose of this project
42
+
43
+ Please note that this project is not a complete file management product, but
44
+ foremost a client-side file upload library for [jQuery](https://jquery.com/).
45
+ The server-side sample upload handlers are just examples to demonstrate the
46
+ client-side file upload functionality.
47
+
48
+ To make this very clear, there is **no user authentication** by default:
49
+
50
+ - **everyone can upload files**
51
+ - **everyone can delete uploaded files**
52
+
53
+ In some cases this can be acceptable, but for most projects you will want to
54
+ extend the sample upload handlers to integrate user authentication, or implement
55
+ your own.
56
+
57
+ It is also up to you to configure your web server to securely serve the uploaded
58
+ files, e.g. using the
59
+ [sample server configurations](#secure-file-upload-serving-configurations).
60
+
61
+ ## Mitigations against file upload risks
62
+
63
+ ### Prevent code execution on the server
64
+
65
+ To prevent execution of scripts or binaries on server-side, the upload directory
66
+ must be configured to not execute files in the upload directory (e.g.
67
+ `server/php/files` as the default for the PHP upload handler) and only treat
68
+ uploaded files as static content.
69
+
70
+ The recommended way to do this is to configure the upload directory path to
71
+ point outside of the web application root.
72
+ Then the web server can be configured to serve files from the upload directory
73
+ with their default static files handler only.
74
+
75
+ Limiting file uploads to a whitelist of safe file types (e.g. image files) also
76
+ mitigates this issue, but should not be the only protection.
77
+
78
+ ### Prevent code execution in the browser
79
+
80
+ To prevent execution of scripts on client-side, the following headers must be
81
+ sent when delivering generic uploaded files to the client:
82
+
83
+ ```
84
+ Content-Type: application/octet-stream
85
+ X-Content-Type-Options: nosniff
86
+ ```
87
+
88
+ The `Content-Type: application/octet-stream` header instructs browsers to
89
+ display a download dialog instead of parsing it and possibly executing script
90
+ content e.g. in HTML files.
91
+
92
+ The `X-Content-Type-Options: nosniff` header prevents browsers to try to detect
93
+ the file mime type despite the given content-type header.
94
+
95
+ For known safe files, the content-type header can be adjusted using a
96
+ **whitelist**, e.g. sending `Content-Type: image/png` for PNG files.
97
+
98
+ ### Prevent distribution of malware
99
+
100
+ To prevent attackers from uploading and distributing malware (e.g. computer
101
+ viruses), it is recommended to limit file uploads only to a whitelist of safe
102
+ file types.
103
+
104
+ Please note that the detection of file types in the sample file upload handlers
105
+ is based on the file extension and not the actual file content. This makes it
106
+ still possible for attackers to upload malware by giving their files an image
107
+ file extension, but should prevent automatic execution on client computers when
108
+ opening those files.
109
+
110
+ It does not protect at all from exploiting vulnerabilities in image display
111
+ programs, nor from users renaming file extensions to inadvertently execute the
112
+ contained malicious code.
113
+
114
+ ## Secure file upload serving configurations
115
+
116
+ The following configurations serve uploaded files as static files with the
117
+ proper headers as
118
+ [mitigation against file upload risks](#mitigations-against-file-upload-risks).
119
+ Please do not simply copy&paste these configurations, but make sure you
120
+ understand what they are doing and that you have implemented them correctly.
121
+
122
+ > Always test your own setup and make sure that it is secure!
123
+
124
+ e.g. try uploading PHP scripts (as "example.php", "example.php.png" and
125
+ "example.png") to see if they get executed by your web server, e.g. the content
126
+ of the following sample:
127
+
128
+ ```php
129
+ GIF89ad <?php echo mime_content_type(__FILE__); phpinfo();
130
+ ```
131
+
132
+ ### Apache config
133
+
134
+ Add the following directive to the Apache config (e.g.
135
+ /etc/apache2/apache2.conf), replacing the directory path with the absolute path
136
+ to the upload directory:
137
+
138
+ ```ApacheConf
139
+ <Directory "/path/to/project/server/php/files">
140
+ # Some of the directives require the Apache Headers module. If it is not
141
+ # already enabled, please execute the following command and reload Apache:
142
+ # sudo a2enmod headers
143
+ #
144
+ # Please note that the order of directives across configuration files matters,
145
+ # see also:
146
+ # https://httpd.apache.org/docs/current/sections.html#merging
147
+
148
+ # The following directive matches all files and forces them to be handled as
149
+ # static content, which prevents the server from parsing and executing files
150
+ # that are associated with a dynamic runtime, e.g. PHP files.
151
+ # It also forces their Content-Type header to "application/octet-stream" and
152
+ # adds a "Content-Disposition: attachment" header to force a download dialog,
153
+ # which prevents browsers from interpreting files in the context of the
154
+ # web server, e.g. HTML files containing JavaScript.
155
+ # Lastly it also prevents browsers from MIME-sniffing the Content-Type,
156
+ # preventing them from interpreting a file as a different Content-Type than
157
+ # the one sent by the webserver.
158
+ <FilesMatch ".*">
159
+ SetHandler default-handler
160
+ ForceType application/octet-stream
161
+ Header set Content-Disposition attachment
162
+ Header set X-Content-Type-Options nosniff
163
+ </FilesMatch>
164
+
165
+ # The following directive matches known image files and unsets the forced
166
+ # Content-Type so they can be served with their original mime type.
167
+ # It also unsets the Content-Disposition header to allow displaying them
168
+ # inline in the browser.
169
+ <FilesMatch ".+\.(?i:(gif|jpe?g|png))$">
170
+ ForceType none
171
+ Header unset Content-Disposition
172
+ </FilesMatch>
173
+ </Directory>
174
+ ```
175
+
176
+ ### NGINX config
177
+
178
+ Add the following directive to the NGINX config, replacing the directory path
179
+ with the absolute path to the upload directory:
180
+
181
+ ```Nginx
182
+ location ^~ /path/to/project/server/php/files {
183
+ root html;
184
+ default_type application/octet-stream;
185
+ types {
186
+ image/gif gif;
187
+ image/jpeg jpg;
188
+ image/png png;
189
+ }
190
+ add_header X-Content-Type-Options 'nosniff';
191
+ if ($request_filename ~ /(((?!\.(jpg)|(png)|(gif)$)[^/])+$)) {
192
+ add_header Content-Disposition 'attachment; filename="$1"';
193
+ # Add X-Content-Type-Options again, as using add_header in a new context
194
+ # dismisses all previous add_header calls:
195
+ add_header X-Content-Type-Options 'nosniff';
196
+ }
197
+ }
198
+ ```
199
+
200
+ ## Secure image processing configurations
201
+
202
+ The following configuration mitigates
203
+ [potential image processing vulnerabilities with ImageMagick](VULNERABILITIES.md#potential-vulnerabilities-with-php-imagemagick)
204
+ by limiting the attack vectors to a small subset of image types
205
+ (`GIF/JPEG/PNG`).
206
+
207
+ Please also consider using alternative, safer image processing libraries like
208
+ [libvips](https://github.com/libvips/libvips) or
209
+ [imageflow](https://github.com/imazen/imageflow).
210
+
211
+ ## ImageMagick config
212
+
213
+ It is recommended to disable all non-required ImageMagick coders via
214
+ [policy.xml](https://wiki.debian.org/imagemagick/security).
215
+ To do so, locate the ImageMagick `policy.xml` configuration file and add the
216
+ following policies:
217
+
218
+ ```xml
219
+ <?xml version="1.0" encoding="UTF-8"?>
220
+ <!-- ... -->
221
+ <policymap>
222
+ <!-- ... -->
223
+ <policy domain="delegate" rights="none" pattern="*" />
224
+ <policy domain="coder" rights="none" pattern="*" />
225
+ <policy domain="coder" rights="read | write" pattern="{GIF,JPEG,JPG,PNG}" />
226
+ </policymap>
227
+ ```
@@ -0,0 +1,118 @@
1
+ # List of fixed vulnerabilities
2
+
3
+ ## Contents
4
+
5
+ - [Potential vulnerabilities with PHP+ImageMagick](#potential-vulnerabilities-with-phpimagemagick)
6
+ - [Remote code execution vulnerability in the PHP component](#remote-code-execution-vulnerability-in-the-php-component)
7
+ - [Open redirect vulnerability in the GAE components](#open-redirect-vulnerability-in-the-gae-components)
8
+ - [Cross-site scripting vulnerability in the Iframe Transport](#cross-site-scripting-vulnerability-in-the-iframe-transport)
9
+
10
+ ## Potential vulnerabilities with PHP+ImageMagick
11
+
12
+ > Mitigated: 2018-10-25 (GMT)
13
+
14
+ The sample [PHP upload handler](server/php/UploadHandler.php) before
15
+ [v9.25.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.25.1)
16
+ did not validate file signatures before invoking
17
+ [ImageMagick](https://www.imagemagick.org/) (via
18
+ [Imagick](https://php.net/manual/en/book.imagick.php)).
19
+ Verifying those
20
+ [magic bytes](https://en.wikipedia.org/wiki/List_of_file_signatures) mitigates
21
+ potential vulnerabilities when handling input files other than `GIF/JPEG/PNG`.
22
+
23
+ Please also configure ImageMagick to only enable the coders required for
24
+ `GIF/JPEG/PNG` processing, e.g. with the sample
25
+ [ImageMagick config](SECURITY.md#imagemagick-config).
26
+
27
+ **Further information:**
28
+
29
+ - Commit containing the mitigation:
30
+ [fe44d34](https://github.com/blueimp/jQuery-File-Upload/commit/fe44d34be43be32c6b8d507932f318dababb25dd)
31
+ - [ImageTragick](https://imagetragick.com/)
32
+ - [CERT Vulnerability Note VU#332928](https://www.kb.cert.org/vuls/id/332928)
33
+ - [ImageMagick CVE entries](https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=imagemagick)
34
+
35
+ ## Remote code execution vulnerability in the PHP component
36
+
37
+ > Fixed: 2018-10-23 (GMT)
38
+
39
+ The sample [PHP upload handler](server/php/UploadHandler.php) before
40
+ [v9.24.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.24.1)
41
+ allowed to upload all file types by default.
42
+ This opens up a remote code execution vulnerability, unless the server is
43
+ configured to not execute (PHP) files in the upload directory
44
+ (`server/php/files`).
45
+
46
+ The provided [.htaccess](server/php/files/.htaccess) file includes instructions
47
+ for Apache to disable script execution, however
48
+ [.htaccess support](https://httpd.apache.org/docs/current/howto/htaccess.html)
49
+ is disabled by default since Apache `v2.3.9` via
50
+ [AllowOverride Directive](https://httpd.apache.org/docs/current/mod/core.html#allowoverride).
51
+
52
+ **You are affected if you:**
53
+
54
+ 1. A) Uploaded jQuery File Upload < `v9.24.1` on a Webserver that executes files
55
+ with `.php` as part of the file extension (e.g. "example.php.png"), e.g.
56
+ Apache with `mod_php` enabled and the following directive (_not a recommended
57
+ configuration_):
58
+ ```ApacheConf
59
+ AddHandler php5-script .php
60
+ ```
61
+ B) Uploaded jQuery File Upload < `v9.22.1` on a Webserver that executes files
62
+ with the file extension `.php`, e.g. Apache with `mod_php` enabled and the
63
+ following directive:
64
+ ```ApacheConf
65
+ <FilesMatch \.php$>
66
+ SetHandler application/x-httpd-php
67
+ </FilesMatch>
68
+ ```
69
+ 2. Did not actively configure your Webserver to not execute files in the upload
70
+ directory (`server/php/files`).
71
+ 3. Are running Apache `v2.3.9+` with the default `AllowOverride` Directive set
72
+ to `None` or another Webserver with no `.htaccess` support.
73
+
74
+ **How to fix it:**
75
+
76
+ 1. Upgrade to the latest version of jQuery File Upload.
77
+ 2. Configure your Webserver to not execute files in the upload directory, e.g.
78
+ with the [sample Apache configuration](SECURITY.md#apache-config)
79
+
80
+ **Further information:**
81
+
82
+ - Commits containing the security fix:
83
+ [aeb47e5](https://github.com/blueimp/jQuery-File-Upload/commit/aeb47e51c67df8a504b7726595576c1c66b5dc2f),
84
+ [ad4aefd](https://github.com/blueimp/jQuery-File-Upload/commit/ad4aefd96e4056deab6fea2690f0d8cf56bb2d7d)
85
+ - [Full disclosure post on Hacker News](https://news.ycombinator.com/item?id=18267309).
86
+ - [CVE-2018-9206](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-9206)
87
+ - [OWASP - Unrestricted File Upload](https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload)
88
+
89
+ ## Open redirect vulnerability in the GAE components
90
+
91
+ > Fixed: 2015-06-12 (GMT)
92
+
93
+ The sample Google App Engine upload handlers before
94
+ v[9.10.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/9.10.1)
95
+ accepted any URL as redirect target, making it possible to use the Webserver's
96
+ domain for phishing attacks.
97
+
98
+ **Further information:**
99
+
100
+ - Commit containing the security fix:
101
+ [f74d2a8](https://github.com/blueimp/jQuery-File-Upload/commit/f74d2a8c3e3b1e8e336678d2899facd5bcdb589f)
102
+ - [OWASP - Unvalidated Redirects and Forwards Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html)
103
+
104
+ ## Cross-site scripting vulnerability in the Iframe Transport
105
+
106
+ > Fixed: 2012-08-09 (GMT)
107
+
108
+ The [redirect page](cors/result.html) for the
109
+ [Iframe Transport](js/jquery.iframe-transport.js) before commit
110
+ [4175032](https://github.com/blueimp/jQuery-File-Upload/commit/41750323a464e848856dc4c5c940663498beb74a)
111
+ (_fixed in all tagged releases_) allowed executing arbitrary JavaScript in the
112
+ context of the Webserver.
113
+
114
+ **Further information:**
115
+
116
+ - Commit containing the security fix:
117
+ [4175032](https://github.com/blueimp/jQuery-File-Upload/commit/41750323a464e848856dc4c5c940663498beb74a)
118
+ - [OWASP - Cross-site Scripting (XSS)](https://owasp.org/www-community/attacks/xss/)
@@ -0,0 +1,85 @@
1
+ <!DOCTYPE html>
2
+ <!--
3
+ /*
4
+ * jQuery File Upload Plugin postMessage API
5
+ * https://github.com/blueimp/jQuery-File-Upload
6
+ *
7
+ * Copyright 2011, Sebastian Tschan
8
+ * https://blueimp.net
9
+ *
10
+ * Licensed under the MIT license:
11
+ * https://opensource.org/licenses/MIT
12
+ */
13
+ -->
14
+ <html lang="en">
15
+ <head>
16
+ <meta charset="utf-8" />
17
+ <title>jQuery File Upload Plugin postMessage API</title>
18
+ <script
19
+ src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"
20
+ integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ"
21
+ crossorigin="anonymous"
22
+ ></script>
23
+ </head>
24
+ <body>
25
+ <script>
26
+ 'use strict';
27
+ var origin = /^https:\/\/example.org/,
28
+ target = new RegExp('^(http(s)?:)?\\/\\/' + location.host + '\\/');
29
+ $(window).on('message', function (e) {
30
+ e = e.originalEvent;
31
+ var s = e.data,
32
+ xhr = $.ajaxSettings.xhr(),
33
+ f;
34
+ if (!origin.test(e.origin)) {
35
+ throw new Error('Origin "' + e.origin + '" does not match ' + origin);
36
+ }
37
+ if (!target.test(e.data.url)) {
38
+ throw new Error(
39
+ 'Target "' + e.data.url + '" does not match ' + target
40
+ );
41
+ }
42
+ $(xhr.upload).on('progress', function (ev) {
43
+ ev = ev.originalEvent;
44
+ e.source.postMessage(
45
+ {
46
+ id: s.id,
47
+ type: ev.type,
48
+ timeStamp: ev.timeStamp,
49
+ lengthComputable: ev.lengthComputable,
50
+ loaded: ev.loaded,
51
+ total: ev.total
52
+ },
53
+ e.origin
54
+ );
55
+ });
56
+ s.xhr = function () {
57
+ return xhr;
58
+ };
59
+ if (!(s.data instanceof Blob)) {
60
+ f = new FormData();
61
+ $.each(s.data, function (i, v) {
62
+ f.append(v.name, v.value);
63
+ });
64
+ s.data = f;
65
+ }
66
+ $.ajax(s).always(function (result, statusText, jqXHR) {
67
+ if (!jqXHR.done) {
68
+ jqXHR = result;
69
+ result = null;
70
+ }
71
+ e.source.postMessage(
72
+ {
73
+ id: s.id,
74
+ status: jqXHR.status,
75
+ statusText: statusText,
76
+ result: result,
77
+ headers: jqXHR.getAllResponseHeaders()
78
+ },
79
+ e.origin
80
+ );
81
+ });
82
+ });
83
+ </script>
84
+ </body>
85
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <!--
3
+ /*
4
+ * jQuery Iframe Transport Plugin Redirect Page
5
+ * https://github.com/blueimp/jQuery-File-Upload
6
+ *
7
+ * Copyright 2010, Sebastian Tschan
8
+ * https://blueimp.net
9
+ *
10
+ * Licensed under the MIT license:
11
+ * https://opensource.org/licenses/MIT
12
+ */
13
+ -->
14
+ <html lang="en">
15
+ <head>
16
+ <meta charset="utf-8" />
17
+ <title>jQuery Iframe Transport Plugin Redirect Page</title>
18
+ </head>
19
+ <body>
20
+ <script>
21
+ document.body.innerText = document.body.textContent = decodeURIComponent(
22
+ window.location.search.slice(1)
23
+ );
24
+ </script>
25
+ </body>
26
+ </html>
@@ -0,0 +1,22 @@
1
+ @charset "UTF-8";
2
+ /*
3
+ * jQuery File Upload Plugin NoScript CSS
4
+ * https://github.com/blueimp/jQuery-File-Upload
5
+ *
6
+ * Copyright 2013, Sebastian Tschan
7
+ * https://blueimp.net
8
+ *
9
+ * Licensed under the MIT license:
10
+ * https://opensource.org/licenses/MIT
11
+ */
12
+
13
+ .fileinput-button input {
14
+ position: static;
15
+ opacity: 1;
16
+ filter: none;
17
+ font-size: inherit !important;
18
+ direction: inherit;
19
+ }
20
+ .fileinput-button span {
21
+ display: none;
22
+ }
@@ -0,0 +1,17 @@
1
+ @charset "UTF-8";
2
+ /*
3
+ * jQuery File Upload UI Plugin NoScript CSS
4
+ * https://github.com/blueimp/jQuery-File-Upload
5
+ *
6
+ * Copyright 2012, Sebastian Tschan
7
+ * https://blueimp.net
8
+ *
9
+ * Licensed under the MIT license:
10
+ * https://opensource.org/licenses/MIT
11
+ */
12
+
13
+ .fileinput-button i,
14
+ .fileupload-buttonbar .delete,
15
+ .fileupload-buttonbar .toggle {
16
+ display: none;
17
+ }
@@ -0,0 +1,68 @@
1
+ @charset "UTF-8";
2
+ /*
3
+ * jQuery File Upload UI Plugin CSS
4
+ * https://github.com/blueimp/jQuery-File-Upload
5
+ *
6
+ * Copyright 2010, Sebastian Tschan
7
+ * https://blueimp.net
8
+ *
9
+ * Licensed under the MIT license:
10
+ * https://opensource.org/licenses/MIT
11
+ */
12
+
13
+ .progress-animated .progress-bar,
14
+ .progress-animated .bar {
15
+ background: url('../img/progressbar.gif') !important;
16
+ filter: none;
17
+ }
18
+ .fileupload-process {
19
+ float: right;
20
+ display: none;
21
+ }
22
+ .fileupload-processing .fileupload-process,
23
+ .files .processing .preview {
24
+ display: block;
25
+ width: 32px;
26
+ height: 32px;
27
+ background: url('../img/loading.gif') center no-repeat;
28
+ background-size: contain;
29
+ }
30
+ .files audio,
31
+ .files video {
32
+ max-width: 300px;
33
+ }
34
+ .files .name {
35
+ word-wrap: break-word;
36
+ overflow-wrap: anywhere;
37
+ -webkit-hyphens: auto;
38
+ hyphens: auto;
39
+ }
40
+ .files button {
41
+ margin-bottom: 5px;
42
+ }
43
+ .toggle[type='checkbox'] {
44
+ transform: scale(2);
45
+ margin-left: 10px;
46
+ }
47
+
48
+ @media (max-width: 767px) {
49
+ .fileupload-buttonbar .btn {
50
+ margin-bottom: 5px;
51
+ }
52
+ .fileupload-buttonbar .delete,
53
+ .fileupload-buttonbar .toggle,
54
+ .files .toggle,
55
+ .files .btn span {
56
+ display: none;
57
+ }
58
+ .files audio,
59
+ .files video {
60
+ max-width: 80px;
61
+ }
62
+ }
63
+
64
+ @media (max-width: 480px) {
65
+ .files .image td:nth-child(2) {
66
+ display: none;
67
+ }
68
+ }
@@ -0,0 +1,36 @@
1
+ @charset "UTF-8";
2
+ /*
3
+ * jQuery File Upload Plugin CSS
4
+ * https://github.com/blueimp/jQuery-File-Upload
5
+ *
6
+ * Copyright 2013, Sebastian Tschan
7
+ * https://blueimp.net
8
+ *
9
+ * Licensed under the MIT license:
10
+ * https://opensource.org/licenses/MIT
11
+ */
12
+
13
+ .fileinput-button {
14
+ position: relative;
15
+ overflow: hidden;
16
+ display: inline-block;
17
+ }
18
+ .fileinput-button input {
19
+ position: absolute;
20
+ top: 0;
21
+ right: 0;
22
+ margin: 0;
23
+ height: 100%;
24
+ opacity: 0;
25
+ filter: alpha(opacity=0);
26
+ font-size: 200px !important;
27
+ direction: ltr;
28
+ cursor: pointer;
29
+ }
30
+
31
+ /* Fixes for IE < 8 */
32
+ @media screen\9 {
33
+ .fileinput-button input {
34
+ font-size: 150% !important;
35
+ }
36
+ }
@@ -0,0 +1,55 @@
1
+ version: '3.7'
2
+ services:
3
+ example:
4
+ build: server/php
5
+ ports:
6
+ - 127.0.0.1:80:80
7
+ volumes:
8
+ - .:/var/www/html
9
+ mocha:
10
+ image: blueimp/mocha-chrome
11
+ command: http://example/test
12
+ environment:
13
+ - WAIT_FOR_HOSTS=example:80
14
+ depends_on:
15
+ - example
16
+ chromedriver:
17
+ image: blueimp/chromedriver
18
+ tmpfs: /tmp
19
+ environment:
20
+ - DISABLE_X11=false
21
+ - ENABLE_VNC=true
22
+ - EXPOSE_X11=true
23
+ volumes:
24
+ - ./wdio/assets:/home/webdriver/assets:ro
25
+ ports:
26
+ - 127.0.0.1:5900:5900
27
+ geckodriver:
28
+ image: blueimp/geckodriver
29
+ tmpfs: /tmp
30
+ shm_size: 2g
31
+ environment:
32
+ - DISABLE_X11=false
33
+ - ENABLE_VNC=true
34
+ - EXPOSE_X11=true
35
+ volumes:
36
+ - ./wdio/assets:/home/webdriver/assets:ro
37
+ ports:
38
+ - 127.0.0.1:5901:5900
39
+ wdio:
40
+ image: blueimp/wdio
41
+ read_only: true
42
+ tmpfs:
43
+ - /tmp
44
+ environment:
45
+ - WAIT_FOR_HOSTS=chromedriver:4444 geckodriver:4444 example:80
46
+ - WINDOWS_HOST
47
+ - MACOS_ASSETS_DIR=$PWD/wdio/assets/
48
+ - WINDOWS_ASSETS_DIR
49
+ volumes:
50
+ - ./wdio:/app:ro
51
+ - ./wdio/reports:/app/reports
52
+ depends_on:
53
+ - chromedriver
54
+ - geckodriver
55
+ - example