This is a free-to-use javascript drop-in to secure your website. It adds a browser cache to an IndexedDB for every rendered webpage. Pages rendered less than 30 minutes ago are served as an encrypted cache that cannot be modified by the browser.
- Download cycache.js
- Add to web project (e.g.,
/js/security/cycache.js
) - Include in your HTML before any other scripts:
<head>
<!-- Existing meta tags -->
<script src="/js/security/cycache.js"></script>
</head>
Feature | Protection Level | Impact |
---|---|---|
Encrypted Caching | Critical | Prevents cache transit manipulation |
Cache Expiration | High | Inhibits cache at rest attacks |
Navigation Interception | High | Complicates navigation events |
- Opt-out Mechanism:
- Add
data-no-cache
attribute to links/forms to bypass cache interceptions- Example 1:
<a href="/about.html">About Us</a> <!-- Will serve cache -->
- Example 2:
<a href="/secure-page.html" data-no-cache>Secure Page</a><!-- Will not serve cached -->
- Example 1:
- Minimal runtime overhead (< 2ms initialization)
- Zero ongoing CPU usage during idle
- Processing latency only during decryption
-
Key Management: The encryption key is hardcoded to interface with our browser extensions. If using your own key, please make sure you:
- Generate a custom 16-character key for AES-128 here
- Rotate keys periodically
-
Sensitive Data: Never cache pages containing sensitive information:
- User profiles
- Payment pages
- Admin interfaces
-
Cache Validation: Add cache validation logic for dynamic content:
// Example validation logic if (url.includes('/dashboard')) { return null; // Never cache dashboard }
This solution works in modern browsers with:
- IndexedDB support
- Web Crypto API support
- Async/await support
- This implementation intercepts navigation within the same origin only
- Form submissions are intercepted but not cached
- Always test before going live with this drop-in
Critical Note: This script supplements but doesn't replace server-side security. Always implement backend caching mechanisms like OPcache and a Web Application Firewall (WAF).
Send me a pull request!
Visit https://cydogbrowser.com