No, the problem is this Shrödinger’s unsafety.
If the environment is safe, don’t expose it, functions that expose it are unsafe and should be documented as unsafe and unavailable in production.
If the functions are normal, the environment is unsafe, don’t store secrets there.
You have to make a choice, it can’t be half of both. That is the real issue.