tests/test_hygiene.py — Users and Apps Audit
From version 0.1.0 of Users and Apps Audit, shown publicly by its creator. 2.3 KiB · SHA-256 20af27ec354a39bb7853281c98339fc0c23953ed22e4cfa2ff7d341997cbe813.
#!/usr/bin/env python3
# By Zero Width Lab (zerowidthlab.com)
"""Public package hygiene checks."""
from __future__ import annotations
import re
import unittest
from pathlib import Path
__author__ = "Zero Width Lab"
ROOT = Path(__file__).resolve().parents[1]
SHIPPED = ["SKILL.md", "README.md", "SETUP.md", "LICENSE.txt",
"agents/users-and-apps-audit-agent.md", "references/graph-report.md",
"scripts/users_and_apps_audit.py", "tests/test_users_and_apps_audit.py",
"tests/test_hygiene.py", "tests/fixtures/synthetic.json", "source-package.json"]
PACKAGING = ["packaging/listing-values.json", "packaging/skills-outpost-listing.md",
"packaging/package-spec.json", "packaging/package-spec-content.json"]
SIGNATURE = "By Zero Width Lab (zerowidthlab.com)"
AI_NAMES = ("Open" + "AI", "Anth" + "ropic", "Chat" + "G" + "PT", "Gem" + "ini",
"Cla" + "ude", "Cod" + "ex", "Cop" + "ilot", "Son" + "net", "Op" + "us")
AI_TOKEN = "G" + "P" + "T"
class HygieneTests(unittest.TestCase):
def test_public_files(self) -> None:
invisible = {chr(point) for point in (0x200b, 0x200c, 0x200d, 0x2060, 0xfeff)}
for name in SHIPPED + [name for name in PACKAGING if (ROOT / name).is_file()]:
with self.subTest(file=name):
data = (ROOT / name).read_text(encoding="utf-8")
self.assertFalse(any(character in data for character in invisible))
self.assertIsNone(re.search(r"\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b", data))
self.assertIsNone(re.search(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}", data))
home_pattern = "/" + r"Users/[^/\s]+" + "|" + r"[A-Za-z]:\\\\Users\\\\[^\\\s]+"
self.assertIsNone(re.search(home_pattern, data))
self.assertIsNone(re.search(r"[A-Za-z0-9-]+\.onmicrosoft\.com", data))
for vendor in AI_NAMES:
self.assertIsNone(re.search(re.escape(vendor), data, flags=re.IGNORECASE))
self.assertIsNone(re.search(r"\b" + AI_TOKEN + r"\b", data))
if name.endswith(".md"):
self.assertEqual(data.rstrip().splitlines()[-1], SIGNATURE)
if __name__ == "__main__":
unittest.main()
License: MIT (read it).
MIT
MIT LicenseCopyright (c) 2026 Zero Width Lab
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.