Commit Graph

91 Commits

Author SHA1 Message Date
Ray Greenwell 0e9b81404a Merge pull request #10 from fourbites/deserialization-fixes
Deserialization fixes
2026-03-20 13:16:06 -07:00
fourbites 84bed9e479 Class check cleanup 2026-03-20 20:53:26 +01:00
fourbites 1fd6240d09 Another class filtering fix 2026-03-20 15:41:04 +01:00
fourbites 35b8acb52a Allow L (array) types 2026-03-20 15:18:36 +01:00
fourbites c4ab0d13de Harden deserialization against malicious client input
Add three defenses to the Streamable deserialization system to prevent
exploitation by hacked clients:

- Class whitelist: ObjectInputStream.setAllowedClassPrefixes() validates
  class names before Class.forName(), blocking arbitrary class loading
  from crafted wire data. Callers configure at startup; unconfigured
  streams retain existing behavior for backward compatibility.

- Container size caps: BasicStreamers.validateSize() rejects arrays,
  collections, and maps with negative or >65536 element counts. Prevents
  OOM from a small frame declaring a massive allocation. Applied to all
  12 array/collection read paths and Streamer.ArrayStreamer.

- Recursion depth limit: ObjectInputStream.readObject() tracks nesting
  depth and throws at 32 levels, preventing stack overflow from
  maliciously nested structures (e.g., list-of-list-of-list).
2026-03-20 14:42:10 +01:00
fourbites 2a8db32013 Use keepalive and reduce ping interval
Some networks will kill connections sooner than 60s, especially if they are not using keepalive. This fix should reduce the random disconnects some players experience
2026-03-16 14:16:21 +01:00
Michael Bayne 91f1292ba4 Support Depot ByteEnum in Narya.
I don't think anything is directly streaming these over the wire, but it would
have worked before, so we'll try to keep it working now to avoid unpleasant
surprises.
2026-03-11 12:50:58 -07:00
Ray J. Greenwell 3b0af94757 Drive-by: remove redundant null check. 2026-03-03 14:10:55 -08:00
Ray J. Greenwell fbf3238f80 Have FieldEditor update on ElementUpdatedEvents; Require match NamedEvent!
- It would update if an AttributeChangedEvent was received, but not an
  ElementUpdatedEvent!

- If you have 50 fields and 50 editors, then every one was updating
  whenever an event arrived? Filter by the field that actually changed?
  Does this break something?
2026-03-03 14:10:55 -08:00
Ray J. Greenwell 6e464e132f Allow the reboot manager to specify a time zone...
A balance between: This is obnoxious, I should fix it in my subclass
and/or we should be compositing functionality, not subclassing... but
adding a time zone to this old thing seems fundamental anyway and this
is an easy fix.
2026-03-02 13:28:40 -08:00
Ray J. Greenwell 114bfd0460 Include the proper number of parens... how did this get by? 2026-02-25 11:44:51 -08:00
Ray J. Greenwell 7f3b45d2da Add a string to the ignoreable exceptions, for newer Java. 2026-02-24 14:01:49 -08:00
Ray J. Greenwell 45e5561460 InvocationProxy: View a *Provider instance as a *Service.
This is used on multi-noded servers so that I can have a service
interface for talking to the node in charge of a particular resource,
and use the same code path even if that node is the current node.

Perhaps this be more smoothly integrated in the future but for now it's
a static utility you need to manually set up.
2026-02-20 10:32:18 -08:00
Michael Bayne 794924e8a9 Revert "Avoid a concrete dependency on PresentsServer."
This reverts commit 938847bea9.

This didn't turn out to work well enough, so let's avoid unhelpful indirection.
2026-02-11 11:43:02 -08:00
Michael Bayne 938847bea9 Avoid a concrete dependency on PresentsServer.
ProjectX uses Guice to inject dependencies and this results in some random
manager having a dependency on the concrete server class, which invariably is
getting inject itself at the time this dependency has to be resolved, which
causes circular dependencies.

Guice was able to thread the needle with other sneaky business in some cases,
but also sometimes not. So let's give it a nice interface that it can proxy to
manage this particular circular dependency.
2026-02-11 09:59:23 -08:00
fourbites b6a687d2fa Fix IllegalAccessError crash
This was crashing when served from a webapp due to "IllegalAccessError". Lambda expressions seem to make it happy.
2026-01-03 19:45:40 +01:00
fourbites 4185d621f8 Prevent overlapping reboot warning messages
It's hard to say if this is the cause, but it won't hurt to clear existing intervals just in case.
2025-12-13 12:04:16 +01:00
Michael Bayne 0be130a383 Handle streaming of data manually.
We can no longer reflect on java.awt classes and fiddle with their internals.
2025-11-13 16:53:22 -08:00
Ray J. Greenwell 685468fd70 ConnectionManager can be configured to allow larger messages.
Messages that are too big are dropped and the clients have no hope of
recovering. Warnings are logged but that's it. Allow bigger.
2025-10-23 11:27:17 -07:00
Michael Bayne 859c7d197d Javadoc fixes. 2025-07-04 08:54:52 -07:00
Michael Bayne 61fd40f318 Streamline the source header. Update the copyright. 2025-04-03 13:21:33 -07:00
Michael Bayne 4c98299580 Add a default implementation. 2025-02-05 10:51:56 -08:00
Michael Bayne 24b54b8dc6 Added a soak test & isolated test for just fixed bug. 2018-09-26 15:34:12 -07:00
Michael Bayne 11e815fcc3 Do not use buffer limit as indicator of frame completion.
If the frame happens to be exactly the same size as the buffer capacity, we
will erroneously think that the last frame was complete because the limit is
normally at the buffer capacity.

