The only chests that I’m sure are safe are directly in the ship cabin; the chests found in the hold are probably not safe as they will probably despawn.
Some cabins have several chests, some only have one, but items stored in any of the cabin chests will remain forever. If you switch from a cabin with multiple chests, to a cabin with only one, your items from the several chests will be preserved and consolidated into the one chest.
We also added a feature to bury a chest on any of the remote shores. If you find or buy a shove/spade and a storage chest, on any of the remote shores, you can select the “talk to self” dialog and choose to bury; either you or any of your companion fighters can be carrying the shovel and chest to do this. Any time you want that stuff back, carry a shovel (or your fighters carry the shovel), find your spot (you have to remember where, but a log entry will at least tell you the shore that you stored some loot).