This package contains a django template parser that can be used to find templates
that contain variables that will not be escaped. This package currently has
no knowledge of custom filters, custom tags, and python code (e.g. uses of
mark safe). The code has only been tested against django versions >= 1.5 and <= 1.7.
## Requirements
* django >= 1.5 and < 1.8
* lxml
## Usage
This package can be used on the command line by running
> `python -m django_xss_detection.cli`
## How does it work?
The code works by monkey patching django template code and providing through
a callback function to VariableNode that ends up referring to the
`CompileStringWrapper.handle_callback` method. The callback function is used
later when the code `renders` a given template and encounters a variable node
that will not be escaped. The implementation of detecting unquoted variable nodes
in element attributes and variable nodes in a javascript context lacking
javascript escaping are not implemented through callbacks, see
`get_non_quoted_attr_vars_for_template` and
`get_non_js_escaped_results_for_template` in parse_template.py respectively.
Additionally, the code has modified versions of built in conditional tags,
such as `{% if %}` and `{% ifequal %}`, so as to `render` all possible template
code. If this package does not work on your custom template tags then
you can add support for them similar to how `waffle` template tags are
implemented (see `templatetags/waffle.py` and the `patch` method in `util.py`).
Metadata
Release files for django-xss-detection 0.4.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-xss-detection-0.4.17.tar.gz | 11.5 kB | Without provenance | Details |
Release files / django-xss-detection-0.4.17.tar.gz
| Download URL | django-xss-detection-0.4.17.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2405953534fa3e73c22e8d93def5f7c6e37839076b38ef527144aa4f6bf49298
|
|
BLAKE2b-256 checksum How to use checksums |
952d707b9414f40492800a22fef2f5171c556c87de39f4927781c400d8501dcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-xss-detection 0.4.17
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.