Skip to content

Add FileEntryMetadata to FileEntry for permissions, ownership, and special bits#196

Merged
gfs merged 6 commits intomainfrom
copilot/add-file-metadata-to-fileentry
Feb 12, 2026
Merged

Add FileEntryMetadata to FileEntry for permissions, ownership, and special bits#196
gfs merged 6 commits intomainfrom
copilot/add-file-metadata-to-fileentry

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

  • Create FileEntryMetadata class with nullable properties: Mode (long?), IsExecutable (bool?, derived), IsSetUid (bool?, derived), IsSetGid (bool?, derived), Uid (long?), Gid (long?)
  • Add Metadata property of type FileEntryMetadata? to FileEntry class (null by default)
  • Update TarExtractor to populate metadata from TarArchiveEntry.Mode, UserID, GroupId
  • Update ZipExtractor to populate metadata from ZipArchiveEntry.Attrib (Unix permissions from upper 16 bits)
  • Update RarExtractor to populate metadata from RarArchiveEntry.Attrib
  • Update SevenZipExtractor to populate metadata from SevenZipArchiveEntry.Attrib
  • Update ArFile to parse UID, GID, and mode from the ar header bytes (28-33: uid, 34-39: gid, 40-47: mode octal)
  • All Attrib property access wrapped in try-catch with trace logging including archive type and file path
  • Add tests for metadata extraction (8 tests: tar async/sync, ar async/sync, defaults, derived properties, setuid/setgid)
  • Restore nuget.config to original configuration
Original prompt

This section details on the original issue you should resolve

<issue_title>Add file metadata to FileEntry</issue_title>
<issue_description>It might be interesting to some consumers what the stated permissions and other metadata is available about the file. For example, some files could unzip with chmod +x and be executable.

This requires first to see what common factors are shared between SharpZipLib extracted entries, and also LibObjectFile file entries. For LibObjectFile entries reading real filesystems this is particularly interesting. Deciding on a new schema for FileEntry - either a number of fields or a FileMetadata object.

This is a feature request related to Attack Surface Analyzer.</issue_description>

<agent_instructions>Investigate adding this feature. I think the right way to do this would be to add a new property to FileEntry that itself has metadata attributes, so we can expand that over time without addition changes directly to the FileEntry interface. First you will need to investigate which attributes are available for each respective extractor type, I tihnk what we care about is the attributes that will persist when the file actually hits a disc (though, these attributes are only important when extracting to FileEntry via Lib for API consumers performing in memory analysis). Very important ones we should look for on all extractos when possible is if the extracted file will be marked executable, permissions, timestamps, setuid/setgid maybe? You can expand this if there are others that make sense. Also be sure to have sane default values that should make it clear that the attribute wasn't available to us (should it be null?), some formats afterall will not actually have all the same attributes available (or they may not be exposed by the APIs we are using for those formats). There are some extractors where we own the implementation (Ar files for example) which should also be pretty simple to recover much of this information from, but where we have to build the implementation.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 12, 2026 05:51
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
…Zip, and Ar extractors

Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Copilot AI changed the title [WIP] Add file metadata to FileEntry for better insights Add FileEntryMetadata to FileEntry for permissions, ownership, and special bits Feb 12, 2026
Copilot AI requested a review from gfs February 12, 2026 06:08
…bute reads

Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Copilot AI requested a review from gfs February 12, 2026 06:17
@gfs gfs marked this pull request as ready for review February 12, 2026 06:31
@gfs
Copy link
Contributor

gfs commented Feb 12, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@gfs gfs merged commit d791347 into main Feb 12, 2026
11 checks passed
@gfs gfs deleted the copilot/add-file-metadata-to-fileentry branch February 12, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add file metadata to FileEntry

3 participants