Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
tools/check_public_email.py (test public_email, CI Trademarks job): keeps our email address off website/, docs/ and README*
islandmeda6862a276b0a
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex ee29033d..d5262bae 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -136,6 +136,7 @@ jobs:steps:- uses: actions/checkout@v7- run: python3 tools/check_marks.py --self-test && python3 tools/check_marks.py+ - run: python3 tools/check_public_email.py --self-test && python3 tools/check_public_email.py# On screen too: images and video frames, read from tools/marks_media_cache.json; a file the cache doesn't have# yet is OCR'd here (commit its entry: run tools/check_marks_media.py locally).- run: |diff --git a/CMakeLists.txt b/CMakeLists.txtindex c5d4a32a..58791ca3 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -782,6 +782,10 @@ if(SCULPTFORGE_BUILD_TESTS)# The release's SBOM (tools/release/sbom.py, docs/guide/security.md): every fetched archive is a listed component.add_test(NAME sbom COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/release/sbom.py --check)add_test(NAME marks_self_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/check_marks.py --self-test)+ # Our email address stays off everything public (website/, docs/, README*): hello@ is a private support inbox.+ add_test(NAME public_email COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/tools/check_public_email.py+ ${CMAKE_CURRENT_SOURCE_DIR})+ add_test(NAME public_email_self_test COMMAND ${Python3_EXECUTABLE} -I ${CMAKE_CURRENT_SOURCE_DIR}/tools/check_public_email.py --self-test)# The same marks read off the pixels of every tracked image and video (OCR, cached by file hash), and the deploy's# takedown of flagged ones (tools/media_takedown.py).add_test(NAME marks_media COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/check_marks_media.pydiff --git a/changes/fix-no-public-email.md b/changes/fix-no-public-email.mdnew file mode 100644index 00000000..1d436433--- /dev/null+++ b/changes/fix-no-public-email.md@@ -0,0 +1,4 @@+---+changed: A check (tools/check_public_email.py, in CI and the test suite) keeps our email address off the website, docs and+ README.+---diff --git a/tools/check_public_email.py b/tools/check_public_email.pynew file mode 100644index 00000000..17a0a593--- /dev/null+++ b/tools/check_public_email.py@@ -0,0 +1,71 @@+#!/usr/bin/env python3+"""Fail if a public file carries our email address (Tony 11-06: hello@ is a private support inbox, spam).++Scans website/, docs/ and README* for a literal "@sculptforge.app" or a mailto: to our domain. The Studios page+builds its address in JavaScript on click, so it is never literal and passes.+ python3 -I tools/check_public_email.py [root] (test public_email; sitegate.sh greps website/ the same way)+ python3 -I tools/check_public_email.py --self-test+"""+import os, re, sys, tempfile++BAD = re.compile(r'@sculptforge\.app|mailto:[^"\'\s<>]*sculptforge\.app', re.I)+TEXT = ('.html', '.md', '.js', '.json', '.txt', '.xml', '.css', '.svg', '.yml', '.yaml', '.rst', '')+++def files(root):+ for top in ('website', 'docs'):+ for d, _, fs in os.walk(os.path.join(root, top)):+ for f in fs:+ yield os.path.join(d, f)+ for f in os.listdir(root):+ if f.startswith('README'):+ yield os.path.join(root, f)+++def scan(root):+ hits = []+ for p in files(root):+ if os.path.splitext(p)[1].lower() not in TEXT or not os.path.isfile(p):+ continue+ with open(p, encoding='utf-8', errors='replace') as fh:+ for n, line in enumerate(fh, 1):+ for m in BAD.finditer(line):+ hits.append(f'{os.path.relpath(p, root)}:{n}: {line[max(0, m.start() - 30):m.end() + 10].strip()}')+ return hits+++def self_test():+ cases = {'website/a.html': ('<a href="mailto:[email protected]">', True),+ 'README.md': ('write to [email protected]', True),+ 'docs/b.md': ('<a href="MAILTO:[email protected]">', True),+ 'website/c.html': ('<a href="mailto:[email protected]">', False),+ 'website/d.js': ("'mailto:' + 'hello' + '@' + 'sculptforge.app'", False),+ 'src/e.cpp': ('[email protected]', False)}+ with tempfile.TemporaryDirectory() as root:+ for rel, (text, _) in cases.items():+ os.makedirs(os.path.join(root, os.path.dirname(rel)), exist_ok=True)+ with open(os.path.join(root, rel), 'w', encoding='utf-8') as fh:+ fh.write(text + '\n')+ got = {h.split(':', 1)[0] for h in scan(root)}+ want = {rel for rel, (_, bad) in cases.items() if bad}+ if got != want:+ print(f'check_public_email self-test: flagged {sorted(got)}, expected {sorted(want)}')+ return 1+ print('check_public_email self-test: ok')+ return 0+++def main():+ if sys.argv[1:] == ['--self-test']:+ return self_test()+ hits = scan(sys.argv[1] if len(sys.argv) > 1 else '.')+ if hits:+ print('check_public_email: our address must not be public (use Discord, or the click-built link on studios.html):')+ print(*(' ' + h for h in hits[:30]), sep='\n')+ return 1+ print('check_public_email: ok')+ return 0+++if __name__ == '__main__':+ sys.exit(main())diff --git a/tools/test/run.py b/tools/test/run.pyindex e1721977..a6c926b0 100644--- a/tools/test/run.py+++ b/tools/test/run.py@@ -43,7 +43,7 @@ ENV_PREFIXES = ("SF_", "SCULPTFORGE_", "SDL_", "GALLIUM_", "LIBGL_", "MESA_", "_ENV_IGNORE = {"SDL_APP_ID"}# Tests that read files their command doesn't name: hashed as globs (repo-relative). "*" = every tracked file.READS = {- "marks": ["*"], "marks_self_test": ["tools/check_marks.py"],+ "marks": ["*"], "marks_self_test": ["tools/check_marks.py"], "public_email": ["*"], "public_email_self_test": ["tools/check_public_email.py"],"guide_site": ["*"], "guide_menu_paths": ["*"], "ui_guide_shortcuts": ["docs/guide"],"release_notes": ["tools/release"], "release_notes_fragments": ["changes", "tools/release"],"release_script_beta": ["*"], "upstream_watch": ["tools/upstream-watch"],