There is a neat solution to this problem using 
* Local Variables :noexport:
see the discussion at stackoverflow
Cheers, 
Steven 

On Wed, 7 Sept 2022 at 05:07, Greg Minshall <minshall@umich.edu> wrote:
Fedja,

> What I would like to have, to safely and easily use org-mode
> as an interactive notebook, is to not have to overload this
> function and to be asked only once per buffer/file whether to:
> 1) Unconditionally allow executing all code blocks
> 2) Unconditionally disallow executing all code blocks
> 3) Ask for every block.

i think that is an interesting idea, and maybe a more pleasant user
interface than what we currently have. 

probably, for me, it would allow me to drop a number of buffer-local
variable customizations, as i'm typically evaluating code in a given
buffer over and over again (and, so, would be happy to pay the price of
saying "yes" once per buffer (per emacs instance).

i'd be curious to hear what the downsides might be, especially anyone
who sees security-related downsides.

Ihor,

> 1) You can set org-confirm-babel-evaluate buffer-locally
> 2) Same or set :eval no header arg. (see
> https://orgmode.org/org.html#Evaluating-Code-Blocks)
> 3) You can set :eval query header arg.

for me the use case is 1) disabling all (or setting to "query") when,
e.g., you are exporting some file you received via e-mail and so trust
*none* of the code blocks; 2) enabling all for some file that you
yourself maintain, and so trust *all* the code blocks.  at least
initially, this seems a nice direction.

cheers, Greg