JS Time Machine¶
What is the JS Time Machine?¶
CSP Integrity reports the hash of every script the browser loads on your pages. That hash is a fingerprint of the exact file, so when a script changes, its fingerprint changes with it.
The JS Time Machine turns those reports into the history of a script. Give it a script URL and a period, and it lists every version your visitors loaded: each fingerprint, when it was last seen, how many reports recorded it, and when we first processed a report for it.
That answers the questions that come up after a change or an incident:
- What changed, and when? See the version that was live before a change and the one that replaced it.
- Was this version on our site last month? Search the month and see whether its fingerprint appears.
- How long was a bad version live? The first and last times a fingerprint was seen bracket its exposure.
- Is everyone getting the same file? Several versions live in the same hour can mean a staged rollout, a CDN serving mixed builds, or a file that is being tampered with for some visitors only.
The JS Time Machine is included with CSP Integrity, so any plan with CSP Integrity has it.
Getting there¶
In your account, go to CSP Integrity → JS Time Machine.
You can also jump straight to a script's history from the places you already see it:
- CSP Integrity Reports. Each script has a history button next to its fingerprint. It opens the time machine on that script, for the same hour, day or month you were viewing, with that version highlighted.
- Script Watch. Each script URL on the inspect page has the same button. It opens the time machine on the month the script was last seen.
Searching¶
Enter a script URL, choose a period, and search.
| Period | What it searches |
|---|---|
| Hours | One hour |
| Days | One day |
| Months | One month (the default, starting on the current month) |
| All retained | Every month of reports your plan lets you see |
Results list each version of the script, most recently seen first:
| Column | Meaning |
|---|---|
| Fingerprint | The hash the browser reported. If the file is in our database of known JavaScript files, it is shown with the library name and version, as on the Reports page. |
| Last seen | The most recent report for this version in the period. |
| Count | How many stored reports recorded this version in the period. |
| First processed | The first time we processed a report for this version in the period. |
| View | Opens the CSP Integrity Reports page filtered to this version, so you can see which pages loaded it. |
Times are shown in your browser's time zone. A search is an ordinary URL, so you can bookmark it or share it with your team.
Search tips¶
The query string is ignored. app.js?v=1 and app.js?v=2 are treated as the same script, so a cache-busting parameter does not split one script's history in two.
End the URL with * to search by prefix. Some scripts put their version in the path, so every version lives at a different URL. Ending the search with * includes every path that starts with what comes before it:
static.cloudflareinsights.com/beacon.min.js/*
With a prefix search, each version also lists the paths it was seen at.
Times are when we processed each report, not when the browser sent it. The two are normally seconds apart.
Large searches¶
A busy site can hold a very large number of CSP Integrity reports in a month. If a period holds too many to search in one go, the search stops part-way and tells you so. The versions it shows are real, but there may be others. Pick a day or an hour within that period to see every version.
When a script has more than 30 versions in the period, the 30 most recently seen are shown. Pick a shorter period to see the rest.
What it can and can't see¶
The JS Time Machine is built from your CSP Integrity reports, so it sees what they see.
- Only scripts that loaded. Browsers send integrity metadata for scripts that ran. A script blocked by your policy has no fingerprint to report.
- Only stored reports. CSP Integrity reports are sampled by default, and only the accepted reports are stored. A busy script will show every version it served; a version that was live for a handful of page views may not have been sampled. Raise the sample rate on pages where that matters.
- Only reports we still hold. History goes back as far as your plan's data retention. The page tells you when an older period is outside it.
Start Monitoring with Report URI¶
Already collecting CSP Integrity reports? Open the JS Time Machine in your account.
Not yet? Follow the CSP Integrity setup. It takes one keyword in your policy, and history starts building from your first visitor.
New to Report URI? Your 30-day trial includes CSP Integrity and the JS Time Machine along with every other feature; keeping them afterwards needs an Ultimate or Enterprise plan.