This commit is contained in:
@@ -22,6 +22,7 @@ FIELDS = {'schema_version', 'agent_pid', 'observed_at', 'role', 'windows_boot_id
|
|||||||
'connection_generation', 'verifier_incarnation', 'request_sha256', 'response_sha256'}
|
'connection_generation', 'verifier_incarnation', 'request_sha256', 'response_sha256'}
|
||||||
FILES = {'agent': 'agent-time-sample.json', 'system_helper': 'helper-time-sample.json'}
|
FILES = {'agent': 'agent-time-sample.json', 'system_helper': 'helper-time-sample.json'}
|
||||||
HEX = re.compile(r'[0-9a-f]{64}')
|
HEX = re.compile(r'[0-9a-f]{64}')
|
||||||
|
SECOND_NS = 1_000_000_000
|
||||||
|
|
||||||
# No report is requested from a service. The only content reads on the guest
|
# No report is requested from a service. The only content reads on the guest
|
||||||
# are these two public JSONs and public executable hashes. CIM/process queries
|
# are these two public JSONs and public executable hashes. CIM/process queries
|
||||||
@@ -106,9 +107,16 @@ def strict(pairs):
|
|||||||
|
|
||||||
|
|
||||||
def stamp(value):
|
def stamp(value):
|
||||||
need(type(value) is str and value.endswith('Z'), 'UTC_TIMESTAMP_REQUIRED')
|
need(type(value) is str, 'UTC_TIMESTAMP_REQUIRED')
|
||||||
result = dt.datetime.fromisoformat(value[:-1] + '+00:00')
|
match = re.fullmatch(r'(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,9}))?Z', value)
|
||||||
return result
|
need(match is not None, 'UTC_TIMESTAMP_REQUIRED')
|
||||||
|
base = dt.datetime.strptime(match[1], '%Y-%m-%dT%H:%M:%S').replace(tzinfo=dt.timezone.utc)
|
||||||
|
elapsed = base - dt.datetime(1970, 1, 1, tzinfo=dt.timezone.utc)
|
||||||
|
return (elapsed.days * 86400 + elapsed.seconds) * SECOND_NS + int((match[2] or '').ljust(9, '0'))
|
||||||
|
|
||||||
|
|
||||||
|
def utc_ns(value):
|
||||||
|
return stamp(value.astimezone(dt.timezone.utc).isoformat().replace('+00:00', 'Z'))
|
||||||
|
|
||||||
|
|
||||||
def canonical_uuid(value):
|
def canonical_uuid(value):
|
||||||
@@ -138,7 +146,7 @@ def windows_boot(ticks):
|
|||||||
|
|
||||||
def filetime(value):
|
def filetime(value):
|
||||||
need(type(value) is str and value.isascii() and value.isdigit(), 'FILETIME_REQUIRED')
|
need(type(value) is str and value.isascii() and value.isdigit(), 'FILETIME_REQUIRED')
|
||||||
return dt.datetime(1601, 1, 1, tzinfo=dt.timezone.utc) + dt.timedelta(microseconds=int(value) // 10)
|
return (int(value) - 116444736000000000) * 100
|
||||||
|
|
||||||
|
|
||||||
def validate(native, server, since, observed_now):
|
def validate(native, server, since, observed_now):
|
||||||
@@ -151,7 +159,7 @@ def validate(native, server, since, observed_now):
|
|||||||
generation = current['connection_generation']
|
generation = current['connection_generation']
|
||||||
need(type(generation) is int and generation > 0, 'CURRENT_POSITIVE_GENERATION')
|
need(type(generation) is int and generation > 0, 'CURRENT_POSITIVE_GENERATION')
|
||||||
now = stamp(native['observed_at'])
|
now = stamp(native['observed_at'])
|
||||||
need(abs((now - observed_now).total_seconds()) <= 10, 'CURRENT_WINDOWS_UTC')
|
need(abs(now - utc_ns(observed_now)) <= 10 * SECOND_NS, 'CURRENT_WINDOWS_UTC')
|
||||||
records = []
|
records = []
|
||||||
for role, filename in FILES.items():
|
for role, filename in FILES.items():
|
||||||
wrapped = native['reports'][filename]
|
wrapped = native['reports'][filename]
|
||||||
@@ -168,9 +176,9 @@ def validate(native, server, since, observed_now):
|
|||||||
observed = stamp(record['observed_at'])
|
observed = stamp(record['observed_at'])
|
||||||
modified = filetime(wrapped['metadata']['last_write_filetime'])
|
modified = filetime(wrapped['metadata']['last_write_filetime'])
|
||||||
birth = filetime(native['runtime']['agent']['birth_filetime'])
|
birth = filetime(native['runtime']['agent']['birth_filetime'])
|
||||||
need(since <= observed <= now + dt.timedelta(seconds=2) and birth <= observed, 'SAMPLE_CURRENT_INSTALL_WINDOW')
|
need(since <= observed <= now + 2 * SECOND_NS and birth <= observed, 'SAMPLE_CURRENT_INSTALL_WINDOW')
|
||||||
need(0 <= (now - modified).total_seconds() <= 180 and 0 <= (now - observed).total_seconds() <= 180, 'SAMPLE_FILE_AGE')
|
need(0 <= now - modified <= 180 * SECOND_NS and 0 <= now - observed <= 180 * SECOND_NS, 'SAMPLE_FILE_AGE')
|
||||||
need(-2 <= (modified - observed).total_seconds() <= 90, 'SAMPLE_PUBLICATION_DELAY')
|
need(-2 * SECOND_NS <= modified - observed <= 90 * SECOND_NS, 'SAMPLE_PUBLICATION_DELAY')
|
||||||
need(wrapped['metadata']['dacl_checked'] is True, 'SAMPLE_PROTECTED_METADATA')
|
need(wrapped['metadata']['dacl_checked'] is True, 'SAMPLE_PROTECTED_METADATA')
|
||||||
records.append(record)
|
records.append(record)
|
||||||
for field in ('verifier_incarnation', 'request_sha256', 'response_sha256'):
|
for field in ('verifier_incarnation', 'request_sha256', 'response_sha256'):
|
||||||
@@ -181,7 +189,7 @@ def validate(native, server, since, observed_now):
|
|||||||
def collect(args):
|
def collect(args):
|
||||||
need(HEX.fullmatch(args.agent_sha256) and HEX.fullmatch(args.helper_sha256), 'QUALIFIED_RUNTIME_HASHES_REQUIRED')
|
need(HEX.fullmatch(args.agent_sha256) and HEX.fullmatch(args.helper_sha256), 'QUALIFIED_RUNTIME_HASHES_REQUIRED')
|
||||||
since = stamp(args.profile_after)
|
since = stamp(args.profile_after)
|
||||||
need(0 <= (dt.datetime.now(dt.timezone.utc) - since).total_seconds() <= 600, 'RECENT_PROFILE_INSTALL_WINDOW')
|
need(0 <= utc_ns(dt.datetime.now(dt.timezone.utc)) - since <= 600 * SECOND_NS, 'RECENT_PROFILE_INSTALL_WINDOW')
|
||||||
STATE.mkdir(parents=True, mode=0o700, exist_ok=True)
|
STATE.mkdir(parents=True, mode=0o700, exist_ok=True)
|
||||||
ident = str(uuid.uuid4())
|
ident = str(uuid.uuid4())
|
||||||
folder = STATE / ident
|
folder = STATE / ident
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import passive_time_closeout as c
|
|||||||
class Binding(unittest.TestCase):
|
class Binding(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.now = dt.datetime(2026,11,15,14,0,tzinfo=dt.timezone.utc)
|
self.now = dt.datetime(2026,11,15,14,0,tzinfo=dt.timezone.utc)
|
||||||
self.since = self.now - dt.timedelta(seconds=50)
|
self.since = c.utc_ns(self.now - dt.timedelta(seconds=50))
|
||||||
ticks='638987472000000000'
|
ticks='638987472000000000'
|
||||||
boot=c.windows_boot(ticks)
|
boot=c.windows_boot(ticks)
|
||||||
epoch=dt.datetime(1601,1,1,tzinfo=dt.timezone.utc)
|
epoch=dt.datetime(1601,1,1,tzinfo=dt.timezone.utc)
|
||||||
@@ -50,5 +50,15 @@ class Binding(unittest.TestCase):
|
|||||||
def test_missing_sample_is_explicit(self):
|
def test_missing_sample_is_explicit(self):
|
||||||
self.native['reports']['helper-time-sample.json']=None
|
self.native['reports']['helper-time-sample.json']=None
|
||||||
with self.assertRaisesRegex(ValueError,'PUBLIC_SERVICE_SAMPLE_MISSING'):c.validate(self.native,self.server,self.since,self.now)
|
with self.assertRaisesRegex(ValueError,'PUBLIC_SERVICE_SAMPLE_MISSING'):c.validate(self.native,self.server,self.since,self.now)
|
||||||
|
def test_native_seven_and_chrono_nine_digits_keep_exact_install_boundary(self):
|
||||||
|
native='2026-11-15T13:59:40.1234567Z'
|
||||||
|
chrono='2026-11-15T13:59:40.123456701Z'
|
||||||
|
self.assertEqual(c.stamp(chrono)-c.stamp(native),1)
|
||||||
|
self.modify('agent-time-sample.json','observed_at',native)
|
||||||
|
self.modify('helper-time-sample.json','observed_at',chrono)
|
||||||
|
since=c.stamp(native)
|
||||||
|
self.assertEqual(len(c.validate(self.native,self.server,since,self.now)),2)
|
||||||
|
with self.assertRaisesRegex(ValueError,'SAMPLE_CURRENT_INSTALL_WINDOW'):
|
||||||
|
c.validate(self.native,self.server,since+1,self.now)
|
||||||
|
|
||||||
if __name__=='__main__':unittest.main()
|
if __name__=='__main__':unittest.main()
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ Ein kleiner rein lesender Collector für die beiden historischen Rollenbelege
|
|||||||
aus cc82124 ist ausführbar vorbereitet. Er bindet öffentliche Dienstprozesse,
|
aus cc82124 ist ausführbar vorbereitet. Er bindet öffentliche Dienstprozesse,
|
||||||
Boot, aktuelle Servergeneration, Rollen-/Hashtrennung und enge Datenalter;
|
Boot, aktuelle Servergeneration, Rollen-/Hashtrennung und enge Datenalter;
|
||||||
keine Dienste, IPC, Zeitrequests oder Diagnoseprogramme werden ausgelöst.
|
keine Dienste, IPC, Zeitrequests oder Diagnoseprogramme werden ausgelöst.
|
||||||
Lokale Syntax-/Scopeguards und fünf Bindingfixtures bestanden. **Kein VM-Aufruf,
|
Lokale Syntax-/Scopeguards und sechs Bindingfixtures bestanden. Der konkrete
|
||||||
|
lokale .NET-/Chrono-Fraktionsparserfehler ist mit exakter Nanosekundenrechnung
|
||||||
|
und +1ns-Grenzfall korrigiert. **Kein VM-Aufruf,
|
||||||
keine native Collector-/Rollenabnahme** vor Roots V2-Profil-/Readbacksignal.
|
keine native Collector-/Rollenabnahme** vor Roots V2-Profil-/Readbacksignal.
|
||||||
[Umfang und genaue Grenzen](windows-passive-time-closeout.md).
|
[Umfang und genaue Grenzen](windows-passive-time-closeout.md).
|
||||||
|
|
||||||
|
|||||||
@@ -78,12 +78,32 @@ python3 deploy/windows/passive_time_closeout.py guards
|
|||||||
python3 -m unittest discover -s deploy/windows -p test_passive_time_closeout.py
|
python3 -m unittest discover -s deploy/windows -p test_passive_time_closeout.py
|
||||||
```
|
```
|
||||||
|
|
||||||
Fünf lokale Fixtures prüfen aktuelle unabhängige Rollen, falsche PID/Boot/
|
Sechs lokale Fixtures prüfen aktuelle unabhängige Rollen, falsche PID/Boot/
|
||||||
Generation/Rolle/Beobachtungsfrist, gleiche Verifier-/Request-/Responsewerte,
|
Generation/Rolle/Beobachtungsfrist, gleiche Verifier-/Request-/Responsewerte,
|
||||||
doppelte JSONfelder, fehlende Sicherheitsprüfung und fehlenden Helperbeleg.
|
doppelte JSONfelder, fehlende Sicherheitsprüfung und fehlenden Helperbeleg.
|
||||||
|
Der zusätzliche Grenzfall prüft die tatsächlichen sieben .NET- und neun
|
||||||
|
Chrono-Nachkommastellen. Python3.10s ursprüngliches `fromisoformat` verweigert
|
||||||
|
diese Formen; dieser konkrete lokale Fehler wurde vor jedem Zielaufruf
|
||||||
|
behoben. UTC- und FILETIME-Grenzen werden jetzt vollständig mit Ganzzahl-
|
||||||
|
Nanosekunden verglichen. Ein Sample genau an der Installationsuntergrenze wird
|
||||||
|
akzeptiert, eine um1ns spätere Untergrenze verweigert dasselbe Sample. Keine
|
||||||
|
Native- oder Testzeit wird hierfür erfunden.
|
||||||
PowerShell-/C#-Nativeparse und echte Rollenbelege bleiben offen; lokale
|
PowerShell-/C#-Nativeparse und echte Rollenbelege bleiben offen; lokale
|
||||||
Pythonprüfungen ersetzen sie nicht.
|
Pythonprüfungen ersetzen sie nicht.
|
||||||
|
|
||||||
|
Der konkrete Profileinsatz wurde zusätzlich unabhängig rein im Quellcode
|
||||||
|
geprüft (`time_profile_config.py`, SHA256
|
||||||
|
`36f0451a146ca8dc73d4c66b48f2e65fbaefde5c7643133993d1c136cc3318de`).
|
||||||
|
Kein konkreter Befund im geprüften Schnitt: getrennte öffentliche Source-/
|
||||||
|
Plattform-/Key-/Bindingketten, exakte neue Rollen mit PID/Geburt/Token-/Service-
|
||||||
|
SID/Image/FileID, SameLive-/Kernel-CAS vor und nach Veröffentlichung,
|
||||||
|
Intent-vor-ACL/Move, überschreibungsfreier gleichvolumiger Move und ausschließlich
|
||||||
|
ThisFolderOnly-Leserechte für die zwei Rollen. Die UTC-Untergrenze wird vor
|
||||||
|
dem ersten privaten Fallintent aufgezeichnet. Noch ungesetzte Paarbeleg-
|
||||||
|
Konstanten blockieren die Vorbereitung. Der konkrete spätere Rollen-/
|
||||||
|
Readbackbinding-Delta und die tatsächliche Veröffentlichung bleiben separat
|
||||||
|
nachzuweisen. Dieser Review ist keine Profileinrichtung oder native Abnahme.
|
||||||
|
|
||||||
Falls Reports fehlen, können die bereits vorhandenen passiven Dateien
|
Falls Reports fehlen, können die bereits vorhandenen passiven Dateien
|
||||||
`helper-probe.json` und `pipe-last-error.json` getrennt nur lesend bei der
|
`helper-probe.json` und `pipe-last-error.json` getrennt nur lesend bei der
|
||||||
Pipeeingrenzung helfen. Sie enthalten keinen vollständigen Timeworkerfehler;
|
Pipeeingrenzung helfen. Sie enthalten keinen vollständigen Timeworkerfehler;
|
||||||
|
|||||||
Reference in New Issue
Block a user