fix(crypto): deprecate events field in shielded TRC20 scan APIs#6683
fix(crypto): deprecate events field in shielded TRC20 scan APIs#6683Federico2014 wants to merge 1 commit intotronprotocol:developfrom
Conversation
3335e0b to
53beedf
Compare
| ivkDecryptTRC20Parameters.getEventsList()); | ||
| ivkDecryptTRC20Parameters.getNk().toByteArray()); | ||
| response.getWriter().println(convertOutput(notes, params.isVisible())); | ||
| } catch (IllegalArgumentException e) { |
There was a problem hiding this comment.
[SHOULD] This catch scope is broader than the deprecation path itself. It will also turn unrelated IllegalArgumentException subclasses into HTTP 400 responses, for example NumberFormatException from Long.parseLong(...) in doGet and other IllegalArgumentException cases from JsonFormat.merge(...) in doPost. That expands the behavior change beyond "reject deprecated events". Please short-circuit the deprecated-field path directly, or use a dedicated exception type so only the events rejection is mapped to 400.
Same issue also applies to the corresponding catch blocks in ScanShieldedTRC20NotesByOvkServlet.
There was a problem hiding this comment.
Thanks for flagging this. On reflection, I think the broader catch scope may actually be the right behavior here — before this PR, NumberFormatException from invalid query parameters fell through to catch (Exception) which returned HTTP 200 with an error body (since Util.processError doesn't set a status code). Returning 400 for malformed client input seems more semantically correct. Would you agree, or do you still feel we should narrow the scope to the deprecation path only?
|
[SHOULD] The new rejection coverage is currently gRPC-only, but HTTP 400 is also part of the external contract introduced by this PR. Please add servlet-level regression tests for |
53beedf to
63fe9fd
Compare
|
@waynercheung Fixed. Added For the Solidity/PBFT wrappers: |
What does this PR do?
Deprecates the
eventsfield in shielded TRC20 scan API requests and removes server-side log-type filtering.eventsfield as[deprecated = true]inIvkDecryptTRC20ParametersandOvkDecryptTRC20Parametersrequest messages inapi.protoINVALID_ARGUMENT, HTTP returns 400 when the deprecatedeventsfield is populatedtopicListparameter from internal method signatures inWallet,RpcApiService, and HTTP servlet handlers (ScanShieldedTRC20NotesByIvkServlet,ScanShieldedTRC20NotesByOvkServlet)Why are these changes required?
The
eventsfield allowed callers to filter shielded TRC20 event classes by passing user-controlled log topic strings that were hashed and matched server-side. This was an unnecessary attack surface — callers should always scan all log types and filter client-side. Removing the field simplifies the API contract and eliminates potential information leakage through selective scanning.scanShieldedTRC20NotesByIvk/Ovk— theeventsrequest field is now rejected outright (INVALID_ARGUMENTon gRPC, HTTP 400). Clients still sending the field must remove it. Clients that relied on the field to limit scan scope will now receive results for all log types.This PR has been tested by:
RpcApiServicesTest,WalletMockTest,ShieldedTRC20BuilderTest./gradlew clean build)Follow up
No consensus logic or on-chain state transitions affected.
Extra details