Fix AttributeError when a File entity has no name or friendlyName - #233
Draft
briandelmsft with Copilot wants to merge 3 commits into
Draft
Fix AttributeError when a File entity has no name or friendlyName#233briandelmsft with Copilot wants to merge 3 commits into
briandelmsft with Copilot wants to merge 3 commits into
Conversation
Co-authored-by: briandelmsft <68655382+briandelmsft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix AttributeError on file entity missing name and friendlyName
Fix AttributeError when a File entity has no name or friendlyName
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sentinel can attach File entities with empty
properties, e.g.:{ "kind": "File", "name": "61127ee5-...", "type": "Microsoft.SecurityInsights/Entities", "properties": {} }enrich_filesassumed a name was always present, sofile_fieldwasNoneand the base module failed withAttributeError: 'NoneType' object has no attribute 'split'.Changes (
modules/base.py)properties.friendlyNamenorNameresolves, the entity is skipped, following the same pattern already used for unparseable IP entities inenrich_ips.FilesCountis now derived fromlen(base_object.Files)after the loop (previouslylen(file_entities)), so it stays consistent with the enriched list once entities can be skipped — matchingIPsCount.Tests
tests/test_stat_base.py: added an offlinetest_enrich_filescovering a normal file, an entity with emptyproperties, and one with a nullfriendlyName, asserting only the valid entity is enriched andFiles/FilesCountagree.