PrismarineJS / PrismarineJS/node-minecraft-protocol

`setPreviouslyAcknowledged()` stores an array length instead of the acknowledgement list

Open Beginner friendly
#1,535 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.4k
Forks
290
Avg merge
4d 8h
Merged PRs (30d)
7

Description

Version: current master at 0ebdd5120eca8840e3ffd6597cd4e83732b59c9a (minecraft-protocol 1.68.0)

In Pending.setPreviouslyAcknowledged():

this.lastSeen = lastSeen.map(e => Object.values(e)).push(Object.values(lastRejected))

Array.prototype.push() returns the new array length, not the array. After this runs, this.lastSeen is a number. On the next validation that contains at least one lastSeen entry, previouslyAcknowledged() calls:

this.lastSeen.some(...)

which throws TypeError: this.lastSeen.some is not a function.

Expected: lastSeen stays an array containing the mapped entries and the lastRejected entry.

A direct form would be:

this.lastSeen = [...lastSeen.map(e => Object.values(e)), Object.values(lastRejected)]

This is in the signed-chat acknowledgement path for 1.19.1+ servers with enforceSecureProfile enabled.

Relevant code: https://github.com/PrismarineJS/node-minecraft-protocol/blob/0ebdd5120eca8840e3ffd6597cd4e83732b59c9a/src/server/chat.js#L266-L272

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/server/chat.js around lines 266-272 and read Pending.setPreviouslyAcknowledged() together with previouslyAcknowledged(). Verify the acknowledgement state remains an array containing the mapped lastSeen entries and lastRejected entry, then exercise validation with at least one lastSeen entry to confirm it no longer throws when calling some().

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
92/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.