Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""Hard resource references, with one fail-closed audited optional identity test.
|
||||
|
||||
This is not a general Enforce parser or a new external dependency allowlist.
|
||||
Changing any byte of the audited source requires reviewing this exception again.
|
||||
"""
|
||||
import hashlib
|
||||
import re
|
||||
|
||||
OPTIONAL_FILE = 'addons/core/Scripts/Game/ERR/00_Core/ERR_ReaperRHSCompat.c'
|
||||
OPTIONAL_SHA256 = 'bcdf98c05ac6cdf0c7eaa854531b02e9ee4f53fbb346ae01d58114e572e7dd4f'
|
||||
OPTIONAL_RESOURCE = '{574AA64002B8E308}Prefabs/Characters/REAPER_SpectatorCameraHelper.et'
|
||||
OPTIONAL_METHOD = ''' protected static bool CameraSlot(BaseContainer slot)
|
||||
{
|
||||
if (!slot || slot.GetName() != "SpectatorCameraHelper") return false;
|
||||
ResourceName prefab;
|
||||
if (!slot.Get("Prefab", prefab)) return false;
|
||||
return prefab == "{574AA64002B8E308}Prefabs/Characters/REAPER_SpectatorCameraHelper.et";
|
||||
}'''
|
||||
|
||||
|
||||
def hard_resource_references(relative_path, text):
|
||||
"""Exclude only the pinned comparison occurrence; keep all other checks."""
|
||||
identity_offset = -1
|
||||
if (str(relative_path) == OPTIONAL_FILE
|
||||
and hashlib.sha256(text.encode('utf-8')).hexdigest() == OPTIONAL_SHA256
|
||||
and text.count(OPTIONAL_METHOD) == 1
|
||||
and text.count(OPTIONAL_RESOURCE) == 1):
|
||||
identity_offset = text.index(OPTIONAL_METHOD) + OPTIONAL_METHOD.index(OPTIONAL_RESOURCE)
|
||||
for match in re.finditer(r'\{([A-F0-9]{16})\}([^"\n]+)', text):
|
||||
if match.start() != identity_offset:
|
||||
guid, resource = match.groups()
|
||||
# Enforce strings that build a graph escape its closing quote. The
|
||||
# escape belongs to the string syntax, not to the resource path.
|
||||
if str(relative_path).endswith('.c') and resource.endswith('\\') and text[match.end():match.end()+1] == '"':
|
||||
resource = resource[:-1]
|
||||
yield guid, resource
|
||||
Reference in New Issue
Block a user