├── .gitignore ├── CHANGES.rst ├── LICENSE ├── MANIFEST.in ├── README.rst ├── demo ├── __init__.py ├── admin.py ├── forms.py ├── migrations │ ├── 0001_initial.py │ └── __init__.py ├── models.py ├── settings.py ├── templates │ └── demo │ │ ├── detail.html │ │ └── index.html ├── urls.py ├── views.py └── wsgi.py ├── django_encrypted_filefield ├── __init__.py ├── admin.py ├── apps.py ├── checks.py ├── constants.py ├── crypt.py ├── fields.py ├── migrations │ └── __init__.py ├── models.py ├── tests │ ├── __init__.py │ ├── test_constants.py │ ├── test_crypt.py │ ├── test_fields.py │ └── test_views.py └── views.py ├── manage.py ├── poetry.lock └── pyproject.toml /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | 85 | # Spyder project settings 86 | .spyderproject 87 | 88 | # Rope project settings 89 | .ropeproject 90 | 91 | demo/attachments 92 | demo/images 93 | db.sqlite3 94 | -------------------------------------------------------------------------------- /CHANGES.rst: -------------------------------------------------------------------------------- 1 | Changelog 2 | ######### 3 | 4 | 0.3.0 5 | ===== 6 | 7 | * Dropped support for Django <=2.2 and Python <=3.6 8 | * Fixed `#12`_ (thanks `Pascal Chambon`_ for the report). This introduces tags 9 | to the start up checks so you can now skip them if you're doing something 10 | that negates the need for the warnings/errors they generate. 11 | * We now use `poetry`_ 'cause it's some excellent software. 12 | 13 | 14 | 0.2.2 15 | ===== 16 | 17 | * Added a dependency on six as it was removed from Django 3.x+. 18 | 19 | 20 | 0.2.1 21 | ===== 22 | 23 | * Fixed a hard dependency on python-magic==0.4.12 which appears to have been 24 | removed from PyPI. 25 | 26 | 27 | 0.2.0 28 | ===== 29 | 30 | * Updated to play nice with Django 2.0 thanks to pull-request `#9`_ from 31 | `spaceriqui`_. 32 | * At this stage Only Django 1.11+ will be supported, though it may still work 33 | with older versions as far back as 1.8. 34 | 35 | 36 | 0.1.0 37 | ===== 38 | 39 | * Initial release 40 | 41 | 42 | .. _poetry: https://python-poetry.org/ 43 | 44 | .. _spaceriqui: https://github.com/spaceriqui 45 | .. _Pascal Chambon: https://github.com/pakal 46 | 47 | .. _#9: https://github.com/danielquinn/django-encrypted-filefield/pull/9 48 | .. _#12: https://github.com/danielquinn/django-encrypted-filefield/issues/12 49 | 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.rst 3 | recursive-include django_encrypted_filefield 4 | 5 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | django-encrypted-filefield 2 | ========================== 3 | 4 | Encrypt uploaded files, store them wherever you like and stream them back 5 | unencrypted. 6 | 7 | 8 | Why This Exists 9 | --------------- 10 | 11 | It's increasingly common to use products like S3 to host static files, but 12 | sometimes those static files aren't exactly meant for public eyes. You might 13 | push some bit of personal information into S3 and then anyone with the URL will 14 | be able to see it. 15 | 16 | Sure, the URL may be really hard to guess, but I'm not a fan of "security 17 | through obscurity" so I wrote this to encrypt stuff I push to S3. Now, only 18 | encrypted blobs are available publicly, but internally, behind a 19 | ``MyPermissionRequiredMixin``, the images and documents are loaded magically 20 | and transparently. 21 | 22 | 23 | How's It Work? 24 | -------------- 25 | 26 | ``EncryptedFileField`` is a thin wrapper around Django's native ``FileField`` 27 | that transparently encrypts whatever the user has uploaded and passes off the 28 | now encrypted data to whatever storage engine you've specified. It also 29 | overrides the ``.url`` value to return a reference to your own view, which does 30 | the decryption for you on the way back to the user. 31 | 32 | So where you may have once had this: 33 | 34 | .. code:: python 35 | 36 | # my_app/models.py 37 | 38 | class MyModel(models.Model): 39 | 40 | name = models.CharField(max_length=128) 41 | attachment = models.FileField(upload_to="attachments") 42 | image = models.ImageField( 43 | upload_to="images", 44 | width_field="image_width", 45 | height_field="image_height" 46 | ) 47 | image_width = models.PositiveIntegerField() 48 | image_height = models.PositiveIntegerField() 49 | 50 | All you have to do is change the file fields and you've got encrypted files 51 | 52 | .. code:: python 53 | 54 | # my_app/models.py 55 | 56 | from django_encrypted_filefield.fields import ( 57 | EncryptedFileField, 58 | EncryptedImageField 59 | ) 60 | 61 | class MyModel(models.Model): 62 | 63 | name = models.CharField(max_length=128) 64 | attachment = EncryptedFileField(upload_to="attachments") 65 | image = EncryptedImageField( 66 | upload_to="images", 67 | width_field="image_width", 68 | height_field="image_height" 69 | ) 70 | image_width = models.PositiveIntegerField() 71 | image_height = models.PositiveIntegerField() 72 | 73 | 74 | # my_app/views.py 75 | 76 | from django.contrib.auth.mixins import AuthMixin 77 | from django_encrypted_filefield.views import FetchView 78 | 79 | 80 | class MyPermissionRequiredMixin(AuthMixin) 81 | """ 82 | Your own rules live here 83 | """ 84 | pass 85 | 86 | 87 | class MyFetchView(MyPermissionRequiredMixin, FetchView): 88 | pass 89 | 90 | 91 | .. code:: python 92 | 93 | # my_app/urls.py 94 | 95 | from django_encrypted_filefield.constants import FETCH_URL_NAME 96 | from myapp.views import MyFetchView 97 | 98 | urlpatterns = [ 99 | # ... 100 | url( 101 | r"^my-fetch-url/(?P.+)", # up to you, but path is required 102 | MyFetchView.as_view(), # your view, your permissions 103 | name=FETCH_URL_NAME 104 | ), 105 | # ... 106 | ] 107 | 108 | 109 | How Do I Configure It? 110 | ---------------------- 111 | 112 | Configuration of the package requires setting three values in either the 113 | environment (recommended) or in your ``settings.py``. These values are: 114 | 115 | * ``DEFF_SALT``: The salt value use for generating the synchronous encryption 116 | * ``DEFF_PASSWORD``: The password value for the same thing 117 | * ``DEFF_FETCH_URL_NAME``: The named URL you intend to use to download the 118 | files as they're decrypted on-the-fly. 119 | 120 | Outside of that, follow the above and you should be good to go. 121 | 122 | 123 | How Do I Run the Tests? 124 | ----------------------- 125 | 126 | As this project depends on the setting of three environment variables, you have 127 | to set these for the tests. Also, the tests are expecting these values, so 128 | don't change them: 129 | 130 | .. code:: bash 131 | 132 | $ DEFF_SALT="salt" DEFF_PASSWORD="password" DEFF_FETCH_URL_NAME="fetch" ./manage.py test 133 | 134 | 135 | Is There a Demo? 136 | ---------------- 137 | 138 | There is! Just check out the code and run the mini django app in the ``demo`` 139 | directory: 140 | 141 | .. code:: bash 142 | 143 | $ git clone git@github.com:danielquinn/django-encrypted-filefield.git 144 | $ cd django-encrypted-filefield/demo 145 | $ export DEFF_SALT="salt" 146 | $ export DEFF_PASSWORD="password" 147 | $ export DEFF_FETCH_URL_NAME="fetch" 148 | $ ./manage migrate 149 | $ ./manage.py runserver 150 | 151 | ...then open http://localhost:8000 and submit two files via the form. In this 152 | case we're using Django's default_storage, but the same logic should apply to 153 | all storage engines. 154 | 155 | 156 | Stuff That Doesn't Work 157 | ----------------------- 158 | 159 | Since the file changes just before it's saved, you can't apply a validator 160 | that acts on the contents of the file. For example, if you've got a validator 161 | that uses mime-magic to determine the file type, it will always return 162 | ``text/plain`` which, unless that's what you're checking for, will break your 163 | validation. To make things more interesting, Django appears to apply 164 | validation on field values *on every save*, not just when the field has 165 | changed, so even if the validator were to work on the first run, whenever you 166 | would update the object in the admin, your validator will barf in this case. 167 | 168 | 169 | What's the Status of the Project? 170 | --------------------------------- 171 | 172 | Stable. I'm actively using it in a production environment now and have been 173 | for some time without issue. This isn't a guarantee that it'll work for 174 | everyone in every case of course, but it's enough for me to use that word :-) 175 | -------------------------------------------------------------------------------- /demo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielquinn/django-encrypted-filefield/93c78c43205a91ebca93fb82cfcaae1f49cd9e2b/demo/__init__.py -------------------------------------------------------------------------------- /demo/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import MyModel 4 | 5 | 6 | admin.register(MyModel) 7 | -------------------------------------------------------------------------------- /demo/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | 3 | from .models import MyModel 4 | 5 | 6 | class MyForm(forms.ModelForm): 7 | class Meta: 8 | model = MyModel 9 | fields = "__all__" 10 | exclude = ("image_width", "image_height") 11 | -------------------------------------------------------------------------------- /demo/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.5 on 2017-01-06 19:08 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | import django_encrypted_filefield.fields 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | initial = True 13 | 14 | dependencies = [] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name="MyModel", 19 | fields=[ 20 | ( 21 | "id", 22 | models.AutoField( 23 | auto_created=True, 24 | primary_key=True, 25 | serialize=False, 26 | verbose_name="ID", 27 | ), 28 | ), 29 | ("name", models.CharField(max_length=128)), 30 | ( 31 | "attachment", 32 | django_encrypted_filefield.fields.EncryptedFileField( 33 | upload_to="attachments" 34 | ), 35 | ), 36 | ( 37 | "image", 38 | django_encrypted_filefield.fields.EncryptedImageField( 39 | height_field="image_height", 40 | upload_to="images", 41 | width_field="image_width", 42 | ), 43 | ), 44 | ("image_width", models.PositiveIntegerField()), 45 | ("image_height", models.PositiveIntegerField()), 46 | ], 47 | ), 48 | ] 49 | -------------------------------------------------------------------------------- /demo/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielquinn/django-encrypted-filefield/93c78c43205a91ebca93fb82cfcaae1f49cd9e2b/demo/migrations/__init__.py -------------------------------------------------------------------------------- /demo/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | from django_encrypted_filefield.fields import ( 4 | EncryptedFileField, 5 | EncryptedImageField, 6 | ) 7 | 8 | 9 | class MyModel(models.Model): 10 | 11 | name = models.CharField(max_length=128) 12 | attachment = EncryptedFileField(upload_to="attachments") 13 | image = EncryptedImageField( 14 | upload_to="images", 15 | width_field="image_width", 16 | height_field="image_height", 17 | ) 18 | image_width = models.PositiveIntegerField() 19 | image_height = models.PositiveIntegerField() 20 | -------------------------------------------------------------------------------- /demo/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for demo project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.10.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.10/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.10/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | 16 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 17 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 18 | 19 | 20 | # Quick-start development settings - unsuitable for production 21 | # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ 22 | 23 | # Don't use this in production eh? 24 | SECRET_KEY = "#%38#6ma!0q95lg3$*d^az43w$ga_4lcp+y#4*(m9vw#_@9pa1" 25 | 26 | # SECURITY WARNING: don't run with debug turned on in production! 27 | DEBUG = True 28 | 29 | ALLOWED_HOSTS = [] 30 | 31 | 32 | # Application definition 33 | 34 | INSTALLED_APPS = [ 35 | "django.contrib.admin", 36 | "django.contrib.auth", 37 | "django.contrib.contenttypes", 38 | "django.contrib.sessions", 39 | "django.contrib.messages", 40 | "django.contrib.staticfiles", 41 | "demo", 42 | ] 43 | 44 | MIDDLEWARE = [ 45 | "django.middleware.security.SecurityMiddleware", 46 | "django.contrib.sessions.middleware.SessionMiddleware", 47 | "django.middleware.common.CommonMiddleware", 48 | "django.middleware.csrf.CsrfViewMiddleware", 49 | "django.contrib.auth.middleware.AuthenticationMiddleware", 50 | "django.contrib.messages.middleware.MessageMiddleware", 51 | "django.middleware.clickjacking.XFrameOptionsMiddleware", 52 | ] 53 | 54 | ROOT_URLCONF = "demo.urls" 55 | 56 | TEMPLATES = [ 57 | { 58 | "BACKEND": "django.template.backends.django.DjangoTemplates", 59 | "DIRS": [], 60 | "APP_DIRS": True, 61 | "OPTIONS": { 62 | "context_processors": [ 63 | "django.template.context_processors.debug", 64 | "django.template.context_processors.request", 65 | "django.contrib.auth.context_processors.auth", 66 | "django.contrib.messages.context_processors.messages", 67 | ], 68 | }, 69 | }, 70 | ] 71 | 72 | WSGI_APPLICATION = "demo.wsgi.application" 73 | 74 | 75 | # Database 76 | # https://docs.djangoproject.com/en/1.10/ref/settings/#databases 77 | 78 | DATABASES = { 79 | "default": { 80 | "ENGINE": "django.db.backends.sqlite3", 81 | "NAME": os.path.join(BASE_DIR, "db.sqlite3"), 82 | } 83 | } 84 | 85 | 86 | # Password validation 87 | # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators 88 | 89 | AUTH_PASSWORD_VALIDATORS = [ 90 | { 91 | "NAME": "django.contrib.auth.password_validation" 92 | ".UserAttributeSimilarityValidator", 93 | }, 94 | { 95 | "NAME": "django.contrib.auth.password_validation" 96 | ".MinimumLengthValidator", 97 | }, 98 | { 99 | "NAME": "django.contrib.auth.password_validation" 100 | ".CommonPasswordValidator", 101 | }, 102 | { 103 | "NAME": "django.contrib.auth.password_validation" 104 | ".NumericPasswordValidator", 105 | }, 106 | ] 107 | 108 | 109 | # Internationalization 110 | # https://docs.djangoproject.com/en/1.10/topics/i18n/ 111 | 112 | LANGUAGE_CODE = "en-us" 113 | 114 | TIME_ZONE = "UTC" 115 | 116 | USE_I18N = True 117 | 118 | USE_L10N = True 119 | 120 | USE_TZ = True 121 | 122 | 123 | # Static files (CSS, JavaScript, Images) 124 | # https://docs.djangoproject.com/en/1.10/howto/static-files/ 125 | 126 | STATIC_URL = "/static/" 127 | -------------------------------------------------------------------------------- /demo/templates/demo/detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Demo 5 | 22 | 23 | 24 | 25 |

