Can't say it's a perfect solution but one way I've tried to prevent this is by wrapping secrets in a class (Java backend) where we override the toString() method to just print "***".
Haha, takes me back - we used to do this for PII too, also Java
Haha, takes me back - we used to do this for PII too, also Java