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

Encrypted containers on pages which add HTML to the container #88

Open
derWhity opened this issue Jul 19, 2013 · 7 comments
Open

Encrypted containers on pages which add HTML to the container #88

derWhity opened this issue Jul 19, 2013 · 7 comments

Comments

@derWhity
Copy link

Some pages (e.g. Facebook) add HTML tags to the messages/comments/etc. you post. If such a post is GPG-encrypted, an error is displayed, when webpg tries to decrypt it (see screenshot).

It would be nice to filter out any HTML markup between the -----BEGIN PGP MESSAGE----- and -----END PGP MESSAGE----- markers before trying to decrypt.

webpg trying to decrypt a gpg message on facebook

@jayze
Copy link

jayze commented Sep 3, 2013

I've installed the 0.9.4 and there the formatting is better, not yet what it should be :)
For example, where at the end of every line a
tag appears, you don't see the
tag anymore, but now a newline is displayed, which causes the decryption to break.

@kylehuff
Copy link
Owner

kylehuff commented Sep 3, 2013

WebPG makes a best effort to detect erronous/extrenous HTML tags within PGP blocks -- this is, however, only best erroft, as it HTML within a PGP block is perfectly sane.

I believe the root issue is that PGP data is not being placed in appropriate containers (such as pre tags) that preserve the formatting and prevent markup from being inserted. Granted, I am aware that not all content posting sites support such mechanisms.

@jayze can you provide me with more information of what you are referring to? What I mean is, how is the PGP data being presented? (i.e. textarea, HTML element, etc.) Also, if you think a sample would help, please include that.

@sukima
Copy link

sukima commented Sep 3, 2013

Would it be possible to define best effort as: Verify the content between the PGP marks, if it fails strip HTML from the content and verify again. That way you could catch a good portion of the false positives. It isn't perfect but better.

@jayze
Copy link

jayze commented Sep 4, 2013

Hi,

Perhaps a screenshot can clarify what I see.

_infra-573__twm_demo___vpn_caterpilar-_transwide_issues

As you can see, the PGP encrypted message is captured correctly, but the BR's are interpreted making it impossible to decrypt.

Ps this is eg on Jira software of atlassian.

@kylehuff
Copy link
Owner

kylehuff commented Sep 5, 2013

Would it be possible to define best effort as: Verify the content between the PGP marks, if it fails strip HTML from the content and verify again.

That is a possibility. I'm not sure how expensive that would be on pages with many PGP data parts.

I think, at least for the time being, having a reproducible test case that illustrates these types of issues would be most helpful.

Ps this is eg on Jira software of atlassian.

Yes, but what kind of HTML element is the element that contains the data? In reality, all HTML could be stripped from PGP MESSAGE blocks, since they don't contain the plaintext. That would work around this particular issue, however, it would not solve the issue for cases that are inline.

@jayze
Copy link

jayze commented Sep 6, 2013

@kylehuff What exactly do you want me to provide ?

This is the structure how (eg in Jira) the message is build up.

webgp-jira-3

@kylehuff
Copy link
Owner

@jayze that is what I was looking for. It is being displayed incorrectly because it is contained within the wrong type of HTML element. It should be a in a "pre" element, either system or user provided.

To reiterate, I believe in these particular cases we should be able to work around the issue by stripping all HTML elements from the message (because that type of PGP message doesn't have any plain-text), but that doesn't make the presentation correct. Stripping the HTML off of fields that contain white-space sensitive data and expecting it to validate is a little like having XML in presented in such a field and expecting it to validate. (I'll get off my soapbox now...)

In summary, my plan is to implement the following:

  • IF the PGP data type is "PGP MESSAGE" or "PGP PUBLIC KEY BLOCK", WebPG will automatically strip all HTML from the message
  • IF the PGP data type is "PGP SIGNED MESSAGE" (contains plain-text), WebPG will perform best efforts to remove extraneous HTML markup, but should probably slap somebody for doing it wrong.

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

No branches or pull requests

4 participants