This only exploded when we had both a perfectly sized frame and failed to read
it in a single call to read, which apparently took 17 years to happen, and many
billions of frames read.
2018-09-26 15:16:39 -07:00
Ray J. Greenwell ed7c071de1 Remove debuggery. 2018-09-26 15:12:59 -07:00
Ray J. Greenwell 2dcdcdb76a Also print buffer capacity. 2018-09-26 11:52:20 -07:00
Ray J. Greenwell 2003ed8ae1 Added logging to debug something... 2018-09-26 11:15:20 -07:00
Ray J. Greenwell 9c986bc4a9 Add hook for validating an outgoing connection.
Sometimes a present node uses a port to connect outwards that another
node is listening on.. I considered building-in some smarts for this
into the peer stuff, but for now at least I'll keep it simpler and
more flexible.
2018-09-24 12:54:25 -07:00
Ray J. Greenwell eaed4435b3 Downgrade unmapped connection logging to debug. 2018-05-09 10:56:05 -07:00
Ray J. Greenwell bfbe439942 Configure a larger invocation listener timeout between peers.
10 minutes now, up from 90 seconds. Overrideable in PeerNode to set
a different value.
2018-04-03 16:19:38 -07:00
Ray J. Greenwell 83dca54314 Spelling fix! 2018-03-22 16:31:13 -07:00
Ray J. Greenwell eea5f4343a Allow cross-region connections to use internal IPs. 2018-03-22 16:26:43 -07:00
Ray J. Greenwell 61bee1b160 Revert "Update javadoc with the truth about peers' internalHostName."
This reverts commit ec47182263.

Ummm? I misread the code? So embarassing. For some reason I thought it
was using the public hostname for all connections. Perhaps I misread
the 'hostName' local variable in a PeerNode method for the 'hostName'
in the record.
2018-01-05 15:20:29 -08:00
Ray J. Greenwell ec47182263 Update javadoc with the truth about peers' internalHostName. 2018-01-05 14:36:01 -08:00
Ray J. Greenwell 45c98d9446 Make authenticator static to work with newer guice. 2017-12-28 08:35:10 -08:00
Michael Bayne bbecc4c2fb Objects deprecated, use MoreObjects. 2015-03-12 11:44:12 -07:00
Michael Bayne 8493c455fb Various javadoc fixes. 2015-03-12 11:41:06 -07:00
Ray J. Greenwell e275c2ceda Added commented-out Java 6 improvements. 2015-01-21 10:26:52 -08:00
Ray J. Greenwell 39d1356e56 Occam's razor.
These String methods have been around since jdk1.1...
2015-01-20 17:23:20 -08:00
Jamie Doornbos 34f98e1c46 Javadoc fixes. 2014-11-14 10:20:11 -08:00
Michael Bayne 9d25489af1 Factor out wire format test.
We can't include things with unpredictable iteration order (sets, maps) in our
wire test, but we still want to test those things in our GIANT STREAMABLE CLASS
OF DOOM test. So we now have a separate wire format test which just ensures
that we don't spuriously break the encoding of things that should be
predictable.
2014-10-21 14:17:00 -07:00
Ray J. Greenwell e7537349c3 Document these constants better.
I've got half a mind to change the default to ORDINAL and let yohoho cope.
2014-08-06 10:44:21 -07:00
Sylvain Royer 7105977c49 Fix Narya build. 2014-03-21 14:38:48 -07:00
Sylvain Royer 5afb22cd6c Have default be a final constant, pass in message into chat identifier in case they need to check message type or something. 2014-03-21 14:10:12 -07:00
Sylvain Royer fb01d1d79a Remove import. 2014-03-21 13:05:54 -07:00
Sylvain Royer b9a3efc0b7 Add a source item in the chat history. This allows us to determine from which speak object this chat originated from. 2014-03-21 13:04:40 -07:00
Ray J. Greenwell 43d7e5b726 Drive-by: use one Entry for all logs. 2014-03-20 14:16:00 -07:00
Michael Bayne 8f94d9c329 Cast differently. 2014-01-23 14:24:26 -08:00
Michael Bayne 71e52d355e Added toArrayList().
If we're going to tell you to use an ArrayList instead of toArray(), let's make
that easy. This would be unnecessary if there was an ArrayList constructor that
took Iterable, but there isn't. And DSet is not a Collection.
2014-01-22 13:38:14 -08:00
Michael Bayne 5fb7ca15fc tools.properties should be in the tools submodule. 2014-01-22 13:04:38 -08:00