OnePlus is one of the few manufacturers that let you keep your warranty if you unlock the bootloader and flash custom ROMs. Now, thanks to the developers you can now root and install TWRP custom recovery on your brand new OnePlus 5.
TWRP 3.1.1 is now available for the OnePlus 5. A custom recovery can be used to flash zips, install new custom ROMs, root, take backup and much more.
You'll need to unlock bootloader first in-order to Root and Install TWRP recovery. Note that Unlocking bootloader will erase all your data. So head to the XDA Developer forum to grab the TWRP recovery.