#1 GPG remove notation piping in input failing due to control character

Open
opened 2 months ago by shom · 0 comments
shom commented 2 months ago
Owner

GPG doesn't provide unattended notation manipulation capabilities through the cli to my knowledge. While "interactively" sending the notation information works for GPG during adding a notation. GPG rejects deleting the notation since it has to be sent with a control character and GPG has no knowledge that I'm not trying to add this notation. I've not been able to escape the "-" to sneak it past.

The function called deleteNotation is intended to interact with GPG and edit a key to remove a notation. This function is setup exactly the same addNotationrefactor which works just fine. The relevant snippet is here where removeNotation just prepends a "-" to the notation string:

   removeNotation="-$1"
   {
      echo notation
      echo $removeNotation
      echo save
   } | gpg --command-fd=0 --status-fd=1 --edit-key $fingerPrint

The relevant commit is: 5489d682af

Here's the output and error:

gpg (GnuPG) 2.2.19; Copyright (C) 2019 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

[GNUPG:] REMOVED THE KEY INFO THAT IS PRINTED

[GNUPG:] GET_LINE keyedit.prompt
[GNUPG:] GOT_IT
[GNUPG:] GET_LINE keyedit.add_notation
[GNUPG:] GOT_IT
gpg: a notation value must not use any control characters

[GNUPG:] GET_LINE keyedit.prompt
[GNUPG:] GOT_IT
Key not changed so no update needed.

I'm opening this issue to seek help from the community.

[refactor]: after this issue is resolved the idea is to refactor to a single modifyNotation function.

GPG doesn't provide unattended notation manipulation capabilities through the cli to my knowledge. While "interactively" sending the notation information works for GPG during adding a notation. GPG rejects deleting the notation since it has to be sent with a control character and GPG has no knowledge that I'm not trying to add this notation. I've not been able to escape the "-" to sneak it past. The function called `deleteNotation` is intended to interact with GPG and edit a key to remove a notation. This function is setup exactly the same `addNotation`<sup>[refactor](#refactor)</sup> which works just fine. The relevant snippet is here where `removeNotation` just prepends a "-" to the notation string: ``` bash removeNotation="-$1" { echo notation echo $removeNotation echo save } | gpg --command-fd=0 --status-fd=1 --edit-key $fingerPrint ``` The relevant commit is: https://codeberg.org/shom/keyoxidizer/commit/5489d682af417ec128e263867f6bc450ff2a2cad Here's the output and error: ``` bash gpg (GnuPG) 2.2.19; Copyright (C) 2019 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. [GNUPG:] REMOVED THE KEY INFO THAT IS PRINTED [GNUPG:] GET_LINE keyedit.prompt [GNUPG:] GOT_IT [GNUPG:] GET_LINE keyedit.add_notation [GNUPG:] GOT_IT gpg: a notation value must not use any control characters [GNUPG:] GET_LINE keyedit.prompt [GNUPG:] GOT_IT Key not changed so no update needed. ``` I'm opening this issue to seek help from the community. <a name="user-content-refactor">[refactor]</a>: after this issue is resolved the idea is to refactor to a single `modifyNotation` function.
shom added this to the Fixes project 1 month ago
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.