create-website-build-kit 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/scripts/recon.mjs +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-website-build-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Scaffold a production marketing site \u2014 Astro on Cloudflare Workers, with the gates, the migration playbook and the accessibility work already wired.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -177,9 +177,20 @@ async function req(url, options = {}) {
|
|
|
177
177
|
const controller = new AbortController();
|
|
178
178
|
const timer = setTimeout(() => controller.abort(), 20000);
|
|
179
179
|
const follow = options.redirect !== 'manual';
|
|
180
|
+
/*
|
|
181
|
+
* ⚠ 20, BECAUSE THAT IS WHAT fetch ITSELF ALLOWS. Following redirects by
|
|
182
|
+
* hand is what lets every hop be checked, but the hop LIMIT is not a
|
|
183
|
+
* security property — and picking a lower one silently changes results.
|
|
184
|
+
*
|
|
185
|
+
* At a cap of 5, a page behind a longer chain came back as the 302 rather
|
|
186
|
+
* than the 200 it used to: measured, old → 200, new → 302. In a migration
|
|
187
|
+
* inventory that turns a live page into a redirect, which is the kind of
|
|
188
|
+
* wrong that reads as fine.
|
|
189
|
+
*/
|
|
190
|
+
const MAX_HOPS = 20;
|
|
180
191
|
try {
|
|
181
192
|
let res = await fetch(url, { ...options, redirect: 'manual', signal: controller.signal });
|
|
182
|
-
for (let hops = 0; follow && res.status >= 300 && res.status < 400 && res.headers.get('location') && hops <
|
|
193
|
+
for (let hops = 0; follow && res.status >= 300 && res.status < 400 && res.headers.get('location') && hops < MAX_HOPS; hops++) {
|
|
183
194
|
const next = new URL(res.headers.get('location'), url).toString();
|
|
184
195
|
const hopRefusal = blockedReason(next, { allowInternal });
|
|
185
196
|
if (hopRefusal) return refuse(`${hopRefusal.reason} — reached by a redirect from ${url}`, next);
|