Because of the nature of transportation and the use of hostages to leverage the U.S. and European governments, international terrorism has become part of travel. Fortunately Costa Rica is not a prime target.
There is almost no connection with the hatred in the Middle East and Islamic extremism, and unlike many Central and South American countries there is no violent opposition to the national government.
The increase in drug trafficking has lead to an increase in associated violent crimes and every few weeks someone is found executed. It’s generally limited to San José and drug deals gone wrong out in the boonies. So far no tourist have been involved in this kind of violence and it has not escalated to the levels seen in Mexico where whole communities are held hostage.
There have been a few cases of expats who might have had drug connections disappearing under mysterious circumstances but no one is sure if there was foul play or they just found a better gig and didn’t return from a visa renewal trip Panama or Nicaragua