Skip to content

fix: guard symbol collection against 4.72.2 validation constraints - #180

Merged
vgoat21 merged 3 commits into
fix/vendor-lock-driftfrom
fix/sdk-472-validation
Oct 20, 2026
Merged

vgoat21 merged 3 commits into
fix/vendor-lock-driftfrom
fix/sdk-472-validation

Conversation

@vgoat21

@vgoat21 vgoat21 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Stack: #178 → #179 → this → (endpoints PR). Merge in order, or retarget as each lands.

Why

4.72.2 added client-side pydantic constraints to two models the plugin constructs by hand. These raise ValidationError at construction where 4.20.0 silently accepted the value:

FunctionBoundary.mangled_name   StrictStr -> Annotated[str, Field(min_length=1, max_length=4096)]
FunctionBoundary.start_address  StrictInt -> Annotated[int, Field(ge=0)]
FunctionBoundary.end_address    StrictInt -> Annotated[int, Field(ge=0)]
Symbols.base_address            StrictInt -> Annotated[int, Field(ge=0)]
Symbols.function_boundaries     List[...] -> Annotated[List[...], Field(max_length=200000)]

collect_symbols_from_ida fed idc.get_func_name() straight into mangled_name. That returns "" for an unnamed function, which now fails min_length=1 and raises out of the entire collection pass — upload breaks outright on any binary containing one unnamed function. The boundary list was also unbounded, and a negative image base would trip ge=0.

This is the one part of the 4.72.2 upgrade that is a live crash rather than a deprecation warning, which is why it is its own PR ahead of the endpoint migration.

What

  • build_function_boundary — skips a boundary with no name rather than inventing one, truncates over-long names to 4096.
  • build_symbols — clamps the base address to >= 0 and caps the list at 200000.
  • Both skip and cap paths log a warning, so truncation is never silent.

Extracting the two builders also makes the constraints testable without a live IDA database — the new tests are pure unit tests, no idalib.

Verification

Green in isolation on this branch (not just on top of the endpoints PR):

521 passed, 3 skipped     (baseline 511 — +10 new tests)

Covering: empty mangled_name, over-long mangled_name, negative addresses, and the >200000 cap.

🤖 Generated with Claude Code

vgoat21 and others added 2 commits October 20, 2026 10:33
revengai 4.72.2 tightened the pydantic constraints on two models the plugin
constructs by hand:

  FunctionBoundary.mangled_name   StrictStr -> min_length=1, max_length=4096
  FunctionBoundary.start_address  StrictInt -> ge=0
  FunctionBoundary.end_address    StrictInt -> ge=0
  Symbols.base_address            StrictInt -> ge=0
  Symbols.function_boundaries     List      -> max_length=200000

collect_symbols_from_ida fed idc.get_func_name() straight into mangled_name.
That returns "" for an unnamed function, which now fails min_length=1 and
raises ValidationError out of the whole collection pass -- so upload would
break outright on any binary containing one. The boundary list was also
unbounded, and a negative image base would trip ge=0.

Skip boundaries with no name rather than inventing one, truncate over-long
names, clamp the base address, and cap the list, warning when either the skip
count or the cap is non-zero so the truncation is not silent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
revengai 4.72.2 marks 85 operations deprecated, up from 25. Eight of the nine
the plugin called now emit a DeprecationWarning at call time and have a v3
successor; this moves them over.

Every v2 operation returned a BaseResponseX envelope with a .data attribute.
Every v3 operation returns a flat *OutputBody. So each migration is: swap the
method, drop the .data unwrap, remap fields.

  ConfigApi.get_config                  -> ConfigApi.v3_get_config
  AnalysesCoreApi.get_analysis_status   -> AnalysesCoreApi.v3_get_analysis_operation
  AnalysesCoreApi.get_analysis_function_map
                                        -> FunctionsCoreApi.v3_get_analysis_func_maps
  AnalysesCoreApi.list_analyses         -> AnalysesCoreApi.v3_list_analyses
  AnalysesCoreApi.upload_file           -> BinariesApi.v3_upload_file
  SearchApi.search_binaries             -> BinariesApi.v3_search_binaries
  SearchApi.search_collections          -> CollectionsApi.v3_list_collections
  FunctionsAIDecompilationApi.upsert_ai_decompilation_rating
                                        -> ..._api.v3_upsert_ai_decompilation_rating

Notes on the non-obvious ones:

SearchApi is now deprecated in its entirety -- it has zero non-deprecated
operations. Binary search moves to GET /v3/binaries and collection search to
GET /v3/collections; both swap page/page_size for limit/offset.
CollectionListItemBody renames six fields off CollectionSearchResult
(scope, last_updated_at, created_at, owned_by, tags, size).

Analysis status moves to the long-running-operation endpoint
GET /v3/operations/analyses/{analysis_id}, whose CreateMetadata.status carries
the same platform status string v2 returned, so the Complete/Error state
machine is unchanged.

v3_upload_file drops packed_password. That parameter was dead plumbing here:
declared and threaded between _upload_file_req and upload_user_file but never
supplied by any caller. Archive passwords moved to the sandbox side of the
platform (SandboxConfig.archive_password), so it is removed rather than
reimplemented.

Also handle the types_applied AI-decompilation stream event, new in 4.72.2 as
the EventTypesApplied oneOf variant. The hand-rolled SSE parser keys off event
names and had no branch for it, so those events were dropped silently.

AnalysesCoreApi.create_analysis stays on v2: POST /v2/analyses is deprecated
but has no v3 successor in the live v4.73.0 spec. It is now the only deprecated
SDK call left in the plugin. The remaining /v2 calls -- IAMUsersApi.get_me and
the seven ConversationsApi operations -- are not deprecated and have no /v3
paths in the spec.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
refactor: migrate the deprecated v2 endpoints onto v3
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.

1 participant