| Crates.io | sric |
| lib.rs | sric |
| version | 0.1.0 |
| created_at | 2025-08-20 03:41:13.130824+00 |
| updated_at | 2025-08-20 03:41:13.130824+00 |
| description | A Rust CLI tool that automatically generates Subresource Integrity (SRI) hashes for HTML files |
| homepage | https://github.com/boaz-yaniv/sric |
| repository | https://github.com/boaz-yaniv/sric |
| max_upload_size | |
| id | 1802828 |
| size | 51,067 |
A Rust CLI tool that automatically generates Subresource Integrity (SRI) hashes for HTML files. SRIC parses HTML documents, identifies external resources (scripts and stylesheets), fetches them over HTTP, and adds integrity attributes with SHA-384 hashes.
cargo install --path .
# Output to stdout
cargo run -- <html-file>
# Modify file in-place
cargo run -- <html-file> -w
# Write to specific output file
cargo run -- <html-file> -o <output-file>
# Override existing SRI hashes
cargo run -- <html-file> --force
# Generate SRI hashes and print to stdout
cargo run -- index.html
# Update index.html in-place with SRI hashes
cargo run -- index.html -w
# Save output to a new file
cargo run -- index.html -o index-with-sri.html
# Build the project
cargo build
# Run tests
cargo test
# Check for compilation errors
cargo check
# Run linter (if installed)
cargo clippy
# Format code (if installed)
cargo fmt
main.rs - CLI argument parsing and orchestrationparse_html.rs - HTML parsing using html5evergenerate_sri.rs - Core SRI generation logicwrite_html.rs - HTML serializationnode_iter.rs - DOM traversal utilitieselement.rs - Element operationsmime_ext.rs - MIME type validationresponse_ext.rs - HTTP response processinghtml5ever + markup5ever_rcdom - HTML parsing and DOM manipulationureq - HTTP client for fetching resourcessha2 + base64 - Cryptographic hashingclap + clio - CLI interface and file I/Omime + mime_guess - Content type validation<script> tags with src and <link> tags with rel="stylesheet|preload|modulepreload"integrity attribute with sha384-<hash> format