From: "Kache Hit" <kache.hit@gmail.com>
To: "Chris Torek" <chris.torek@gmail.com>, "Johannes Sixt" <j6t@kdbg.org>
Cc: "Kache Hit" <kache.hit@gmail.com>, <git@vger.kernel.org>
Subject: Re: Filter smudge for secret restoration: no disk access?
Date: Mon, 24 Nov 2025 10:40:49 -0800 [thread overview]
Message-ID: <DEH58DEF5MGO.2CFIKCM2CAQY2@gmail.com> (raw)
In-Reply-To: <CAPx1GvcXkXMpWgOyMWdfHXGEDJQY4wJrJV0p7LHBMeQFPMDHnQ@mail.gmail.com>
On Mon Nov 24, 2025 at 1:01 AM PST, Johannes Sixt wrote:
> A smudge filter must read its stdin and write the result to stdout. The
> presence of %f in the configuration does not change this.
>
> The filter can inspect the file name it receives via the %f token (note:
> the *name* of the file, not the file itself) to draw additional hints
> how to process the data, but it still has to read stdin and write to stdout.
Yes, I underststand. I'm asking why it's necessary that smudge not read
from disk, even as it properly satisfies that stdin/stdout operation, as
in my Python implementation of `smudge()`
On Mon Nov 24, 2025 at 1:49 AM PST, Chris Torek wrote:
> For sanity purposes, if no other reasons, it might be wise to store a
> "file with secrets" under a file with a name such that it is **never**
> controlled by Git (i.e., always listed in a .gitignore or equivalent,
> or outside the working tree entirely), and to store instead, in Git, a
> "template file with secrets that are replaced". That way, the secrets
> either exist on disk (and are secret because Git is blind to them), or
> do not exist at all (and are therefore secret to Git). The template
> file controls the template and nothing else; the secret-data file has
> both secrets and, perhaps, data that are extracted from the
> Git-controlled file as well.
>
> In this manner, a "to-be-smudged" file named foo.template might
> control some external-to-Git manipulation of an invisible-to-Gt file
> named foo.secret, and no clean filter would be required at all, though
> one could inspect and strip secrets accidentally copied into a
> foo.template.
I'm familiar with this practice, e.g. committing an `.env.template`
which is used to create an `.env` file with secrets within.
However, this is my dotfiles repo that includes `~/.config`. There are
config files that store credentials right next to configuration, managed
by software that I don't control.
Although I could still apply that pattern by ignoring `foo.yml` and
committing a redacted `foo.template.yml`, I'd have to manually upstream
changes back to the template as the config file changes.
Another use case is to ignore changes to a specific line without losing
the working copy. Some software saves a volatile "last_updated_at" or
"last_opened" field into config that doesn't need to be committed. This
could also be useful for https://stackoverflow.com/questions/16244969
and https://stackoverflow.com/questions/61091219
- Kache
next prev parent reply other threads:[~2025-11-24 18:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 7:39 Filter smudge for secret restoration: no disk access? Kache Hit
2025-11-24 9:01 ` Johannes Sixt
2025-11-24 9:49 ` Chris Torek
2025-11-24 18:40 ` Kache Hit [this message]
2025-11-24 19:35 ` Junio C Hamano
2025-11-25 7:28 ` Kache Hit
2025-11-25 8:55 ` Chris Torek
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DEH58DEF5MGO.2CFIKCM2CAQY2@gmail.com \
--to=kache.hit@gmail.com \
--cc=chris.torek@gmail.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.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.
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 NNTP newsgroup(s).