unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: 51579@debbugs.gnu.org
Subject: bug#51579: Mark variable as safe only in one file or directory
Date: Tue, 2 Nov 2021 21:10:03 -0700	[thread overview]
Message-ID: <CADwFkmn85UpFdgnmQxQ+2TahMkHDv7yCzOWHi6jLAT7rB5hM=w@mail.gmail.com> (raw)

Severity: wishlist

I'd like a way to mark a variable as safe only when read from a
particular directory or file.

I create a .dir-locals.el file with some unsafe variable, e.g.

tmp=`mktemp -d`
echo "((nil . ((epa-file-cache-passphrase-for-symmetric-encryption . t))))" \
    > $tmp/.dir-locals.el
echo $tmp

Now I visit a file in the created directory and get this message:

     The local variables list in /tmp/tmp.qakuGgnFPH/
     contains values that may not be safe (*).

     Do you want to apply it?  You can type
     y  -- to apply the local variables list.
     n  -- to ignore the local variables list.
     !  -- to apply the local variables list, and permanently mark these
           values (*) as safe (in the future, they will be set automatically.)
     i  -- to ignore the local variables list, and permanently mark these
           values (*) as ignored

       * epa-file-cache-passphrase-for-symmetric-encryption : t

According to (info "(emacs) Safe File Variables"), hitting "i" means
that:

       You can also tell Emacs to permanently ignore all the variable/value
    pairs in the file, by typing ‘i’ at the confirmation prompt – these
    pairs will thereafter be ignored in this file and in all other files.

I would like to be able to mark this variable/value pair as safe *only*
when read from this file, and not in any file.





             reply	other threads:[~2021-11-03  4:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  4:10 Stefan Kangas [this message]
2021-11-04 18:10 ` bug#51579: Mark variable as safe only in one file or directory Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmn85UpFdgnmQxQ+2TahMkHDv7yCzOWHi6jLAT7rB5hM=w@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=51579@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).