apache / apache/rocketmq

[Bug] Proxy gRPC ack accepts empty entries until IndexOutOfBoundsException

Open Beginner friendly
#10,678 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

### Before Creating the Bug Report

- [x] I have searched the existing issues and pull requests.

### Runtime platform environment

All platforms.

### RocketMQ version

develop branch.

### JDK Version

Not applicable.

### Describe the Bug

`AckMessageActivity.ackMessage` reads the first ack entry before validating that the request contains any entries:

```java
boolean isBatchAck = ConfigurationManager.getProxyConfig().isEnableBatchAck()
&& !request.getEntries(0).hasLiteTopic();
```

If a gRPC client sends an `AckMessageRequest` with an empty `entries` list, this path throws an `IndexOutOfBoundsException`. That makes an invalid client request look like an internal Proxy failure instead of a structured gRPC bad-request response.

### Steps to Reproduce

1. Send an `AckMessageRequest` with valid `topic` and `group`, but no `entries`.
2. Let Proxy handle the request through `AckMessageActivity.ackMessage`.
3. `request.getEntries(0)` is evaluated before entry-count validation.

### What Did You Expect to See?

Proxy should reject the request with a structured client-side error, for example `GrpcProxyException(Code.BAD_REQUEST, "ack message entries cannot be empty")`.

### What Did You See Instead?

Proxy throws `IndexOutOfBoundsException` while trying to access the first entry.

### Additional Context

This is a small gRPC Proxy request validation hardening issue. It keeps invalid client input from surfacing as an internal server error and makes the behavior easier for clients and operators to diagnose.

Contributor guide

Open the contributing guide

Research direction

Start in AckMessageActivity.ackMessage and trace how AckMessageRequest entries are validated before the first entry is read. Reproduce the request with valid topic and group but an empty entries list, then verify that Proxy returns a structured GrpcProxyException with a BAD_REQUEST code instead of IndexOutOfBoundsException.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, java
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.