I can't imagine how it would be possible to do it any other way for a flash storage device.
A mechanical hard drive could at least theoretically have a physical lock attached to the drive head which prevents it from approaching the platters if it is engaged.
Flash storage requires high voltage to do an erase (which needs to precede a write operation).
Back in the EPROM days, that was easy, just don’t supply 25V or whatever.
Modern flash still needs those high voltages but generates it on-chip via charge pumps. If your read-only switch physically disconnected the charge pumps, you would have read-only flash.
Writing flash takes (relatively) high voltage and the voltage boosting circuitry could be routed through a switch. It generally isn't, and the voltage converter is often an on-chip charge pump so this wouldn't be an easy retrofit, but the current state of affairs is due entirely to lack of interest rather than lack of possibility.
Do those charge pumps use external capacitors? If so, you could disconnect/float those capacitors, or if that would damage or glitch the chip, you could replace the real capacitors with some circuit like a voltage regulator + diode that would be designed to provide the charge pump output rail with a voltage that's high enough not to glitch the chip but low enough to be unsuccessful in writing to the flash. Would one of those ideas work, and allow the retrofit you envision to be designed with existing flash memory silicon + a few additional components?
I believe they’re on-die capacitors for the charge pumps these days. The external ones are just for smoothening.
Probably a method to retrofit write/erase protection would be to just do power analysis and cap the current the flash chip can receive. Or shut it down if that works for you.
Not sure if they’re intelligent enough to run their charge pumps slower under compromised electrical conditions. Or if they’ll go haywire if they can’t do idle-time wear levelling/block erases.
Isn’t it really only the erase that requires high voltage? So with a blank flash chip, without higher voltages, you could write to it to your heart’s content until you need to free up deleted content?
Edit: I think I’m wrong here and high voltage is needed for both.
For years, Dell laptops came with a USB key containing drivers, a sort of "rescue boot disk". I once tried using them as a normal pen drive, but then realized they were read-only.
If there is a way to make them writable via software, that would be very interesting (and dangerous).
Erm. The read head and the write head in a magnetic drive are the same head. You can't keep the head away from the surface if you want to read the disk. But you can disable power to the driver that puts write current into the head.
... and you could absolutely build similar functionality into a flash chip. But most likely you can't actually buy such chips, at least not with any real capacity.
There are multi-actuator hard drives out there. I don't know if any of them separate read heads from write heads, but it would certainly seem possible for such a drive to exist.
A mechanical hard drive could at least theoretically have a physical lock attached to the drive head which prevents it from approaching the platters if it is engaged.