slackapi / slackapi/java-slack-sdk
Deserialization on attachment id as Integer out of range
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 602
- Forks
- 232
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 7
Description
Slack has generated attachments with id values that cannot be parsed into Java Integers. As a result, the Bolt SDK fails when reading those messages.
Team: T34263EUF / E7T5PNK3P
Channel: C08KGS622HL
Message TS: 1746210816.491199
"attachments": [
{
...
"id": 8861161648288
}
]
Reproducible in:
The Slack SDK version
1.45.2
Java Runtime version
17
OS info
n/a
Steps to reproduce:
Deserializing a message with an attachment that has an id that is too large for a Java Integer fails.
Expected result:
Parsing succeeds
Actual result:
An exception is thrown:
java.lang.NumberFormatException: Expected an int but was 8861161648288 at line 157 column 26 path $.attachments[0].id
com.google.gson.JsonSyntaxException:
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:229)
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:219)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.Gson.fromJson(Gson.java:963)
at com.google.gson.Gson.fromJson(Gson.java:928)
at com.google.gson.Gson.fromJson(Gson.java:877)
at com.google.gson.Gson.fromJson(Gson.java:848)
Requirements
Please make sure if this topic is specific to this SDK. For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the attachment model and the Gson deserialization path used for Slack messages. Reproduce the issue with the attachment id shown in the report, then add coverage for an out-of-range id. Done means messages containing that id deserialize successfully without the reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100