Skip to content

Add PGP public keys for #84#105

Merged
amadejpapez merged 11 commits intobee-san:mainfrom
baldoarturo:main
Jul 8, 2021
Merged

Add PGP public keys for #84#105
amadejpapez merged 11 commits intobee-san:mainfrom
baldoarturo:main

Conversation

@baldoarturo
Copy link
Copy Markdown
Contributor

I think this should be enough to handled #84
#84

@amadejpapez amadejpapez requested a review from bee-san July 2, 2021 17:41
@baldoarturo
Copy link
Copy Markdown
Contributor Author

Fixed most of the items, sorry for the inconveniences, thanks for the patience

@amadejpapez
Copy link
Copy Markdown
Collaborator

I fixed merge conflicts for you but tests are failing as PGP regex is struggling with match being over multiple lines.

Also I noticed that you named both tests the same in test_click.py, so please fix that :D

@ghost ghost linked an issue Jul 2, 2021 that may be closed by this pull request
@amadejpapez
Copy link
Copy Markdown
Collaborator

To fix the regex issue, I came up with this:
^(?:-----BEGIN PGP PUBLIC KEY BLOCK-----\n?(?:(?:(?:Version|Comment|MessageID|Hash|Charset):.*)\n?)*[a-zA-Z0-9\/\.\n\:\+\=]+-----END PGP PUBLIC KEY BLOCK-----)$

It works over multiple lines and only some data at the start is accepted instead of anything.

@amadejpapez
Copy link
Copy Markdown
Collaborator

While my regex works well on a regex website, it does not work in pyWhat at all. Sadly we currently cannot match to multiline PGP key or any other multiline text. :(

The issue is that pyWhat is reading and testing each line separately. To get it to work we would have to change open_file_loc() and the change would break all of the boundaries regexes as they only match if a match is in its own line but having the whole file contents as one would obviously break that.

@bee-san
Copy link
Copy Markdown
Owner

bee-san commented Jul 5, 2021

k all of the boundaries regexes as they only match if a match is in its own line but having the whole file contents as one would obv

How do we fix this?

@amadejpapez
Copy link
Copy Markdown
Collaborator

amadejpapez commented Jul 5, 2021

How do we fix this?

Well seems like I was wrong. If we treat whole file contents as one thing instead of creating a list of lines, it doesn't break boundaries and multiline works just fine. This is because it inserts \n character so regex can still see what is in which line.

I have pushed the changes now. Something to be aware of is that matches are no longer sorted as they appear in the file but by the regex order in our database, so technically matches are sorted by rarity.

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me

@bee-san
Copy link
Copy Markdown
Owner

bee-san commented Jul 8, 2021

Merge conflicts :(

@amadejpapez amadejpapez enabled auto-merge July 8, 2021 06:40
@amadejpapez amadejpapez merged commit 3a9dc43 into bee-san:main Jul 8, 2021
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.

Identify PGP keys?

4 participants