Pat the pork cubes dry and season with the white pepper. Heat the oil in a wide pan or wok over medium-high until it shimmers.
Add the pork in a single layer and sear without stirring for 2 to 3 minutes, until the underside browns. Turn and brown the other sides, then push the pork to one side.
Add the onion, garlic and ginger to the cleared space. Cook for 1 to 2 minutes until fragrant and the onion softens at the edges.
Pour in the kecap manis, soy sauce, water and star anise if using. Stir to coat the pork, bring to a simmer, then cover and cook on low for 15 minutes.
Uncover, raise the heat to medium and let the sauce reduce for 3 to 4 minutes. Stir the cornstarch slurry and add a little at a time until the sauce is glossy and coats the back of a spoon.
Taste and adjust with a splash more soy sauce if needed. Top with sliced red chili and fried shallots and serve over rice.