Exact Bayesian inference for diffusion-based models