a linter and pre-commit hook to check SRI-hashes in HTML files
Project description
sri-checker
A code formatter to add double indentation to function and method definitions.
Installation
pip install sri-checker
usage
usage: sri-checker [-h] [filenames ...]
positional arguments:
filenames
options:
-h, --help show this help message and exit
pre-commit hook
See pre-commit for instructions
Sample .pre-commit-config.yaml
:
- repo: https://github.com/jkittner/sri-checker
rev: 0.1.1
hooks:
- id: sri-checker
If you are using public CDNs in any of your html-files and pre-commit.ci, you have to add this section to your .pre-commit-config.yaml
since there is no access to the internet during setup or runtime in pre-commit.ci
ci:
skip: [sri-checker]
Example
With an html-file base.html
:
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"
/>
sri-checker base.html
This will return an error end exit with 1
.
base.html:1 SRI-hash incorrect
expected: sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN
got: sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL
Contents can also be passed via stdin:
cat base.html | sri-checker -
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sri_checker-0.1.1.tar.gz
.
File metadata
- Download URL: sri_checker-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7200b0ab2c018920585a4e4a8de3e8680e9dc619dd26cee5575355557a4f71a4 |
|
MD5 | 43e093e555d129578be565322068e022 |
|
BLAKE2b-256 | 767db46351f0aa82caaa19e79416f1ae9ba54c5839781141dbf5c9c780be8586 |
File details
Details for the file sri_checker-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: sri_checker-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3fed7dbdd7bcb6570ad9c8f4ad3ac5dddf3385852ca8bd66bfb97e5ace0bc19 |
|
MD5 | 6cca935a5f14c4173752f22069e6f173 |
|
BLAKE2b-256 | 2384ef1ff02ebd016bd0775ef6a7c8fba820d8693ed5a81f9eeedf2285ec313e |