Files
reverse-engineering-anything/tests/acceptance/tools
Ysopwnableandgensokyo-dev e5004c11ea feat(managed): recover protobuf descriptors from .NET assemblies (#17287)
* feat(managed): describe the protobuf descriptor recovery report and its budget

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(managed): recover protobuf descriptors from generated Reflection classes

Google.Protobuf's generated <File>Reflection classes build each
FileDescriptorProto in a static constructor that concatenates string
literals and passes them to System.Convert.FromBase64String. Read those
literals from the CIL in order, decode each site and keep the results that
parse as FileDescriptorProtos, byte for byte. A FileDescriptorSet lists
them dependencies first, with the well-known protobuf files they import;
other imports are named as missing. Literal characters count against
max_descriptor_bytes before they are joined. Nothing is loaded or run.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(managed): report descriptor recovery refusals as parse failures

A metadata representation budget stops the whole call as a named limit,
including inside one static constructor; other managed reader refusals
become malformed or unsupported input.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(managed): recover protobuf descriptors through an identity-checked provider

The provider reads one bounded managed assembly. A refusal at
max_descriptor_bytes, max_metadata_representation_bytes or
max_snapshot_bytes names the control to raise.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(analysis): summarize retained protobuf descriptor recovery

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(managed): add the recover_protobuf_descriptors tool

CLI recover-protobuf-descriptors and MCP recover_protobuf_descriptors
return each embedded .proto file's package, imports, messages, enums and
services, and a FileDescriptorSet for decoding captured payloads. Large
reports return the retained per-file summary within the agent budget.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* test(managed): cover protobuf descriptor recovery through the service, MCP and CLI

The protoc-style assembly fixture moves to tests/fixtures so the unit,
MCP and CLI tests share it.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(managed): describe protobuf descriptor recovery

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(skill): route Google.Protobuf assemblies to recover_protobuf_descriptors

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* ci: scope protobuf descriptor recovery with the managed formats

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* chore(schemas): record the advertised recover_protobuf_descriptors catalog summary

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(managed): attribute, bound and account for every descriptor search

- Static constructors are found among physical MethodDef rows and named by
  the shared ownership lookup, so a MethodPtr table cannot attribute a
  descriptor to the wrong type.
- A FileDescriptorProto's wire form is walked along its schema first, and
  every nested message it would create is charged to the representation
  budget before protobuf-es decodes it.
- A body whose CIL was not fully decoded, and malformed member lists, make
  coverage partial instead of looking searched.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* test(managed): build descriptor fixtures in protoc's String.Concat shapes

The fixture's static constructor now joins its literals through
String.Concat, as arguments or a string[], before calling
FromBase64String with its real static byte[](string) signature; the
managed PE fixture can name each MemberRef row. Tests cover both forms
and the descriptor tree bound.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(analysis): sample missing imports in the protobuf descriptor summary

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(managed): save the descriptor set from complete delivery and fail on null

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(managed): name the descriptor nesting limit instead of rejecting deep files

The nesting cutoff is now the max_descriptor_depth control (100 by
default, up to 1,000). A deeper descriptor stops the call with a named
limit rather than being listed as not a descriptor, and protobuf-es
decodes up to the same depth so it cannot refuse what the walk admitted.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* docs(managed): list the descriptor depth budget and record its schema

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-06 08:42:26 +08:00
..