Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
Fix unsigned commands detected as signed (#1082)
* fix: commands flagged as signed without signed arguments * feat: improve error message for illegal protocol state.
Dieser Commit ist enthalten in:
Ursprung
1cc3f120ee
Commit
0d9a097a59
@ -49,4 +49,12 @@ public class LastSeenMessages {
|
|||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return acknowledged.isEmpty();
|
return acknowledged.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "LastSeenMessages{" +
|
||||||
|
"offset=" + offset +
|
||||||
|
", acknowledged=" + acknowledged +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class KeyedCommandHandler implements CommandHandler<KeyedPlayerCommand> {
|
|||||||
&& playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
|
&& playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
|
||||||
logger.fatal("A plugin tried to deny a command with signable component(s). "
|
logger.fatal("A plugin tried to deny a command with signable component(s). "
|
||||||
+ "This is not supported. "
|
+ "This is not supported. "
|
||||||
+ "Disconnecting player " + player.getUsername());
|
+ "Disconnecting player " + player.getUsername() + ". Command packet: " + packet);
|
||||||
player.disconnect(Component.text(
|
player.disconnect(Component.text(
|
||||||
"A proxy plugin caused an illegal protocol state. "
|
"A proxy plugin caused an illegal protocol state. "
|
||||||
+ "Contact your network administrator."));
|
+ "Contact your network administrator."));
|
||||||
@ -75,7 +75,7 @@ public class KeyedCommandHandler implements CommandHandler<KeyedPlayerCommand> {
|
|||||||
&& playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
|
&& playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
|
||||||
logger.fatal("A plugin tried to change a command with signed component(s). "
|
logger.fatal("A plugin tried to change a command with signed component(s). "
|
||||||
+ "This is not supported. "
|
+ "This is not supported. "
|
||||||
+ "Disconnecting player " + player.getUsername());
|
+ "Disconnecting player " + player.getUsername() + ". Command packet: " + packet);
|
||||||
player.disconnect(Component.text(
|
player.disconnect(Component.text(
|
||||||
"A proxy plugin caused an illegal protocol state. "
|
"A proxy plugin caused an illegal protocol state. "
|
||||||
+ "Contact your network administrator."));
|
+ "Contact your network administrator."));
|
||||||
@ -95,7 +95,7 @@ public class KeyedCommandHandler implements CommandHandler<KeyedPlayerCommand> {
|
|||||||
&& playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
|
&& playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
|
||||||
logger.fatal("A plugin tried to change a command with signed component(s). "
|
logger.fatal("A plugin tried to change a command with signed component(s). "
|
||||||
+ "This is not supported. "
|
+ "This is not supported. "
|
||||||
+ "Disconnecting player " + player.getUsername());
|
+ "Disconnecting player " + player.getUsername() + ". Command packet: " + packet);
|
||||||
player.disconnect(Component.text(
|
player.disconnect(Component.text(
|
||||||
"A proxy plugin caused an illegal protocol state. "
|
"A proxy plugin caused an illegal protocol state. "
|
||||||
+ "Contact your network administrator."));
|
+ "Contact your network administrator."));
|
||||||
|
@ -47,7 +47,7 @@ public class SessionCommandHandler implements CommandHandler<SessionPlayerComman
|
|||||||
if (packet.isSigned()) {
|
if (packet.isSigned()) {
|
||||||
logger.fatal("A plugin tried to deny a command with signable component(s). "
|
logger.fatal("A plugin tried to deny a command with signable component(s). "
|
||||||
+ "This is not supported. "
|
+ "This is not supported. "
|
||||||
+ "Disconnecting player " + player.getUsername());
|
+ "Disconnecting player " + player.getUsername() + ". Command packet: " + packet);
|
||||||
player.disconnect(Component.text(
|
player.disconnect(Component.text(
|
||||||
"A proxy plugin caused an illegal protocol state. "
|
"A proxy plugin caused an illegal protocol state. "
|
||||||
+ "Contact your network administrator."));
|
+ "Contact your network administrator."));
|
||||||
@ -63,7 +63,7 @@ public class SessionCommandHandler implements CommandHandler<SessionPlayerComman
|
|||||||
if (packet.isSigned()) {
|
if (packet.isSigned()) {
|
||||||
logger.fatal("A plugin tried to change a command with signed component(s). "
|
logger.fatal("A plugin tried to change a command with signed component(s). "
|
||||||
+ "This is not supported. "
|
+ "This is not supported. "
|
||||||
+ "Disconnecting player " + player.getUsername());
|
+ "Disconnecting player " + player.getUsername() + ". Command packet: " + packet);
|
||||||
player.disconnect(Component.text(
|
player.disconnect(Component.text(
|
||||||
"A proxy plugin caused an illegal protocol state. "
|
"A proxy plugin caused an illegal protocol state. "
|
||||||
+ "Contact your network administrator."));
|
+ "Contact your network administrator."));
|
||||||
@ -87,7 +87,7 @@ public class SessionCommandHandler implements CommandHandler<SessionPlayerComman
|
|||||||
if (packet.isSigned()) {
|
if (packet.isSigned()) {
|
||||||
logger.fatal("A plugin tried to change a command with signed component(s). "
|
logger.fatal("A plugin tried to change a command with signed component(s). "
|
||||||
+ "This is not supported. "
|
+ "This is not supported. "
|
||||||
+ "Disconnecting player " + player.getUsername());
|
+ "Disconnecting player " + player.getUsername() + ". Command packet: " + packet);
|
||||||
player.disconnect(Component.text(
|
player.disconnect(Component.text(
|
||||||
"A proxy plugin caused an illegal protocol state. "
|
"A proxy plugin caused an illegal protocol state. "
|
||||||
+ "Contact your network administrator."));
|
+ "Contact your network administrator."));
|
||||||
|
@ -65,7 +65,8 @@ public class SessionPlayerCommand implements MinecraftPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSigned() {
|
public boolean isSigned() {
|
||||||
return salt != 0 || !lastSeenMessages.isEmpty() || !argumentSignatures.isEmpty();
|
if (salt == 0) return false;
|
||||||
|
return !lastSeenMessages.isEmpty() || !argumentSignatures.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -73,6 +74,17 @@ public class SessionPlayerCommand implements MinecraftPacket {
|
|||||||
return handler.handle(this);
|
return handler.handle(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SessionPlayerCommand{" +
|
||||||
|
"command='" + command + '\'' +
|
||||||
|
", timeStamp=" + timeStamp +
|
||||||
|
", salt=" + salt +
|
||||||
|
", argumentSignatures=" + argumentSignatures +
|
||||||
|
", lastSeenMessages=" + lastSeenMessages +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
public static class ArgumentSignatures {
|
public static class ArgumentSignatures {
|
||||||
|
|
||||||
private final List<ArgumentSignature> entries;
|
private final List<ArgumentSignature> entries;
|
||||||
@ -104,6 +116,12 @@ public class SessionPlayerCommand implements MinecraftPacket {
|
|||||||
entry.encode(buf);
|
entry.encode(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ArgumentSignatures{" +
|
||||||
|
"entries=" + entries +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ArgumentSignature {
|
public static class ArgumentSignature {
|
||||||
@ -120,5 +138,12 @@ public class SessionPlayerCommand implements MinecraftPacket {
|
|||||||
ProtocolUtils.writeString(buf, name);
|
ProtocolUtils.writeString(buf, name);
|
||||||
buf.writeBytes(signature);
|
buf.writeBytes(signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ArgumentSignature{" +
|
||||||
|
"name='" + name + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren