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

Update Slack Webhook regex with tests #214

Merged
merged 2 commits into from
Oct 17, 2021

Conversation

gVirtu
Copy link
Contributor

@gVirtu gVirtu commented Oct 17, 2021

Prerequisites

Why do we need this pull request?

  • When creating a test app on Slack, I noticed the webhook URL was slightly longer than the usual documented examples:

image

Notice that both fragments after the domain (the ones starting with T and B) contain 11 characters each instead of the usual 9.

What GitHub issues does this fix?

  • A tiny fraction of Find / add tests for API keys! #150 ! Besides updating the regex to accomodate for both formats, this includes two test examples for Slack Webhook for the regex identifier test, and also one in the fixture file for test_click.

Copy / paste of output

Please copy and paste the output of PyWhat with your new addition using an example that tests this addition below:

what 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
Matched on: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Name: Slack Webhook
Exploit: If the command below returns 'missing_text_or_fallback_or_attachments', it means
that the URL is valid, any other responses would mean that the URL is invalid.
  $ curl -s -X POST -H "Content-type: application/json" -d '{"text":""}' 
"https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"


Matched on: https://hooks.sl
Name: Uniform Resource Locator (URL)

Matched on: ack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Name: Uniform Resource Locator (URL)

Matched on: hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Name: JSON Web Token (JWT)

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2021

Codecov Report

Merging #214 (8c6fb5e) into main (dd077aa) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #214      +/-   ##
==========================================
+ Coverage   92.32%   92.35%   +0.03%     
==========================================
  Files          14       14              
  Lines        1198     1203       +5     
==========================================
+ Hits         1106     1111       +5     
  Misses         92       92              
Impacted Files Coverage Δ
tests/test_click.py 98.32% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd077aa...8c6fb5e. Read the comment docs.

@bee-san
Copy link
Owner

bee-san commented Oct 17, 2021

@gVirtu thanks so much for such a great PR description and addition!!! 🥳

@amadejpapez if i am not mistaken, why doesn't the URL regex recursively report its findings? It should look like this but I've never seen it done this way. Is this some fancy code we have somewhere? 🤔

Matched on: ack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Matched on: ck.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Matched on: k.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

@bee-san bee-san merged commit e2e109e into bee-san:main Oct 17, 2021
@bee-san
Copy link
Owner

bee-san commented Oct 17, 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.

3 participants