Honestly and I know it happens, I do not know
Good question, I don't think I have ever seen a thief try and scavenge my stuff. I always try and make sure that anything I have is not easy to see as I think a thief is more inclined to help themselves if they can see something to investigate.
I think they looked at locking code in game recently but would still need to make a vehicle in the newer version to confirm
Although I assume if you are going to leave something unattended best to manually lock it just in case. I assume that it works manually like a car cubby that can open and close, but you would need the physical key to lock it. So more like your door scenario if you want to be safe although it is probably lower priority on the npc thief list.
Personally I think locking your doors and cover windows would prevent thieving. If you are using the cargo locks on the outside, if you can lock it, then lock it when leaving loot you don't want to take a chance with.
I have never had to deal with any thieves before. Even when I made a 3x3 wood car cart with vehicle shelving on the side in the open( blaze industries mod) not saying it won't happen just that I havent had it happen to me.
Update: installed a door lock and it required manual locking so by that logic cargo locks would need to be the same.