Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/studio-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,24 @@ jobs:
touch .nojekyll
# Keeps the custom domain if the Pages settings are ever reset.
echo "studio.geolibre.app" > CNAME
# Keep the gated instance out of search results. Nothing here is
# useful to a crawler — every route renders the sign-in card until a
# session exists — and the deployment is meant to be reached by
# invitation, not found.
printf 'User-agent: *\nDisallow: /\n' > robots.txt
# A second signal for crawlers that ignore robots.txt. Note the two
# do not compose: a crawler that honours the Disallow above never
# fetches this page and so never reads the noindex, which is why a
# URL linked from elsewhere can still be listed (bare, no title). If
# studio is ever linked publicly and that matters, relax robots.txt
# to "Allow: /" so the noindex is the rule that applies.
# Appended to the end of <head> rather than the start, so the charset
# declaration keeps its place as the first thing in the document.
sed -i '0,/<\/head>/s// <meta name="robots" content="noindex, nofollow" \/>\n <\/head>/' index.html

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor/informational, low confidence: vite-plugin-pwa's workbox globPatterns includes html (see vite.config.ts around the workbox: block), so the service-worker precache manifest's revision hash for index.html is computed at build time from the pre-sed content. This sed runs after that build step, so the deployed index.html (with the noindex meta tag) will differ from what the manifest hashed.

In practice this is likely harmless — Workbox precaching fetches the resource by URL at install time rather than validating byte-for-byte against the revision hash, so the service worker should still end up caching the actual (modified) file. Flagging only because it's a subtle build-step-ordering interaction worth being aware of if precache behavior ever looks stale for this deployment specifically.

# The tag is injected into generated markup, so fail loudly if a
# future index.html no longer matches rather than publishing an
# indexable page.
grep -q 'name="robots"' index.html
Comment on lines +145 to +149

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Validate the exact tag and document structure before publishing.

At Line 149, grep -q 'name="robots"' only checks a substring. It can pass on an existing tag, a comment, or text outside <head>, even when Line 145 did not add the required noindex, nofollow tag. Line 145 also uses the first textual </head> occurrence instead of validating the parsed document. This can publish an indexable studio after a template change. Validate exactly one required meta element inside <head>, and compare the </head> count before and after the edit.

Suggested minimum guard
+          head_count_before=$(grep -oF '</head>' index.html | wc -l || true)
+          if [ "$head_count_before" -eq 0 ]; then
+            echo "::error::index.html has no </head> element."
+            exit 1
+          fi
           sed -i '0,/<\/head>/s//    <meta name="robots" content="noindex, nofollow" \/>\n  <\/head>/' index.html
-          grep -q 'name="robots"' index.html
+          head_count_after=$(grep -oF '</head>' index.html | wc -l || true)
+          robots_count=$(grep -oF '<meta name="robots" content="noindex, nofollow" />' index.html | wc -l || true)
+          if [ "$head_count_after" -ne "$head_count_before" ] || [ "$robots_count" -ne 1 ]; then
+            echo "::error::index.html failed robots meta validation."
+            exit 1
+          fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/studio-deploy.yml around lines 145 - 149, Strengthen the
validation around the robots-tag injection in the deployment workflow: record
the number of </head> markers before and after the sed edit and fail unless the
count is unchanged, then validate that exactly one meta element with
name="robots" and content="noindex, nofollow" exists inside the head rather than
matching arbitrary text. Keep the deployment blocked whenever the expected
document structure or exact tag is absent.

# Published Pages sites may be no larger than 1 GB. The build is
# ~200 MB today, most of it the two DuckDB-WASM binaries; fail early
# rather than publish a site Pages will reject.
Expand Down
Loading