Although crimes committed on foreigners are very rare, you should still be vigilant at all times during a trip to Indonesia.
Indonesia is a very calm and safe country. There is little delinquency and few acts of violence. Thefts are a little more frequent in tourist areas such as Bali and its seaside resort of Kuta, or on public transport. You can take a few simple precautions to avoid unpleasantness. For maximum security, never leave anything valuable in your rucksack, carry your money and your passport on you, in a small pouch next to your skin. Actually, thefts are quite rare and are usually the result of negligence rather than anything else. Some thefts that have been reported were even carried out by other tourists, and not by the locals.
You need to be very careful about drugs during your trip to Indonesia. They have a zero tolerance policy on drugs. And in addition, although the sellers may seem friendly, nearly all of them are working for the police. They will be very pleased to take your money even if they don't decide to submit you to the full process of the law.
Don't forget that Indonesia, apart from Bali, is a Muslim country, so there are certain rules that must be followed, especially for women. It is important to show respect for local culture and avoid disputes.