relayer: AccountTransactions forwards an unvalidated Limit into aptos-go-sdk — Start != nil with a large Limit panics the plugin process
Los mantenedores suelen responder en 11 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Lee relayer/aptos_service.go alrededor de las líneas 142-161: la comprobación Limit == 0 está ahí, y Start/Limit se pasan directamente a client.AccountTransactions. Añade un límite superior que devuelva codes.InvalidArgument, refléjalo en capabilities/fakes/aptos_chain.go alrededor de la línea 252 y añade la prueba de regresión reportada en el paquete relayer para que compruebe un pánico de makeslice y cero RPC salientes. Ejecuta go test ./relayer/...; terminado significa que la prueba de límite sobredimensionado pasa y no ocurre ningún pánico del proceso.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
relayer: AccountTransactions forwards an unvalidated Limit into aptos-go-sdk — Start != nil with a large Limit panics the plugin process
Summary
aptosService.AccountTransactions (relayer/aptos_service.go:142) validates only
*req.Limit == 0 (:156) and forwards the caller-supplied Start/Limit verbatim to
aptos-go-sdk (client.AccountTransactions(sdkAddr, req.Start, req.Limit), :161).
When Start != nil, the SDK's transactionsConcurrent computes
numChannels = limit / 100 and executes
make([]chan ConcResponse[[]*api.CommittedTransaction], numChannels)
(aptos-go-sdk nodeClient.go:719/725) before issuing any RPC. With
Start = 0, Limit = 2^64-1 this is make(..., 184467440737095517) →
runtime error: makeslice: len out of range.
The relayer's LOOP gRPC server has no panic-recovery interceptor (the interceptors
installed by chainlink-common pkg/loop/telem.go are the CRE context pass-through
and Prometheus metrics), so the panic terminates the whole chainlink-aptos plugin
process rather than surfacing as a gRPC error.
Nothing in-tree currently forwards an unbounded Limit (see Current exposure), so
this is hardening ahead of the read capability becoming real — but the entire plumbing
(proto Limit *uint64, LOOP relayer service, aptosServer.AccountTransactions) is
already wired, and the Start != nil path has never been clamped: the
accountTransactionsWindow helper removed in #607 explicitly early-returned for
start != nil, so #607 neither introduced nor fixed this branch.
Repro
In-tree test at c0b9fb2 with aptos-go-sdk v1.14.0 (package relayer; the HTTP stub
only counts outbound requests):
func TestAccountTransactionsLargeLimitPanicsBeforeAnyRPC(t *testing.T) {
var reqs int64
srv := fakeFullnode(t, &reqs) // httptest server counting requests
svc := newService(t, srv.URL) // real aptosService over a real *aptos_sdk.NodeClient
var addr aptos.AccountAddress
addr[31] = 0xEE
start, limit := uint64(0), uint64(math.MaxUint64)
var recovered any
func() {
defer func() { recovered = recover() }()
_, _ = svc.AccountTransactions(context.Background(), aptos.AccountTransactionsRequest{
Address: addr, Start: &start, Limit: &limit,
})
}()
require.Contains(t, fmt.Sprint(recovered), "makeslice: len out of range")
require.Zero(t, atomic.LoadInt64(&reqs)) // zero outbound RPCs
}
End-to-end against the real binary (built with go build ./cmd/chainlink-aptos,
spawned via hashicorp/go-plugin with the standard relayer handshake, real NewRelayer
factory RPC, then one relayer.Aptos().AccountTransactions(start=0, limit=2^64-1) gRPC
call):
[INFO] chainlink-aptos-plugin: AccountTransactions: called: ... hasStart=true hasLimit=true
[ERROR] chainlink-aptos-plugin: panic: runtime error: makeslice: len out of range
[ERROR] plugin process exited: ... error="exit status 2"
[DEBUG] stdio: received EOF ... err="rpc error: code = Unavailable desc = error reading from server: EOF"
PLUGIN_EXITED=true
FULLNODE_REQS=0
Panic stack: grpc.Server.processRPC → _Aptos_AccountTransactions_Handler → aptosServer.AccountTransactions (chainlink-common pkg/loop/internal/relayer/aptos.go:180) → relayer.(*aptosService).AccountTransactions (relayer/aptos_service.go:161) → ratelimit.rateLimitedClient → aptos-go-sdk AccountTransactions → handleTransactions → transactionsConcurrent → make([]chan …) nodeClient.go:725 — no recover() anywhere
on that chain.
Negative control: same harness with Limit = 100 — process stays alive, 1 outbound
RPC, follow-up RPC succeeds. The kill is caused by the Limit value alone.
Sub-panic values are also a fan-out amplifier: Limit = 500_000 from one call spawned
limit/100 = 5_000 goroutines + queued RPCs (measured peak 10,794 goroutines vs a
baseline of 3).
The Start == nil branch is not crash-reachable today: the SDK first issues a probe
request carrying the raw limit, and a stock fullnode declares limit as Option<u16>
(aptos-core/api/src/page.rs), so Limit > 65535 fails fast with a parse error
(verified). Only the Start != nil branch reaches transactionsConcurrent directly.
Current exposure
- In-tree callers of the handler use fixed, bounded page sizes: LogPoller
(relayer/logpoller/tx_poller.go, internalbatchSize) and the forwarder tx-search. - The workflow-facing
aptos.AccountTransactionschain-read capability is currently
unimplementedinsmartcontractkit/capabilities
(chain_capabilities/aptos/actions/actions.go), so no workflow reaches this handler
through the capability path today. - The LOOP plugin gRPC surface is local to the node host process.
So today this is a robustness/hardening gap, not a live crash. The concern is that the
read plumbing is fully wired end-to-end — a future implementation of the aptos
chain-read capability (or any new internal caller that forwards a request-derived
Limit) lights this up immediately.
Suggested fix
Bound Limit in the handler before it reaches the SDK, on both branches, returning
InvalidArgument rather than clamping silently (consistent with the existing View
error handling):
const maxAccountTransactionsLimit = 10_000 // or fullnode max page-size × N
if req.Limit != nil {
if *req.Limit == 0 {
return &commonaptos.AccountTransactionsReply{}, nil
}
if *req.Limit > maxAccountTransactionsLimit {
return nil, status.Errorf(codes.InvalidArgument,
"limit %d exceeds maximum %d", *req.Limit, maxAccountTransactionsLimit)
}
}
The same bound should be applied to the capability-path fake at
capabilities/fakes/aptos_chain.go:252, which forwards input.Limit unbounded and
implements the same interface.
Independently, aptos-go-sdk's transactionsConcurrent derives its channel-slice size
purely from the caller's limit with no ceiling (numChannels = limit / 100 at
nodeClient.go:719, unchanged on current main) — every consumer of the SDK inherits
that; a cap there (plus bounding in-flight fan-out) would be defense-in-depth worth
filing upstream with aptos-labs.
Happy to open a PR for the handler + fake bound with the regression test above.
(Environment: clone at c0b9fb2 (HEAD of develop at time of writing),
aptos-go-sdk v1.14.0, chainlink-common v0.11.2-0.20260923164324-86cd57d9fdbd,
macOS/arm64.)
Disclosure: this report was drafted with AI assistance (Claude Code); the repro,
control run, and panic trace above were executed against a local clone at c0b9fb2.
- Lenguaje dominante
- Move
- Estrellas
- 10
- Forks
- 14
- Merge medio
- 8 d 13 h
- PR fusionados (30 d)
- 9
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de smartcontractkit/chainlink-aptos
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
smartcontractkit/chainlink-aptos#292 · 2 comentarios ·
Los mantenedores suelen responder en 11 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
smartcontractkit/chainlink-aptos#222 ·
Los mantenedores suelen responder en 11 días
Todos los issues de smartcontractkit/chainlink-aptos
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
fedora-infra/anitya#2272 ·
Los mantenedores suelen responder en 1 día
-
Appearance enhancement
Dificultad 2/5 Menos de una hora Aptitud para principiantes 62/100
novalo-dev/Prestashop-MCP-Server#487 ·
Los mantenedores suelen responder en 1 día
-
area/config comp/agent P2 type/perf
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
NousResearch/hermes-agent#161039 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
quickwit-oss/tantivy#3299 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día