Skip to content
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

OPENPGP PLUGIN: Don't list expired/revoked GPG keys #1540

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

Conversation

eerielili
Copy link
Contributor

@eerielili eerielili commented Jan 20, 2024

Hello,
@fiaxh This PR should close #91

I also changed the text when no key is selected from "No keys available. Generate one" to "No keys available. Generate one or check if your key isn't expired or revoked!"

I created a gpg key expiring few minutes after generation with a timestamp of 20240412T105500:

Here's a screenshot 2 minutes before expiring:
image
image

After closing dino and opening it back after the key expired:
image
image

But the input text box can still be used to send message, which are marked as failed but no reason is given.
I'll see if it's possible to block input on a revoked or expired key, and also have it checked without opening and closing dino.

Kind regards,
lili

@eerielili eerielili changed the title OPENPGP PLUGIN: Don't list expired/revoked GPG key OPENPGP PLUGIN: Don't list expired/revoked GPG keys Jan 20, 2024
@eerielili eerielili closed this Feb 6, 2024
@eerielili eerielili deleted the openpgp-plugin-hide-revoked-expired branch February 6, 2024 20:57
@eerielili eerielili restored the openpgp-plugin-hide-revoked-expired branch February 6, 2024 20:57
@eerielili eerielili reopened this Apr 12, 2024
@eerielili eerielili force-pushed the openpgp-plugin-hide-revoked-expired branch from 2a8bc85 to 779092c Compare April 12, 2024 11:10
@eerielili
Copy link
Contributor Author

eerielili commented Apr 16, 2024

Update: I did find a way. I'll need to modify the encryption_activated method in encryption_list_entry.vala. Working on it.

Edit: bingo!
image

Edit 2: I splitted the message, so if it's revoked:
image

or expired:
image

It still doesn't trigger if the key expires or revokes while dino is in use, but switching the encryption methods back and forth to GPG do rerun the check for expiry / revocation status and block the field accordingly.

Edit 3: It does trigger by switching back and forth conversations, or clicking the conversation in the left pane.

@eerielili eerielili force-pushed the openpgp-plugin-hide-revoked-expired branch from 779092c to 2f3ddad Compare April 16, 2024 20:43
@eerielili
Copy link
Contributor Author

eerielili commented Apr 21, 2024

I did add a warning in the account panel if the current selected key has expired or is revoked:
image

@eerielili eerielili force-pushed the openpgp-plugin-hide-revoked-expired branch from 2f3ddad to bcbbacf Compare April 21, 2024 22:00
	- closes dino#91
	- Mention that GPG key may be expired or revoked in chat input
	box
	- in the account dialog if the number of OpenPGP keys found is
	0, the label also notes that a key may have been revoked or
	expired.
	- blocks input in chat box if key is use is revoked or expired
	  when switching conversation and can detect if your key has expired
	  while chatting
	- if current selected key is revoked or expired, it'll be shown
	  in account manager with a warning message: "Attention
	  required: your key xxxx is revoked/expired!"
@eerielili eerielili force-pushed the openpgp-plugin-hide-revoked-expired branch from bcbbacf to 78664dd Compare April 26, 2024 01:51
@eerielili
Copy link
Contributor Author

eerielili commented Apr 26, 2024

It still doesn't trigger if the key expires or revokes while dino is in use

I finally managed to do that without needing to click on left pane or switching back and forth conversations.
It involves calling method on_encryption_activated in send_text() method in main/src/ui/chat_input/chat_input_controller.vala if PGP is the encryption method, triggering the checks in the plugin.

Now, if you try to send a message but the key has expired or has been revoked while Dino is in use and you're in a chat, the input should be blocked with the following depending on your situation:
image
image

With this, I think all bases are covered.

@NicoHood @cjj20 Feel free to test and give feedback anytime

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.

Do not allow revoked GPG keys
1 participant