These failures are rare, but when they do happen it's catastrophic. Properly designed hub do normally have a retention cap of some kind. I think the best way to serure a hub like this by yourself would be with a custom 3d printed cap. If that's not an option you could cut some tape to fir over the flanges, or something else that's pliable enough and attach it some way. Depending on your specific flange, glue, zip ties, screws, etc. could work