Trim the commentary the security pass left behind

This commit is contained in:
Johnny Shaw
2026-09-09 21:45:18 -06:00
parent b1e78d0a16
commit 4955bcf426
9 changed files with 6 additions and 37 deletions
-1
View File
@@ -1030,7 +1030,6 @@ NTSTATUS PhGetSMBIOSString(
if (!string->Buffer)
return STATUS_INVALID_PARAMETER;
// The conversion may return null, and success here promises the caller a string.
if (!(*String = PhConvertUtf8ToUtf16Ex(string->Buffer, string->Length)))
return STATUS_UNSUCCESSFUL;
-1
View File
@@ -5586,7 +5586,6 @@ NTSTATUS PhGetMappedImageDebug(
Debug->MappedImage = MappedImage;
Debug->DataDirectory = dataDirectory;
Debug->DebugDirectory = debugDirectory;
// The walk stops at the first entry that is not there, so what was filled is what may be read.
Debug->NumberOfEntries = (ULONG)PhFinalArrayCount(&debugEntryArray);
Debug->DebugEntries = PhFinalArrayItems(&debugEntryArray);
-2
View File
@@ -865,8 +865,6 @@ NTSTATUS PhGetProcessUnloadedDlls(
goto CleanupExit;
}
// The stride is the target's own ntdll data, and every caller reads a whole element at it, so
// anything shorter than one element cannot be walked at all.
if (capturedElementSize < sizeof(RTL_UNLOAD_EVENT_TRACE))
{
status = STATUS_INVALID_BUFFER_SIZE;
+5 -4
View File
@@ -182,10 +182,11 @@ VOID AtpAppendStdioClients(
{
PPH_STRING name;
// Built and neutralised on its own: the process item's name is shared, so it must not
// be edited where it lies.
name = PhFormatString(L"%s (%lu)",
PhGetStringOrDefault(processItem->ProcessName, L"unknown"), HandleToUlong(processId));
name = PhFormatString(
L"%s (%lu)",
PhGetStringOrDefault(processItem->ProcessName, L"unknown"),
HandleToUlong(processId)
);
AtSanitizeDisplayString(name);
PhAppendStringBuilder(Builder, &name->sr);
+1 -1
View File
@@ -1103,7 +1103,7 @@ CONST AT_TOOL AtTools[] =
"\"outputSchema\":{\"type\":\"object\",\"properties\":{"
AT_PROCESS_IDENTITY_SCHEMA ","
"\"mitigations\":{\"type\":\"object\",\"description\":\"One member per policy; each is an object of flags, or null when that policy could not be read\",\"properties\":{"
"\"aslr\":{\"type\":[\"object\",\"null\"],\"properties\":{\"bottom_up_randomization\":{\"type\":\"boolean\"},\"disallow_stripped_images\":{\"type\":\"boolean\"},\"force_relocate_images\":{\"type\":\"boolean\"},\"high_entropy\":{\"type\":\"boolean\"}}},"
"\"dynamic_code\":{\"type\":[\"object\",\"null\"],\"properties\":{\"allow_remote_downgrade\":{\"type\":\"boolean\"},\"allow_thread_opt_out\":{\"type\":\"boolean\"},\"audit_prohibit_dynamic_code\":{\"type\":\"boolean\"},\"prohibit_dynamic_code\":{\"type\":\"boolean\"}},\"description\":\"prohibit_dynamic_code stops the process generating or modifying executable code\"},"
"\"strict_handle_check\":{\"type\":[\"object\",\"null\"],\"properties\":{\"handle_exceptions_permanently_enabled\":{\"type\":\"boolean\"},\"raise_exception_on_invalid_handle_reference\":{\"type\":\"boolean\"}}},"
-3
View File
@@ -568,9 +568,6 @@ VOID AtpResolveLauncher(
times.CreateTime.QuadPart == Hello->LauncherStartTime.QuadPart)
{
PhGetProcessImageFileNameWin32(processHandle, &Connection->LauncherImageName);
// A file name may legally carry the overrides that make it display as another name, and
// the launcher is whatever the caller chose to start the broker from.
AtSanitizeDisplayString(Connection->LauncherImageName);
}
-5
View File
@@ -729,7 +729,6 @@ NTSTATUS AtpResolveTargetParameter(
return STATUS_SUCCESS;
}
// The value is the caller's, and it is shown to the user and written to the audit log.
AtSanitizeDisplayString(text);
*Parameter = text;
@@ -896,7 +895,6 @@ PPH_STRING AtFormatTargetHeadline(
PhClearReference(&process);
// Process, service and device names are chosen by whoever created them, not by us.
AtSanitizeDisplayString(result);
return result;
@@ -984,7 +982,6 @@ PPH_STRING AtFormatTargetDescription(
break;
}
// Image paths, signer names, object names and user names all come from elsewhere.
result = PhFinalStringBuilderString(&builder);
AtSanitizeDisplayString(result);
@@ -1023,8 +1020,6 @@ PPH_STRING AtFormatTargetAudit(
}
PhDereferenceObject(headline);
// The headline arrives clean; the image path appended to it does not.
AtSanitizeDisplayString(result);
return result;
-2
View File
@@ -217,8 +217,6 @@ PSTORAGE_DEVICE_DESCRIPTOR AtpQueryDiskDescriptor(
return NULL;
}
// Every string offset is measured against the size the device wrote into the buffer, so that
// size has to lie inside what the call actually returned.
if (descriptor->Size > returnedLength)
{
PhFree(descriptor);
-18
View File
@@ -893,13 +893,6 @@ PPH_STRING AtGetArgumentString(
return PhGetJsonValueAsString(Arguments, Key);
}
/**
* Requires a file name from the caller to name a local drive.
*
* A UNC or device path would have System Informer open it, elevated, from wherever the caller
* chose, and parse whatever came back. A path that was not supplied is left alone: whether one was
* required is the tool's own question, asked before this.
*/
BOOLEAN AtCheckDriveAbsolutePath(
_In_opt_ PPH_STRING Path,
_Inout_ PAT_TOOL_RESULT Result
@@ -918,15 +911,6 @@ BOOLEAN AtCheckDriveAbsolutePath(
return FALSE;
}
/**
* Answers whether a character may not appear in text the user is shown.
*
* The C0 range and delete are the obvious ones. The rest are the characters that change how the
* text around them reads rather than adding anything of their own: the bidirectional overrides and
* embeddings, which can make a name display in reverse; the zero-width joiners and the zero-width
* no-break space, which hide a join; and the separators Windows controls treat as a line break,
* which would let text from elsewhere push its own line into a consent prompt.
*/
BOOLEAN AtIsUnsafeDisplayChar(
_In_ WCHAR Character
)
@@ -965,8 +949,6 @@ BOOLEAN AtIsUnsafeDisplayChar(
return FALSE;
}
// Neutralises in place, so the string must be unshared. Nothing is truncated and nothing is
// re-worded: the user is shown the whole value, only unable to be lied to by its characters.
VOID AtSanitizeDisplayString(
_In_opt_ PPH_STRING String
)