It needs to be a vertical slice, not a core. Now only that feature touches the sensitive bits. In a well designed system, oftentimes your core is completely internal to the subsystem.
In general people over-emphasize layers, feature slices are usually what matters.
You can have a secure core that's carefully reviewed and has less velocity. But that core includes handling the user's password. And then everything else needs to be sandboxed/isolated in some way: you'll be quickly making various tradeoffs.