Attachment

26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
Database says{{ object.attachment }}
attachment.url is{{ object.attachment.url }}
36 | 37 |

Image

38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
Database says{{ object.image }}
attachment.url is{{ object.image.url }}
The result
52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /demo/templates/demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Demo 5 | 6 | 7 |
8 | {{ form.as_p }} 9 | {% csrf_token %} 10 | 11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /demo/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from django.contrib import admin 3 | 4 | from django_encrypted_filefield.constants import FETCH_URL_NAME 5 | 6 | from .views import MyDetailView, MyFetchView, MyFormView 7 | 8 | 9 | urlpatterns = [ 10 | url(r"^admin/", admin.site.urls), 11 | url(r"^detail/(?P\d+)$", MyDetailView.as_view(), name="detail"), 12 | url(r"^$", MyFormView.as_view(), name="index"), 13 | # This URL has to exist somewhere with this pattern and this name. The 14 | # view used is up to you. 15 | url(r"^fetch/(?P.+)", MyFetchView.as_view(), name=FETCH_URL_NAME), 16 | ] 17 | -------------------------------------------------------------------------------- /demo/views.py: -------------------------------------------------------------------------------- 1 | from django.urls import reverse 2 | from django.views.generic import CreateView, DetailView 3 | 4 | from django_encrypted_filefield.views import FetchView 5 | 6 | from .forms import MyForm 7 | from .models import MyModel 8 | 9 | 10 | class MyFormView(CreateView): 11 | form_class = MyForm 12 | template_name = "demo/index.html" 13 | 14 | def get_success_url(self): 15 | return reverse("detail", kwargs={"pk": self.object.pk}) 16 | 17 | 18 | class MyDetailView(DetailView): 19 | model = MyModel 20 | template_name = "demo/detail.html" 21 | 22 | 23 | class MyFetchView(FetchView): 24 | """ 25 | This really should be using a mixin like LoginRequiredMixin. See the 26 | parent class for more information. 27 | """ 28 | 29 | pass 30 | -------------------------------------------------------------------------------- /demo/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for demo project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | 15 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demo.settings") 16 | 17 | application = get_wsgi_application() 18 | -------------------------------------------------------------------------------- /django_encrypted_filefield/__init__.py: -------------------------------------------------------------------------------- 1 | from .checks import constants_check, fetch_url_check 2 | -------------------------------------------------------------------------------- /django_encrypted_filefield/admin.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielquinn/django-encrypted-filefield/93c78c43205a91ebca93fb82cfcaae1f49cd9e2b/django_encrypted_filefield/admin.py -------------------------------------------------------------------------------- /django_encrypted_filefield/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class DjangoEncryptedFilefieldsConfig(AppConfig): 5 | name = "django_encrypted_filefield" 6 | -------------------------------------------------------------------------------- /django_encrypted_filefield/checks.py: -------------------------------------------------------------------------------- 1 | from django.core.checks import Error, register 2 | from django.urls import NoReverseMatch, reverse 3 | 4 | from .constants import FETCH_URL_NAME, PASSWORD, SALT 5 | 6 | 7 | @register("deff-constants") 8 | def constants_check(app_configs, **kwargs): 9 | 10 | check_messages = [] 11 | 12 | message = ( 13 | "{} must be defined in your environment for " 14 | "django-encrypted-filefield to work." 15 | ) 16 | 17 | if not SALT: 18 | check_messages.append(Error(message.format("DEFF_SALT"))) 19 | if not PASSWORD: 20 | check_messages.append(Error(message.format("DEFF_PASSWORD"))) 21 | 22 | return check_messages 23 | 24 | 25 | @register("deff-fetch-url") 26 | def fetch_url_check(app_configs, **kwargs): 27 | 28 | if not FETCH_URL_NAME: 29 | return [] # We've got bigger problems 30 | 31 | try: 32 | reverse(FETCH_URL_NAME, kwargs={"path": "anything"}) 33 | except NoReverseMatch: 34 | return [ 35 | Error( 36 | "django-encrypted-filefield requires that you define a url for " 37 | "the fetching the files." 38 | ) 39 | ] 40 | 41 | return [] 42 | -------------------------------------------------------------------------------- /django_encrypted_filefield/constants.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from django.conf import settings 4 | 5 | 6 | def _get_setting(name): 7 | setting_name = "DEFF_{}".format(name) 8 | return os.getenv(setting_name, getattr(settings, setting_name, None)) 9 | 10 | 11 | def get_bytes(v): 12 | 13 | if isinstance(v, str): 14 | return bytes(v.encode("utf-8")) 15 | 16 | if isinstance(v, bytes): 17 | return v 18 | 19 | raise TypeError( 20 | "SALT & PASSWORD must be specified as strings that convert nicely to " 21 | "bytes." 22 | ) 23 | 24 | 25 | SALT = get_bytes(_get_setting("SALT")) 26 | PASSWORD = get_bytes(_get_setting("PASSWORD")) 27 | FETCH_URL_NAME = _get_setting("FETCH_URL_NAME") 28 | -------------------------------------------------------------------------------- /django_encrypted_filefield/crypt.py: -------------------------------------------------------------------------------- 1 | import base64 2 | 3 | from cryptography.fernet import Fernet 4 | from cryptography.hazmat.backends import default_backend 5 | from cryptography.hazmat.primitives import hashes 6 | from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC 7 | 8 | from .constants import PASSWORD, SALT 9 | 10 | 11 | class Cryptographer: 12 | 13 | _fernet = Fernet( 14 | base64.urlsafe_b64encode( 15 | PBKDF2HMAC( 16 | algorithm=hashes.SHA256(), 17 | length=32, 18 | salt=SALT, 19 | iterations=100000, 20 | backend=default_backend(), 21 | ).derive(PASSWORD) 22 | ) 23 | ) 24 | 25 | @classmethod 26 | def encrypted(cls, content): 27 | return cls._fernet.encrypt(content) 28 | 29 | @classmethod 30 | def decrypted(cls, content): 31 | return cls._fernet.decrypt(content) 32 | -------------------------------------------------------------------------------- /django_encrypted_filefield/fields.py: -------------------------------------------------------------------------------- 1 | from io import BytesIO 2 | 3 | from django.db.models.fields.files import ( 4 | FieldFile, 5 | FileField, 6 | ImageField, 7 | ImageFieldFile, 8 | ) 9 | from django.urls import reverse 10 | 11 | from .constants import FETCH_URL_NAME 12 | from .crypt import Cryptographer 13 | 14 | 15 | class EncryptedFile(BytesIO): 16 | def __init__(self, content): 17 | self.size = content.size 18 | BytesIO.__init__(self, Cryptographer.encrypted(content.file.read())) 19 | 20 | 21 | class EncryptionMixin: 22 | def save(self, name, content, save=True): 23 | return super().save(name, EncryptedFile(content), save=save) 24 | 25 | save.alters_data = True 26 | 27 | def _get_url(self): 28 | return reverse(FETCH_URL_NAME, kwargs={"path": super().url}) 29 | 30 | url = property(_get_url) 31 | 32 | 33 | class EncryptedFieldFile(EncryptionMixin, FieldFile): 34 | pass 35 | 36 | 37 | class EncryptedImageFieldFile(EncryptionMixin, ImageFieldFile): 38 | pass 39 | 40 | 41 | class EncryptedFileField(FileField): 42 | attr_class = EncryptedFieldFile 43 | 44 | 45 | class EncryptedImageField(ImageField): 46 | 47 | attr_class = EncryptedImageFieldFile 48 | 49 | def update_dimension_fields(self, instance, force=False, *args, **kwargs): 50 | """ 51 | Since we're encrypting the file, any attempts to force recalculation of 52 | the dimensions will always fail, resulting in a null value for height 53 | and width. To avoid that, we just set force=False all the time and 54 | expect that if you want to change those values, you'll do it on your 55 | own. 56 | """ 57 | ImageField.update_dimension_fields( 58 | self, instance, force=False, *args, **kwargs 59 | ) 60 | -------------------------------------------------------------------------------- /django_encrypted_filefield/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielquinn/django-encrypted-filefield/93c78c43205a91ebca93fb82cfcaae1f49cd9e2b/django_encrypted_filefield/migrations/__init__.py -------------------------------------------------------------------------------- /django_encrypted_filefield/models.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielquinn/django-encrypted-filefield/93c78c43205a91ebca93fb82cfcaae1f49cd9e2b/django_encrypted_filefield/models.py -------------------------------------------------------------------------------- /django_encrypted_filefield/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielquinn/django-encrypted-filefield/93c78c43205a91ebca93fb82cfcaae1f49cd9e2b/django_encrypted_filefield/tests/__init__.py -------------------------------------------------------------------------------- /django_encrypted_filefield/tests/test_constants.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase, override_settings 2 | 3 | from django_encrypted_filefield.constants import _get_setting, get_bytes 4 | 5 | 6 | class ConstantsTestCase(TestCase): 7 | def test_get_bytes_with_string(self): 8 | for s in ("a", "α", ""): 9 | self.assertEqual(get_bytes(s), bytes(s.encode("utf-8"))) 10 | 11 | def test_get_bytes_with_nothing(self): 12 | for s in (None, 0, False, 1, True, lambda _: 1): 13 | self.assertRaises(TypeError, get_bytes, s) 14 | 15 | def test_get_bytes_with_bytes(self): 16 | inputs = ( 17 | bytes("a".encode("utf-8")), 18 | bytes("α".encode("utf-8")), 19 | bytes("".encode("utf-8")), 20 | ) 21 | for s in inputs: 22 | self.assertEqual(get_bytes(s), s) 23 | 24 | @override_settings(DEFF_SALT="salt") 25 | @override_settings(DEFF_PASSWORD="password") 26 | @override_settings(DEFF_FETCH_URL_NAME="fetch") 27 | def test__get_setting_from_settings(self): 28 | self.assertEqual(_get_setting("SALT"), "salt") 29 | self.assertEqual(_get_setting("PASSWORD"), "password") 30 | self.assertEqual(_get_setting("FETCH_URL_NAME"), "fetch") 31 | 32 | def test__get_setting_from_environment(self): 33 | self.assertEqual(_get_setting("SALT"), "salt") 34 | self.assertEqual(_get_setting("PASSWORD"), "password") 35 | self.assertEqual(_get_setting("FETCH_URL_NAME"), "fetch") 36 | 37 | @override_settings(DEFF_SALT="asdf") 38 | @override_settings(DEFF_PASSWORD="asdf") 39 | @override_settings(DEFF_FETCH_URL_NAME="asdf") 40 | def test__get_setting_from_both(self): 41 | self.assertEqual(_get_setting("SALT"), "salt") 42 | self.assertEqual(_get_setting("PASSWORD"), "password") 43 | self.assertEqual(_get_setting("FETCH_URL_NAME"), "fetch") 44 | -------------------------------------------------------------------------------- /django_encrypted_filefield/tests/test_crypt.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | from ..crypt import Cryptographer 4 | 5 | 6 | class CryptographerTestCase(TestCase): 7 | """ 8 | I'm not sure how to test this any better. 9 | """ 10 | 11 | def test_encryption(self): 12 | data = b"This is some data" 13 | self.assertNotEqual(Cryptographer.encrypted(data), data) 14 | 15 | def test_decryption(self): 16 | data = b"This is some data" 17 | self.assertEqual( 18 | Cryptographer.decrypted(Cryptographer.encrypted(data)), data 19 | ) 20 | -------------------------------------------------------------------------------- /django_encrypted_filefield/tests/test_fields.py: -------------------------------------------------------------------------------- 1 | from django.db import connection 2 | from django.test import SimpleTestCase 3 | 4 | from ..fields import EncryptedFileField, EncryptedImageField 5 | 6 | 7 | class TestDbType(SimpleTestCase): 8 | """ 9 | I honestly don't know how to test the remaining bits here. 10 | """ 11 | 12 | def test_db_parameters_respects_db_type_filefield(self): 13 | f = EncryptedFileField() 14 | self.assertEqual(f.db_parameters(connection)["type"], "varchar(100)") 15 | 16 | def test_db_parameters_respects_db_type_imagefilefield(self): 17 | f = EncryptedImageField() 18 | self.assertEqual(f.db_parameters(connection)["type"], "varchar(100)") 19 | -------------------------------------------------------------------------------- /django_encrypted_filefield/tests/test_views.py: -------------------------------------------------------------------------------- 1 | from unittest import mock 2 | 3 | from django.test import TestCase, override_settings 4 | from django.urls import reverse 5 | 6 | 7 | class ViewsTestCase(TestCase): 8 | 9 | GIF = ( 10 | b"GIF87a\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\xff\xff\xff,\x00\x00" 11 | b"\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;" 12 | ) 13 | ENCRYPTED_GIF = ( 14 | b"gAAAAABYfg7U-LcnC9SIDUW5eohDVSRuAo27xk33GO_a2IOFy-HOBQCLRYlpfT4eG9s1" 15 | b"hYyBMiF1YeU1uMkMHMflwsX-nz2vp5dvClW496hHpcXJOLbvJ2pCxAqxCbL0HrJU5WRy" 16 | b"AKu4" 17 | ) 18 | 19 | @override_settings(DEFF_FETCH_URL_NAME="fetch") 20 | @override_settings(MEDIA_ROOT="/tmp") 21 | def test_path_starts_media_root(self): 22 | kwargs = {"path": "/etc/passwd"} 23 | self.assertEqual( 24 | self.client.get(reverse("fetch", kwargs=kwargs)).status_code, 404 25 | ) 26 | 27 | @override_settings(DEFF_FETCH_URL_NAME="fetch") 28 | def test_path_does_not_exist(self): 29 | kwargs = {"path": "this/file/does/not/exist"} 30 | self.assertEqual( 31 | self.client.get(reverse("fetch", kwargs=kwargs)).status_code, 404 32 | ) 33 | 34 | @override_settings(DEFF_FETCH_URL_NAME="fetch") 35 | @mock.patch("django_encrypted_filefield.views.os.path.exists") 36 | @mock.patch( 37 | "django_encrypted_filefield.views.open", 38 | mock.mock_open(read_data=ENCRYPTED_GIF), 39 | create=True, 40 | ) 41 | def test_local_path_exists(self, exists): 42 | exists.return_value = True 43 | kwargs = {"path": "dummy-file"} 44 | response = self.client.get(reverse("fetch", kwargs=kwargs)) 45 | self.assertEqual(response.status_code, 200) 46 | self.assertEqual(response.content, self.GIF) 47 | self.assertEqual(response["Content-Type"], "image/gif") 48 | -------------------------------------------------------------------------------- /django_encrypted_filefield/views.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from django.conf import settings 4 | from django.core.validators import URLValidator, ValidationError 5 | from django.http import Http404, HttpResponse 6 | from django.views.generic import View 7 | 8 | import magic 9 | import requests 10 | 11 | from .crypt import Cryptographer 12 | 13 | 14 | class FetchView(View): 15 | """ 16 | This is a generic, insecure view that effectively undoes any security made 17 | available via this module. To make it useful, you have to subclass it and 18 | make use of your own rules or simply rely on the auth mixins provided by 19 | Django: 20 | 21 | from django.contrib.auth.mixins import LoginRequiredMixin 22 | from django_encrypted_fields.views import FetchView as BaseFetchView 23 | 24 | class FetchView(LoginRequiredMixin, BaseFetchView): 25 | pass 26 | 27 | Using LoginRequiredMixin would effectively allow anyone with a site login 28 | to view *all* files, while using something like StaffRequiredMixin would 29 | mean that only staff members could read the file. 30 | 31 | Theoretically you could also write your view to be smart enough to take the 32 | requested path and match it against a list of permissions, allowing you to 33 | set out per-user permissions whilst still only using one encryption key for 34 | the whole site. 35 | 36 | """ 37 | 38 | def get(self, request, *args, **kwargs): 39 | 40 | path = kwargs.get("path") 41 | 42 | # No path? You're boned. Move along. 43 | if not path: 44 | raise Http404 45 | 46 | if self._is_url(path): 47 | 48 | content = requests.get(path, stream=True).raw.read() 49 | 50 | else: 51 | 52 | # Normalise the path to strip out naughty attempts 53 | path = os.path.normpath(path).replace( 54 | settings.MEDIA_URL, settings.MEDIA_ROOT, 1 55 | ) 56 | 57 | # Evil path request! 58 | if not path.startswith(settings.MEDIA_ROOT): 59 | raise Http404 60 | 61 | # The file requested doesn't exist locally. A legit 404 62 | if not os.path.exists(path): 63 | raise Http404 64 | 65 | with open(path, "rb") as f: 66 | content = f.read() 67 | 68 | content = Cryptographer.decrypted(content) 69 | return HttpResponse( 70 | content, content_type=magic.Magic(mime=True).from_buffer(content) 71 | ) 72 | 73 | @staticmethod 74 | def _is_url(path): 75 | try: 76 | URLValidator()(path) 77 | return True 78 | except ValidationError: 79 | return False 80 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | 6 | if __name__ == "__main__": 7 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demo.settings") 8 | try: 9 | from django.core.management import execute_from_command_line 10 | except ImportError: 11 | # The above import may fail for some other reason. Ensure that the 12 | # issue is really that Django is missing to avoid masking other 13 | # exceptions on Python 2. 14 | try: 15 | import django 16 | except ImportError: 17 | raise ImportError( 18 | "Couldn't import Django. Are you sure it's installed and " 19 | "available on your PYTHONPATH environment variable? Did you " 20 | "forget to activate a virtual environment?" 21 | ) 22 | raise 23 | execute_from_command_line(sys.argv) 24 | -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "appdirs" 3 | version = "1.4.4" 4 | description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." 5 | category = "dev" 6 | optional = false 7 | python-versions = "*" 8 | 9 | [[package]] 10 | name = "asgiref" 11 | version = "3.3.0" 12 | description = "ASGI specs, helper code, and adapters" 13 | category = "main" 14 | optional = false 15 | python-versions = ">=3.5" 16 | 17 | [package.extras] 18 | tests = ["pytest", "pytest-asyncio"] 19 | 20 | [[package]] 21 | name = "black" 22 | version = "20.8b1" 23 | description = "The uncompromising code formatter." 24 | category = "dev" 25 | optional = false 26 | python-versions = ">=3.6" 27 | 28 | [package.extras] 29 | colorama = ["colorama (>=0.4.3)"] 30 | d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] 31 | 32 | [package.dependencies] 33 | appdirs = "*" 34 | click = ">=7.1.2" 35 | mypy-extensions = ">=0.4.3" 36 | pathspec = ">=0.6,<1" 37 | regex = ">=2020.1.8" 38 | toml = ">=0.10.1" 39 | typed-ast = ">=1.4.0" 40 | typing-extensions = ">=3.7.4" 41 | 42 | [package.dependencies.dataclasses] 43 | version = ">=0.6" 44 | python = "<3.7" 45 | 46 | [[package]] 47 | name = "certifi" 48 | version = "2020.6.20" 49 | description = "Python package for providing Mozilla's CA Bundle." 50 | category = "main" 51 | optional = false 52 | python-versions = "*" 53 | 54 | [[package]] 55 | name = "cffi" 56 | version = "1.14.3" 57 | description = "Foreign Function Interface for Python calling C code." 58 | category = "main" 59 | optional = false 60 | python-versions = "*" 61 | 62 | [package.dependencies] 63 | pycparser = "*" 64 | 65 | [[package]] 66 | name = "chardet" 67 | version = "3.0.4" 68 | description = "Universal encoding detector for Python 2 and 3" 69 | category = "main" 70 | optional = false 71 | python-versions = "*" 72 | 73 | [[package]] 74 | name = "click" 75 | version = "7.1.2" 76 | description = "Composable command line interface toolkit" 77 | category = "dev" 78 | optional = false 79 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 80 | 81 | [[package]] 82 | name = "cryptography" 83 | version = "3.2.1" 84 | description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers." 85 | category = "main" 86 | optional = false 87 | python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" 88 | 89 | [package.extras] 90 | docs = ["sphinx (>=1.6.5,<1.8.0 || >1.8.0,<3.1.0 || >3.1.0,<3.1.1 || >3.1.1)", "sphinx-rtd-theme"] 91 | docstest = ["doc8", "pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"] 92 | pep8test = ["black", "flake8", "flake8-import-order", "pep8-naming"] 93 | ssh = ["bcrypt (>=3.1.5)"] 94 | test = ["pytest (>=3.6.0,<3.9.0 || >3.9.0,<3.9.1 || >3.9.1,<3.9.2 || >3.9.2)", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,<3.79.2 || >3.79.2)"] 95 | 96 | [package.dependencies] 97 | cffi = ">=1.8,<1.11.3 || >1.11.3" 98 | six = ">=1.4.1" 99 | 100 | [[package]] 101 | name = "dataclasses" 102 | version = "0.6" 103 | description = "A backport of the dataclasses module for Python 3.6" 104 | category = "dev" 105 | optional = false 106 | python-versions = "*" 107 | marker = "python_version < \"3.7\"" 108 | 109 | [[package]] 110 | name = "django" 111 | version = "3.1.3" 112 | description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." 113 | category = "main" 114 | optional = false 115 | python-versions = ">=3.6" 116 | 117 | [package.extras] 118 | argon2 = ["argon2-cffi (>=16.1.0)"] 119 | bcrypt = ["bcrypt"] 120 | 121 | [package.dependencies] 122 | asgiref = ">=3.2.10,<4" 123 | pytz = "*" 124 | sqlparse = ">=0.2.2" 125 | 126 | [[package]] 127 | name = "idna" 128 | version = "2.10" 129 | description = "Internationalized Domain Names in Applications (IDNA)" 130 | category = "main" 131 | optional = false 132 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 133 | 134 | [[package]] 135 | name = "isort" 136 | version = "5.6.4" 137 | description = "A Python utility / library to sort Python imports." 138 | category = "dev" 139 | optional = false 140 | python-versions = ">=3.6,<4.0" 141 | 142 | [package.extras] 143 | pipfile_deprecated_finder = ["pipreqs", "requirementslib"] 144 | requirements_deprecated_finder = ["pipreqs", "pip-api"] 145 | colors = ["colorama (>=0.4.3,<0.5.0)"] 146 | 147 | [[package]] 148 | name = "mypy-extensions" 149 | version = "0.4.3" 150 | description = "Experimental type system extensions for programs checked with the mypy typechecker." 151 | category = "dev" 152 | optional = false 153 | python-versions = "*" 154 | 155 | [[package]] 156 | name = "pathspec" 157 | version = "0.8.0" 158 | description = "Utility library for gitignore style pattern matching of file paths." 159 | category = "dev" 160 | optional = false 161 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 162 | 163 | [[package]] 164 | name = "pycparser" 165 | version = "2.20" 166 | description = "C parser in Python" 167 | category = "main" 168 | optional = false 169 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 170 | 171 | [[package]] 172 | name = "python-magic" 173 | version = "0.4.18" 174 | description = "File type identification using libmagic" 175 | category = "main" 176 | optional = false 177 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 178 | 179 | [[package]] 180 | name = "pytz" 181 | version = "2020.4" 182 | description = "World timezone definitions, modern and historical" 183 | category = "main" 184 | optional = false 185 | python-versions = "*" 186 | 187 | [[package]] 188 | name = "regex" 189 | version = "2020.10.28" 190 | description = "Alternative regular expression module, to replace re." 191 | category = "dev" 192 | optional = false 193 | python-versions = "*" 194 | 195 | [[package]] 196 | name = "requests" 197 | version = "2.24.0" 198 | description = "Python HTTP for Humans." 199 | category = "main" 200 | optional = false 201 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 202 | 203 | [package.extras] 204 | security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] 205 | socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"] 206 | 207 | [package.dependencies] 208 | certifi = ">=2017.4.17" 209 | chardet = ">=3.0.2,<4" 210 | idna = ">=2.5,<3" 211 | urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26" 212 | 213 | [[package]] 214 | name = "six" 215 | version = "1.15.0" 216 | description = "Python 2 and 3 compatibility utilities" 217 | category = "main" 218 | optional = false 219 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" 220 | 221 | [[package]] 222 | name = "sqlparse" 223 | version = "0.4.1" 224 | description = "A non-validating SQL parser." 225 | category = "main" 226 | optional = false 227 | python-versions = ">=3.5" 228 | 229 | [[package]] 230 | name = "toml" 231 | version = "0.10.2" 232 | description = "Python Library for Tom's Obvious, Minimal Language" 233 | category = "dev" 234 | optional = false 235 | python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" 236 | 237 | [[package]] 238 | name = "typed-ast" 239 | version = "1.4.1" 240 | description = "a fork of Python 2 and 3 ast modules with type comment support" 241 | category = "dev" 242 | optional = false 243 | python-versions = "*" 244 | 245 | [[package]] 246 | name = "typing-extensions" 247 | version = "3.7.4.3" 248 | description = "Backported and Experimental Type Hints for Python 3.5+" 249 | category = "dev" 250 | optional = false 251 | python-versions = "*" 252 | 253 | [[package]] 254 | name = "urllib3" 255 | version = "1.25.11" 256 | description = "HTTP library with thread-safe connection pooling, file post, and more." 257 | category = "main" 258 | optional = false 259 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" 260 | 261 | [package.extras] 262 | brotli = ["brotlipy (>=0.6.0)"] 263 | secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] 264 | socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"] 265 | 266 | [metadata] 267 | lock-version = "1.0" 268 | python-versions = "^3.6" 269 | content-hash = "307c7e55ec6e58c4c5b033c351bb93cdeda62caf8b3c4d1ffcb3bf71ed6e02df" 270 | 271 | [metadata.files] 272 | appdirs = [ 273 | {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, 274 | {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, 275 | ] 276 | asgiref = [ 277 | {file = "asgiref-3.3.0-py3-none-any.whl", hash = "sha256:a5098bc870b80e7b872bff60bb363c7f2c2c89078759f6c47b53ff8c525a152e"}, 278 | {file = "asgiref-3.3.0.tar.gz", hash = "sha256:cd88907ecaec59d78e4ac00ea665b03e571cb37e3a0e37b3702af1a9e86c365a"}, 279 | ] 280 | black = [ 281 | {file = "black-20.8b1-py3-none-any.whl", hash = "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b"}, 282 | {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, 283 | ] 284 | certifi = [ 285 | {file = "certifi-2020.6.20-py2.py3-none-any.whl", hash = "sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"}, 286 | {file = "certifi-2020.6.20.tar.gz", hash = "sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3"}, 287 | ] 288 | cffi = [ 289 | {file = "cffi-1.14.3-2-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:3eeeb0405fd145e714f7633a5173318bd88d8bbfc3dd0a5751f8c4f70ae629bc"}, 290 | {file = "cffi-1.14.3-2-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:cb763ceceae04803adcc4e2d80d611ef201c73da32d8f2722e9d0ab0c7f10768"}, 291 | {file = "cffi-1.14.3-2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:44f60519595eaca110f248e5017363d751b12782a6f2bd6a7041cba275215f5d"}, 292 | {file = "cffi-1.14.3-2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c53af463f4a40de78c58b8b2710ade243c81cbca641e34debf3396a9640d6ec1"}, 293 | {file = "cffi-1.14.3-2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:33c6cdc071ba5cd6d96769c8969a0531be2d08c2628a0143a10a7dcffa9719ca"}, 294 | {file = "cffi-1.14.3-2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c11579638288e53fc94ad60022ff1b67865363e730ee41ad5e6f0a17188b327a"}, 295 | {file = "cffi-1.14.3-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:3cb3e1b9ec43256c4e0f8d2837267a70b0e1ca8c4f456685508ae6106b1f504c"}, 296 | {file = "cffi-1.14.3-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:f0620511387790860b249b9241c2f13c3a80e21a73e0b861a2df24e9d6f56730"}, 297 | {file = "cffi-1.14.3-cp27-cp27m-win32.whl", hash = "sha256:005f2bfe11b6745d726dbb07ace4d53f057de66e336ff92d61b8c7e9c8f4777d"}, 298 | {file = "cffi-1.14.3-cp27-cp27m-win_amd64.whl", hash = "sha256:2f9674623ca39c9ebe38afa3da402e9326c245f0f5ceff0623dccdac15023e05"}, 299 | {file = "cffi-1.14.3-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:09e96138280241bd355cd585148dec04dbbedb4f46128f340d696eaafc82dd7b"}, 300 | {file = "cffi-1.14.3-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:3363e77a6176afb8823b6e06db78c46dbc4c7813b00a41300a4873b6ba63b171"}, 301 | {file = "cffi-1.14.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:0ef488305fdce2580c8b2708f22d7785ae222d9825d3094ab073e22e93dfe51f"}, 302 | {file = "cffi-1.14.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:0b1ad452cc824665ddc682400b62c9e4f5b64736a2ba99110712fdee5f2505c4"}, 303 | {file = "cffi-1.14.3-cp35-cp35m-win32.whl", hash = "sha256:85ba797e1de5b48aa5a8427b6ba62cf69607c18c5d4eb747604b7302f1ec382d"}, 304 | {file = "cffi-1.14.3-cp35-cp35m-win_amd64.whl", hash = "sha256:e66399cf0fc07de4dce4f588fc25bfe84a6d1285cc544e67987d22663393926d"}, 305 | {file = "cffi-1.14.3-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:15f351bed09897fbda218e4db5a3d5c06328862f6198d4fb385f3e14e19decb3"}, 306 | {file = "cffi-1.14.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4d7c26bfc1ea9f92084a1d75e11999e97b62d63128bcc90c3624d07813c52808"}, 307 | {file = "cffi-1.14.3-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:23e5d2040367322824605bc29ae8ee9175200b92cb5483ac7d466927a9b3d537"}, 308 | {file = "cffi-1.14.3-cp36-cp36m-win32.whl", hash = "sha256:a624fae282e81ad2e4871bdb767e2c914d0539708c0f078b5b355258293c98b0"}, 309 | {file = "cffi-1.14.3-cp36-cp36m-win_amd64.whl", hash = "sha256:de31b5164d44ef4943db155b3e8e17929707cac1e5bd2f363e67a56e3af4af6e"}, 310 | {file = "cffi-1.14.3-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:f92cdecb618e5fa4658aeb97d5eb3d2f47aa94ac6477c6daf0f306c5a3b9e6b1"}, 311 | {file = "cffi-1.14.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:22399ff4870fb4c7ef19fff6eeb20a8bbf15571913c181c78cb361024d574579"}, 312 | {file = "cffi-1.14.3-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:f4eae045e6ab2bb54ca279733fe4eb85f1effda392666308250714e01907f394"}, 313 | {file = "cffi-1.14.3-cp37-cp37m-win32.whl", hash = "sha256:b0358e6fefc74a16f745afa366acc89f979040e0cbc4eec55ab26ad1f6a9bfbc"}, 314 | {file = "cffi-1.14.3-cp37-cp37m-win_amd64.whl", hash = "sha256:6642f15ad963b5092d65aed022d033c77763515fdc07095208f15d3563003869"}, 315 | {file = "cffi-1.14.3-cp38-cp38-manylinux1_i686.whl", hash = "sha256:2791f68edc5749024b4722500e86303a10d342527e1e3bcac47f35fbd25b764e"}, 316 | {file = "cffi-1.14.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:529c4ed2e10437c205f38f3691a68be66c39197d01062618c55f74294a4a4828"}, 317 | {file = "cffi-1.14.3-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:8f0f1e499e4000c4c347a124fa6a27d37608ced4fe9f7d45070563b7c4c370c9"}, 318 | {file = "cffi-1.14.3-cp38-cp38-win32.whl", hash = "sha256:3b8eaf915ddc0709779889c472e553f0d3e8b7bdf62dab764c8921b09bf94522"}, 319 | {file = "cffi-1.14.3-cp38-cp38-win_amd64.whl", hash = "sha256:bbd2f4dfee1079f76943767fce837ade3087b578aeb9f69aec7857d5bf25db15"}, 320 | {file = "cffi-1.14.3-cp39-cp39-manylinux1_i686.whl", hash = "sha256:cc75f58cdaf043fe6a7a6c04b3b5a0e694c6a9e24050967747251fb80d7bce0d"}, 321 | {file = "cffi-1.14.3-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:bf39a9e19ce7298f1bd6a9758fa99707e9e5b1ebe5e90f2c3913a47bc548747c"}, 322 | {file = "cffi-1.14.3-cp39-cp39-win32.whl", hash = "sha256:d80998ed59176e8cba74028762fbd9b9153b9afc71ea118e63bbf5d4d0f9552b"}, 323 | {file = "cffi-1.14.3-cp39-cp39-win_amd64.whl", hash = "sha256:c150eaa3dadbb2b5339675b88d4573c1be3cb6f2c33a6c83387e10cc0bf05bd3"}, 324 | {file = "cffi-1.14.3.tar.gz", hash = "sha256:f92f789e4f9241cd262ad7a555ca2c648a98178a953af117ef7fad46aa1d5591"}, 325 | ] 326 | chardet = [ 327 | {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, 328 | {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, 329 | ] 330 | click = [ 331 | {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, 332 | {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, 333 | ] 334 | cryptography = [ 335 | {file = "cryptography-3.2.1-cp27-cp27m-macosx_10_10_x86_64.whl", hash = "sha256:6dc59630ecce8c1f558277ceb212c751d6730bd12c80ea96b4ac65637c4f55e7"}, 336 | {file = "cryptography-3.2.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:75e8e6684cf0034f6bf2a97095cb95f81537b12b36a8fedf06e73050bb171c2d"}, 337 | {file = "cryptography-3.2.1-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:4e7268a0ca14536fecfdf2b00297d4e407da904718658c1ff1961c713f90fd33"}, 338 | {file = "cryptography-3.2.1-cp27-cp27m-win32.whl", hash = "sha256:7117319b44ed1842c617d0a452383a5a052ec6aa726dfbaffa8b94c910444297"}, 339 | {file = "cryptography-3.2.1-cp27-cp27m-win_amd64.whl", hash = "sha256:a733671100cd26d816eed39507e585c156e4498293a907029969234e5e634bc4"}, 340 | {file = "cryptography-3.2.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:a75f306a16d9f9afebfbedc41c8c2351d8e61e818ba6b4c40815e2b5740bb6b8"}, 341 | {file = "cryptography-3.2.1-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:5849d59358547bf789ee7e0d7a9036b2d29e9a4ddf1ce5e06bb45634f995c53e"}, 342 | {file = "cryptography-3.2.1-cp35-abi3-macosx_10_10_x86_64.whl", hash = "sha256:bd717aa029217b8ef94a7d21632a3bb5a4e7218a4513d2521c2a2fd63011e98b"}, 343 | {file = "cryptography-3.2.1-cp35-abi3-manylinux1_x86_64.whl", hash = "sha256:efe15aca4f64f3a7ea0c09c87826490e50ed166ce67368a68f315ea0807a20df"}, 344 | {file = "cryptography-3.2.1-cp35-abi3-manylinux2010_x86_64.whl", hash = "sha256:32434673d8505b42c0de4de86da8c1620651abd24afe91ae0335597683ed1b77"}, 345 | {file = "cryptography-3.2.1-cp35-abi3-manylinux2014_aarch64.whl", hash = "sha256:7b8d9d8d3a9bd240f453342981f765346c87ade811519f98664519696f8e6ab7"}, 346 | {file = "cryptography-3.2.1-cp35-cp35m-win32.whl", hash = "sha256:d3545829ab42a66b84a9aaabf216a4dce7f16dbc76eb69be5c302ed6b8f4a29b"}, 347 | {file = "cryptography-3.2.1-cp35-cp35m-win_amd64.whl", hash = "sha256:a4e27ed0b2504195f855b52052eadcc9795c59909c9d84314c5408687f933fc7"}, 348 | {file = "cryptography-3.2.1-cp36-abi3-win32.whl", hash = "sha256:13b88a0bd044b4eae1ef40e265d006e34dbcde0c2f1e15eb9896501b2d8f6c6f"}, 349 | {file = "cryptography-3.2.1-cp36-abi3-win_amd64.whl", hash = "sha256:07ca431b788249af92764e3be9a488aa1d39a0bc3be313d826bbec690417e538"}, 350 | {file = "cryptography-3.2.1-cp36-cp36m-win32.whl", hash = "sha256:a035a10686532b0587d58a606004aa20ad895c60c4d029afa245802347fab57b"}, 351 | {file = "cryptography-3.2.1-cp36-cp36m-win_amd64.whl", hash = "sha256:d26a2557d8f9122f9bf445fc7034242f4375bd4e95ecda007667540270965b13"}, 352 | {file = "cryptography-3.2.1-cp37-cp37m-win32.whl", hash = "sha256:545a8550782dda68f8cdc75a6e3bf252017aa8f75f19f5a9ca940772fc0cb56e"}, 353 | {file = "cryptography-3.2.1-cp37-cp37m-win_amd64.whl", hash = "sha256:55d0b896631412b6f0c7de56e12eb3e261ac347fbaa5d5e705291a9016e5f8cb"}, 354 | {file = "cryptography-3.2.1-cp38-cp38-win32.whl", hash = "sha256:3cd75a683b15576cfc822c7c5742b3276e50b21a06672dc3a800a2d5da4ecd1b"}, 355 | {file = "cryptography-3.2.1-cp38-cp38-win_amd64.whl", hash = "sha256:d25cecbac20713a7c3bc544372d42d8eafa89799f492a43b79e1dfd650484851"}, 356 | {file = "cryptography-3.2.1.tar.gz", hash = "sha256:d3d5e10be0cf2a12214ddee45c6bd203dab435e3d83b4560c03066eda600bfe3"}, 357 | ] 358 | dataclasses = [ 359 | {file = "dataclasses-0.6-py3-none-any.whl", hash = "sha256:454a69d788c7fda44efd71e259be79577822f5e3f53f029a22d08004e951dc9f"}, 360 | {file = "dataclasses-0.6.tar.gz", hash = "sha256:6988bd2b895eef432d562370bb707d540f32f7360ab13da45340101bc2307d84"}, 361 | ] 362 | django = [ 363 | {file = "Django-3.1.3-py3-none-any.whl", hash = "sha256:14a4b7cd77297fba516fc0d92444cc2e2e388aa9de32d7a68d4a83d58f5a4927"}, 364 | {file = "Django-3.1.3.tar.gz", hash = "sha256:14b87775ffedab2ef6299b73343d1b4b41e5d4e2aa58c6581f114dbec01e3f8f"}, 365 | ] 366 | idna = [ 367 | {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"}, 368 | {file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"}, 369 | ] 370 | isort = [ 371 | {file = "isort-5.6.4-py3-none-any.whl", hash = "sha256:dcab1d98b469a12a1a624ead220584391648790275560e1a43e54c5dceae65e7"}, 372 | {file = "isort-5.6.4.tar.gz", hash = "sha256:dcaeec1b5f0eca77faea2a35ab790b4f3680ff75590bfcb7145986905aab2f58"}, 373 | ] 374 | mypy-extensions = [ 375 | {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, 376 | {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, 377 | ] 378 | pathspec = [ 379 | {file = "pathspec-0.8.0-py2.py3-none-any.whl", hash = "sha256:7d91249d21749788d07a2d0f94147accd8f845507400749ea19c1ec9054a12b0"}, 380 | {file = "pathspec-0.8.0.tar.gz", hash = "sha256:da45173eb3a6f2a5a487efba21f050af2b41948be6ab52b6a1e3ff22bb8b7061"}, 381 | ] 382 | pycparser = [ 383 | {file = "pycparser-2.20-py2.py3-none-any.whl", hash = "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705"}, 384 | {file = "pycparser-2.20.tar.gz", hash = "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"}, 385 | ] 386 | python-magic = [ 387 | {file = "python-magic-0.4.18.tar.gz", hash = "sha256:b757db2a5289ea3f1ced9e60f072965243ea43a2221430048fd8cacab17be0ce"}, 388 | {file = "python_magic-0.4.18-py2.py3-none-any.whl", hash = "sha256:356efa93c8899047d1eb7d3eb91e871ba2f5b1376edbaf4cc305e3c872207355"}, 389 | ] 390 | pytz = [ 391 | {file = "pytz-2020.4-py2.py3-none-any.whl", hash = "sha256:5c55e189b682d420be27c6995ba6edce0c0a77dd67bfbe2ae6607134d5851ffd"}, 392 | {file = "pytz-2020.4.tar.gz", hash = "sha256:3e6b7dd2d1e0a59084bcee14a17af60c5c562cdc16d828e8eba2e683d3a7e268"}, 393 | ] 394 | regex = [ 395 | {file = "regex-2020.10.28-cp27-cp27m-win32.whl", hash = "sha256:4b5a9bcb56cc146c3932c648603b24514447eafa6ce9295234767bf92f69b504"}, 396 | {file = "regex-2020.10.28-cp27-cp27m-win_amd64.whl", hash = "sha256:c13d311a4c4a8d671f5860317eb5f09591fbe8259676b86a85769423b544451e"}, 397 | {file = "regex-2020.10.28-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:c8a2b7ccff330ae4c460aff36626f911f918555660cc28163417cb84ffb25789"}, 398 | {file = "regex-2020.10.28-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4afa350f162551cf402bfa3cd8302165c8e03e689c897d185f16a167328cc6dd"}, 399 | {file = "regex-2020.10.28-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:b88fa3b8a3469f22b4f13d045d9bd3eda797aa4e406fde0a2644bc92bbdd4bdd"}, 400 | {file = "regex-2020.10.28-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:f43109822df2d3faac7aad79613f5f02e4eab0fc8ad7932d2e70e2a83bd49c26"}, 401 | {file = "regex-2020.10.28-cp36-cp36m-win32.whl", hash = "sha256:8092a5a06ad9a7a247f2a76ace121183dc4e1a84c259cf9c2ce3bbb69fac3582"}, 402 | {file = "regex-2020.10.28-cp36-cp36m-win_amd64.whl", hash = "sha256:49461446b783945597c4076aea3f49aee4b4ce922bd241e4fcf62a3e7c61794c"}, 403 | {file = "regex-2020.10.28-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:8ca9dca965bd86ea3631b975d63b0693566d3cc347e55786d5514988b6f5b84c"}, 404 | {file = "regex-2020.10.28-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ea37320877d56a7f0a1e6a625d892cf963aa7f570013499f5b8d5ab8402b5625"}, 405 | {file = "regex-2020.10.28-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:3a5f08039eee9ea195a89e180c5762bfb55258bfb9abb61a20d3abee3b37fd12"}, 406 | {file = "regex-2020.10.28-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:cb905f3d2e290a8b8f1579d3984f2cfa7c3a29cc7cba608540ceeed18513f520"}, 407 | {file = "regex-2020.10.28-cp37-cp37m-win32.whl", hash = "sha256:a62162be05edf64f819925ea88d09d18b09bebf20971b363ce0c24e8b4aa14c0"}, 408 | {file = "regex-2020.10.28-cp37-cp37m-win_amd64.whl", hash = "sha256:03855ee22980c3e4863dc84c42d6d2901133362db5daf4c36b710dd895d78f0a"}, 409 | {file = "regex-2020.10.28-cp38-cp38-manylinux1_i686.whl", hash = "sha256:625116aca6c4b57c56ea3d70369cacc4d62fead4930f8329d242e4fe7a58ce4b"}, 410 | {file = "regex-2020.10.28-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2dc522e25e57e88b4980d2bdd334825dbf6fa55f28a922fc3bfa60cc09e5ef53"}, 411 | {file = "regex-2020.10.28-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:119e0355dbdd4cf593b17f2fc5dbd4aec2b8899d0057e4957ba92f941f704bf5"}, 412 | {file = "regex-2020.10.28-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:cfcf28ed4ce9ced47b9b9670a4f0d3d3c0e4d4779ad4dadb1ad468b097f808aa"}, 413 | {file = "regex-2020.10.28-cp38-cp38-win32.whl", hash = "sha256:06b52815d4ad38d6524666e0d50fe9173533c9cc145a5779b89733284e6f688f"}, 414 | {file = "regex-2020.10.28-cp38-cp38-win_amd64.whl", hash = "sha256:c3466a84fce42c2016113101018a9981804097bacbab029c2d5b4fcb224b89de"}, 415 | {file = "regex-2020.10.28-cp39-cp39-manylinux1_i686.whl", hash = "sha256:c2c6c56ee97485a127555c9595c069201b5161de9d05495fbe2132b5ac104786"}, 416 | {file = "regex-2020.10.28-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:1ec66700a10e3c75f1f92cbde36cca0d3aaee4c73dfa26699495a3a30b09093c"}, 417 | {file = "regex-2020.10.28-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:11116d424734fe356d8777f89d625f0df783251ada95d6261b4c36ad27a394bb"}, 418 | {file = "regex-2020.10.28-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f1fce1e4929157b2afeb4bb7069204d4370bab9f4fc03ca1fbec8bd601f8c87d"}, 419 | {file = "regex-2020.10.28-cp39-cp39-win32.whl", hash = "sha256:832339223b9ce56b7b15168e691ae654d345ac1635eeb367ade9ecfe0e66bee0"}, 420 | {file = "regex-2020.10.28-cp39-cp39-win_amd64.whl", hash = "sha256:654c1635f2313d0843028487db2191530bca45af61ca85d0b16555c399625b0e"}, 421 | {file = "regex-2020.10.28.tar.gz", hash = "sha256:dd3e6547ecf842a29cf25123fbf8d2461c53c8d37aa20d87ecee130c89b7079b"}, 422 | ] 423 | requests = [ 424 | {file = "requests-2.24.0-py2.py3-none-any.whl", hash = "sha256:fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"}, 425 | {file = "requests-2.24.0.tar.gz", hash = "sha256:b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b"}, 426 | ] 427 | six = [ 428 | {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, 429 | {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, 430 | ] 431 | sqlparse = [ 432 | {file = "sqlparse-0.4.1-py3-none-any.whl", hash = "sha256:017cde379adbd6a1f15a61873f43e8274179378e95ef3fede90b5aa64d304ed0"}, 433 | {file = "sqlparse-0.4.1.tar.gz", hash = "sha256:0f91fd2e829c44362cbcfab3e9ae12e22badaa8a29ad5ff599f9ec109f0454e8"}, 434 | ] 435 | toml = [ 436 | {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, 437 | {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, 438 | ] 439 | typed-ast = [ 440 | {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"}, 441 | {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb"}, 442 | {file = "typed_ast-1.4.1-cp35-cp35m-win32.whl", hash = "sha256:0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919"}, 443 | {file = "typed_ast-1.4.1-cp35-cp35m-win_amd64.whl", hash = "sha256:4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01"}, 444 | {file = "typed_ast-1.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75"}, 445 | {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652"}, 446 | {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"}, 447 | {file = "typed_ast-1.4.1-cp36-cp36m-win32.whl", hash = "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1"}, 448 | {file = "typed_ast-1.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa"}, 449 | {file = "typed_ast-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614"}, 450 | {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41"}, 451 | {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b"}, 452 | {file = "typed_ast-1.4.1-cp37-cp37m-win32.whl", hash = "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe"}, 453 | {file = "typed_ast-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355"}, 454 | {file = "typed_ast-1.4.1-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6"}, 455 | {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907"}, 456 | {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d"}, 457 | {file = "typed_ast-1.4.1-cp38-cp38-win32.whl", hash = "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c"}, 458 | {file = "typed_ast-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4"}, 459 | {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34"}, 460 | {file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"}, 461 | ] 462 | typing-extensions = [ 463 | {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"}, 464 | {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"}, 465 | {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"}, 466 | ] 467 | urllib3 = [ 468 | {file = "urllib3-1.25.11-py2.py3-none-any.whl", hash = "sha256:f5321fbe4bf3fefa0efd0bfe7fb14e90909eb62a48ccda331726b4319897dd5e"}, 469 | {file = "urllib3-1.25.11.tar.gz", hash = "sha256:8d7eaa5a82a1cac232164990f04874c594c9453ec55eef02eab885aa02fc17a2"}, 470 | ] 471 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "django-encrypted-filefield" 3 | version = "0.3.0" 4 | homepage = "https://github.com/danielquinn/django-encrypted-filefield" 5 | repository = "https://github.com/danielquinn/django-encrypted-filefield" 6 | description = "Encrypt uploaded files, store them wherever you like and stream them back unencrypted" 7 | authors = ["Daniel Quinn "] 8 | license = "GPL-3.0-or-later" 9 | classifiers = [ 10 | "Operating System :: POSIX", 11 | "Operating System :: Unix", 12 | "Programming Language :: Python", 13 | "Programming Language :: Python :: 2.7", 14 | "Programming Language :: Python :: 3.4", 15 | "Programming Language :: Python :: 3.5", 16 | "Programming Language :: Python :: 3.6", 17 | "Topic :: Internet :: WWW/HTTP", 18 | ] 19 | 20 | 21 | [tool.poetry.dependencies] 22 | python = "^3.6" 23 | cryptography = ">=1.7.1" 24 | requests = ">=2.12.4" 25 | python-magic = ">=0.4.12,<0.5.0" 26 | django = ">=2.2" 27 | 28 | 29 | [tool.poetry.dev-dependencies] 30 | black = "^20.8b1" 31 | isort = "^5.6.4" 32 | 33 | 34 | [build-system] 35 | requires = ["poetry>=0.12"] 36 | build-backend = "poetry.masonry.api" 37 | 38 | 39 | [tool.coverage.run] 40 | branch = true 41 | omit = ["tests.py"] 42 | 43 | 44 | [tool.coverage.report] 45 | ignore_errors = true 46 | exclude_lines = [ 47 | "pragma: no cover", 48 | "raise NotImplementedError" 49 | ] 50 | 51 | 52 | [tool.isort] 53 | atomic = true 54 | multi_line_output = 3 55 | case_sensitive = true 56 | lines_after_imports = 2 57 | lines_between_types = 1 58 | combine_as_imports = true 59 | default_section = "THIRDPARTY" 60 | known_django = "django" 61 | line_length = 79 62 | include_trailing_comma = true 63 | sections=[ 64 | "FUTURE", 65 | "STDLIB", 66 | "DJANGO", 67 | "THIRDPARTY", 68 | "FIRSTPARTY", 69 | "LOCALFOLDER" 70 | ] 71 | 72 | 73 | [tool.black] 74 | line-length = 79 75 | target-version = ['py36'] 76 | include = '\.pyi?$' 77 | exclude = '/(\.eggs|\.git|_build|build|dist)/' --------------------------------------------------------------------------------