Embed supplied high-resolution Classic start artwork (by Codex)
This commit is contained in:
1 parent
0bfa705ec5
commit
9c82cb16b5
20 files changed
+8274
-36
No files matched your search
@@ -14,7 +14,7 @@ def validate(directory, windows):
|
||||
documents = {'README.md', 'LICENSE', 'THIRD_PARTY_NOTICES.md', 'ACKNOWLEDGEMENTS.md', 'CONTRIBUTING.md'}
|
||||
licenses = {'README.md', 'LGPL-2.1.txt', 'Nuked-OPL3-notices.txt', 'LZMA-SDK.txt', 'SDL2-HIDAPI-BSD.txt',
|
||||
'SDL2-HIDAPI-options.txt', 'SDL2-HIDAPI-original.txt', 'SDL2-yuv2rgb.txt',
|
||||
'SDL2.txt', 'miniz-source-notices.txt', 'miniz.txt', 'nativefiledialog-extended.txt'}
|
||||
'SDL2.txt', 'miniz-source-notices.txt', 'miniz.txt', 'nativefiledialog-extended.txt', 'stb_image.txt'}
|
||||
present = set()
|
||||
for file in directory.rglob('*'):
|
||||
if not file.is_file():
|
||||
|
||||
@@ -8,6 +8,7 @@ from __future__ import annotations
|
||||
import argparse
|
||||
import dataclasses
|
||||
import json
|
||||
import hashlib
|
||||
from pathlib import Path, PurePosixPath
|
||||
import re
|
||||
import shutil
|
||||
@@ -28,6 +29,10 @@ ASSET_SUFFIXES = {
|
||||
".avi", ".mov", ".mp4", ".png", ".jpg", ".jpeg", ".bmp", ".gif",
|
||||
".bin", ".zip", ".7z", ".dmg", ".tar", ".gz", ".pdf",
|
||||
}
|
||||
# Newly supplied project artwork and an unchanged MIT/public-domain decoder.
|
||||
# Exact hashes keep this exception from admitting original-game asset dumps.
|
||||
REVIEWED_BINARY_FILES = {"assets/start-screen.jpg": "28df5a72cd7b6951c9eebf30532ea9557007a46f0a73614ba22401c403e379dc"}
|
||||
REVIEWED_UPSTREAM_FILES = {"src/app/third_party/stb_image.h": "594c2fe35d49488b4382dbfaec8f98366defca819d916ac95becf3e75f4200b3"}
|
||||
PRIVATE_PREFIXES = (
|
||||
("data", "original"), ("docs", "manuals"), ("docs", "analyses"),
|
||||
("docs", "agents"), ("src", "ui", "validation"),
|
||||
@@ -166,6 +171,11 @@ def path_findings(name: str) -> list[Finding]:
|
||||
|
||||
|
||||
def scan_blob(name: str, blob: bytes) -> list[Finding]:
|
||||
reviewed = REVIEWED_BINARY_FILES | REVIEWED_UPSTREAM_FILES
|
||||
if name in reviewed:
|
||||
if hashlib.sha256(blob).hexdigest() == reviewed[name]:
|
||||
return []
|
||||
return [Finding(name, 0, "modified-reviewed-project-file")]
|
||||
result = path_findings(name)
|
||||
if len(blob) > 2_000_000:
|
||||
result.append(Finding(name, 0, "oversized-source-file"))
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import contextlib
|
||||
import io
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
@@ -17,6 +18,16 @@ import check_public_tree as guard
|
||||
|
||||
|
||||
class BlobChecks(unittest.TestCase):
|
||||
def test_only_exact_reviewed_artwork_and_decoder_are_admitted(self):
|
||||
for name, table in (("assets/start-screen.jpg",guard.REVIEWED_BINARY_FILES),
|
||||
("src/app/third_party/stb_image.h",guard.REVIEWED_UPSTREAM_FILES)):
|
||||
content=b"synthetic reviewed input\0"
|
||||
with mock.patch.dict(table,{name:hashlib.sha256(content).hexdigest()}):
|
||||
self.assertEqual(guard.scan_blob(name,content),[])
|
||||
self.assertEqual({finding.rule for finding in guard.scan_blob(name,content+b"changed")},
|
||||
{"modified-reviewed-project-file"})
|
||||
self.assertIn("binary-or-game-asset",{finding.rule for finding in guard.scan_blob("assets/other.jpg",b"synthetic\0")})
|
||||
|
||||
def rules(self, name, text):
|
||||
return {finding.rule for finding in guard.scan_blob(name, text.encode())}
|
||||
|
||||
|
||||
Reference in new issue
Block a user