Skip to content

feat(core): Allow GPG parameters and ignore git hooks. #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ShogunPanda
Copy link

This PR introduces the follow changes:

  1. Add -n when committing votes. This avoids to being unexpectedly blocked by custom hooks.
  2. Add CARITAT_GPG_PARAMS environment variable to customize GPG when decrypting the ballot. This is to handle exotic configurations (like mine where the spinner in git node vote was interfering with password prompt)
  3. Add CARITAT_SHOW_ERRORS environment variable to explicitly opt-in for errors showing. This is to cleanup the output when decrypting the ballot since all but one promises are expected to fail.

@aduh95
Copy link
Contributor

aduh95 commented Jun 20, 2025

  1. Add -n when committing votes. This avoids to being unexpectedly blocked by custom hooks.

Opened #71 for this.

2. Add CARITAT_GPG_PARAMS environment variable to customize GPG when decrypting the ballot. This is to handle exotic configurations (like mine where the spinner in git node vote was interfering with password prompt)

What additional flag are you passing? Would that need some documentation?

3. Add CARITAT_SHOW_ERRORS environment variable to explicitly opt-in for errors showing. This is to cleanup the output when decrypting the ballot since all but one promises are expected to fail.

I'm not sure about this, especially as it's written, it would hide by default the error output, which could make debugging very hard. I've opened nodejs/node-core-utils#941 so all of stderr can be ignored.

@ShogunPanda
Copy link
Author

ShogunPanda commented Jun 26, 2025

  1. Add CARITAT_GPG_PARAMS environment variable to customize GPG when decrypting the ballot. This is to handle exotic configurations (like mine where the spinner in git node vote was interfering with password prompt)

What additional flag are you passing? Would that need some documentation?

Since I was having issue in typing my password, I went to use file based input with things like:

CARITAT_GPG_PARAMS="--pinentry-mode=loopback --passphrase-file=/tmp/caritat-passphrase"
  1. Add CARITAT_SHOW_ERRORS environment variable to explicitly opt-in for errors showing. >This is to cleanup the output when decrypting the ballot since all but one promises are expected to fail.

I'm not sure about this, especially as it's written, it would hide by default the error output, which could make debugging very hard. I've opened nodejs/node-core-utils#941 so all of stderr can be ignored.

That will make the trick.

Do you want me to update this PR to only retain n.2 so we can land this?

@aduh95
Copy link
Contributor

aduh95 commented Jun 26, 2025

I went to use file based input with things like:

CARITAT_GPG_PARAMS="--pinentry-mode=loopback --passphrase-file=/tmp/caritat-passphrase"

As the GPG docs say, that's "doing things one usually doesn’t want to do", putting your passphrase into a file sounds less than ideal. I'm not too keen of adding a Caritat specific env variable, unless it's some kind of already established convention. Do you know of any program that does that for gpg?
Any reason you prefer doing that over setting GPG_TTY, and/or setup pinentry? Another approach would be to set GPG_BIN to a wrapper script that adds the custom flags before invoking gpg:

#!/bin/sh
exec gpg --pinentry-mode=loopback --passphrase-file=/tmp/caritat-passphrase "$@"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants