Skip to content
This repository was archived by the owner on Nov 16, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .github/workflows/copy-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ jobs:
persist-credentials: false
- name: Tagline and cards match the org profile README
run: python3 -I scripts/check-copy.py
- name: Built site does not publish AGENTS.md or CLAUDE.md
run: python3 -I scripts/check-unpublished.py
2 changes: 2 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
layout: default
title: Not found
description: That page is not here. Totative's write-ups and brand assets live at totative.dev.
permalink: /404.html
noindex: true
---
<h1>Page not found</h1>
<p>That page does not exist. <a href="/">Go to the home page</a>.</p>
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ title: Totative
url: https://totative.dev
permalink: /writeups/:title/
include: [".well-known"]
exclude: [README.md, scripts, lefthook.yml, .gitleaks.toml, Gemfile, Gemfile.lock, vendor]
exclude: [README.md, scripts, lefthook.yml, .gitleaks.toml, Gemfile, Gemfile.lock, vendor, AGENTS.md, CLAUDE.md]
defaults:
- scope:
path: ""
Expand Down
9 changes: 9 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
<meta name="referrer" content="no-referrer">
<title>{% if page.title %}{{ page.title }} - {% endif %}Totative</title>
<meta name="description" content="{{ page.description | default: 'Software security: testing, research, review, and the tools we build for it.' }}">
{% if page.noindex %}
{% assign target = '/' %}
<meta name="robots" content="noindex">
{% else %}
{% assign target = page.url %}
<link rel="canonical" href="https://totative.dev{{ page.url }}">
{% endif %}
<meta http-equiv="refresh" content="0; url=https://totative.dev{{ target }}">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="stylesheet" href="/assets/site.css?v={{ site.time | date: '%s' }}">
</head>
Expand All @@ -21,6 +29,7 @@
</nav>
</header>
<main>
<p>This site has moved to <a href="https://totative.dev{{ target }}">totative.dev{{ target }}</a>.</p>
{{ content }}
</main>
<footer>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
---
<p>Software security research, and the tools we build for it.</p>
<h1>Software security research, and the tools we build for it.</h1>

<h2>What we do</h2>
<div class="grid">
Expand Down
49 changes: 44 additions & 5 deletions scripts/check-copy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fail when the site's tagline, work-area cards or tools list differ from the org profile README's."""

import re
import sys
import urllib.request
Expand All @@ -9,22 +10,60 @@

def profile_copy(md: str) -> tuple[str, list[tuple[str, str]], list[tuple[str, str]]]:
tagline = re.search(r'<p align="center">\s*([^<]+?)\s*</p>', md).group(1)
tools = re.findall(r"^- \[([^\]]+)\]\(https://github\.com/Totative/[^)]+\): (.+)$", md, re.M)
tools = re.findall(
r"^- \[([^\]]+)\]\(https://github\.com/Totative/[^)]+\): (.+)$", md, re.M
)
return tagline, re.findall(r"<b>([^<]+)</b><br>([^<]+)</td>", md), tools


def site_copy(html: str) -> tuple[str, list[tuple[str, str]], list[tuple[str, str]]]:
tagline = re.search(r"<p>([^<]+)</p>", html).group(1)
tools = re.findall(r'<li><a href="https://github\.com/Totative/[^"]+">([^<]+)</a>: ([^<]+)</li>', html)
tagline = re.search(r"<h1>([^<]+)</h1>", html).group(1)
tools = re.findall(
r'<li><a href="https://github\.com/Totative/[^"]+">([^<]+)</a>: ([^<]+)</li>',
html,
)
return tagline, re.findall(r"<h3>([^<]+)</h3><p>([^<]+)</p>", html), tools


def check_canonical(layout: str) -> None:
if '<link rel="canonical" href="https://totative.dev{{ page.url }}">' not in layout:
raise SystemExit("pages need a totative.dev canonical")


def check_home_h1(html: str) -> None:
if re.search(r"^<h1>[^<]+</h1>\s*$", html, re.M) is None:
raise SystemExit("home lede must be an h1")


def check_404_noindex(layout: str, not_found: str) -> None:
branch = re.search(
r"\{%\s*if page\.noindex\s*%\}(.*)\{%\s*else\s*%\}(.*)\{%\s*endif\s*%\}",
layout,
re.S,
)
if branch is None:
raise SystemExit("default layout needs a page.noindex branch")
if 'name="robots" content="noindex"' not in branch.group(1):
raise SystemExit("noindex branch missing robots meta")
if 'rel="canonical"' in branch.group(1):
raise SystemExit("noindex branch must not emit canonical")
if re.search(r"^noindex:\s*true\s*$", not_found, re.M) is None:
raise SystemExit("404.html needs noindex: true")


def main() -> int:
layout = Path("_layouts/default.html").read_text()
check_canonical(layout)
index = Path("index.html").read_text()
check_home_h1(index)
check_404_noindex(layout, Path("404.html").read_text())
md = urllib.request.urlopen(PROFILE, timeout=30).read().decode()
want, have = profile_copy(md), site_copy(Path("index.html").read_text())
want, have = profile_copy(md), site_copy(index)
assert want[1], "no cards found in the profile README"
if want == have:
print(f"site copy matches the profile: tagline, {len(have[1])} cards, {len(have[2])} tools")
print(
f"site copy matches the profile: tagline, {len(have[1])} cards, {len(have[2])} tools"
)
return 0
print(f"profile: {want}\nsite: {have}", file=sys.stderr)
return 1
Expand Down
39 changes: 39 additions & 0 deletions scripts/check-unpublished.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""Fail if AGENTS.md or CLAUDE.md would ship with the site."""

from __future__ import annotations

import re
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
NAMES = ("AGENTS.md", "CLAUDE.md")


def excluded_paths(config: str) -> list[str]:
match = re.search(r"^exclude:\s*\[(.*)\]\s*$", config, re.M)
if match is None:
raise SystemExit("_config.yml has no exclude list")
return [
part.strip().strip("'\"") for part in match.group(1).split(",") if part.strip()
]


def main() -> int:
excluded = excluded_paths((ROOT / "_config.yml").read_text())
missing = [name for name in NAMES if name not in excluded]
if missing:
print("exclude lacks " + ", ".join(missing), file=sys.stderr)
return 1
site = ROOT / "_site"
if site.is_dir():
published = [name for name in NAMES if (site / name).is_file()]
if published:
print("_site contains " + ", ".join(published), file=sys.stderr)
return 1
return 0


if __name__ == "__main__":
raise SystemExit(main())
Loading