Common-SenseMakers / sensemakers

Sensemakers infrastructure for developing AI-based tools for semantic annotations of social posts. Cross-poster app to publish your semantic posts on different networks.
GNU General Public License v3.0
1 stars 2 forks source link

Nlp dev merge - quote tweet and thread support + misc #109

Closed ronentk closed 3 months ago

ronentk commented 3 months ago

Adding support for threads

102

Update research filter classification to support multiple types

103

105 Add optional token length limit for parser inputs

Quote tweet support

89 , #94 , #98

99

citoid mis-detects non twitter domain

gitguardian[bot] commented 3 months ago

⚠️ GitGuardian has uncovered 7 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | | | -------------- | ------------------ | ------------------------------ | ---------------- | --------------- | -------------------- | | [11699671](https://dashboard.gitguardian.com/workspace/520314/incidents/11699671?occurrence=146194962) | Triggered | Generic High Entropy Secret | 3c811d2d31b86d7885945e610a42fbdf6abfa381 | nlp/notebooks/XdatasetLogEdit.ipynb | [View secret](https://github.com/Common-SenseMakers/sensemakers/commit/3c811d2d31b86d7885945e610a42fbdf6abfa381#diff-89a130e6bb947268fadb65f577eb7ee2d2a374e6600f5a123cca62f433a361cbR2382) | | [10821385](https://dashboard.gitguardian.com/workspace/520314/incidents/10821385?occurrence=134849816) | Triggered | Google API Key | e9dba371d4cfe3ecb1dfa4b6ca6e39de781acbd4 | app/webapp/craco.config.js | [View secret](https://github.com/Common-SenseMakers/sensemakers/commit/e9dba371d4cfe3ecb1dfa4b6ca6e39de781acbd4#diff-cbdedb2574b4581b80381703236cef91366c02b1bec1ecc4c42b28d1d68c788cL19) | | [10589863](https://dashboard.gitguardian.com/workspace/520314/incidents/10589863?occurrence=134849818) | Triggered | Generic High Entropy Secret | e03dfd0e3c0f659bfca66ab9b7c13433476dac26 | app/firebase-py/functions/.env.staging | [View secret](https://github.com/Common-SenseMakers/sensemakers/commit/e03dfd0e3c0f659bfca66ab9b7c13433476dac26#diff-7d686892160ae87263af1c2668dd36f3aa1d9c8f1c89b4781de4fdacbcaf7602L1) | | [10589863](https://dashboard.gitguardian.com/workspace/520314/incidents/10589863?occurrence=134849819) | Triggered | Generic High Entropy Secret | 4379c8e13b421f5379bf18c0fe00aae9eb37a72c | app/firebase-py/functions/.env.staging | [View secret](https://github.com/Common-SenseMakers/sensemakers/commit/4379c8e13b421f5379bf18c0fe00aae9eb37a72c#diff-7d686892160ae87263af1c2668dd36f3aa1d9c8f1c89b4781de4fdacbcaf7602L1) | | [10821385](https://dashboard.gitguardian.com/workspace/520314/incidents/10821385?occurrence=134849817) | Triggered | Google API Key | 0b4c8787ae822582978bcf878fb7514e26826fcb | app/webapp/craco.config.js | [View secret](https://github.com/Common-SenseMakers/sensemakers/commit/0b4c8787ae822582978bcf878fb7514e26826fcb#diff-cbdedb2574b4581b80381703236cef91366c02b1bec1ecc4c42b28d1d68c788cL19) | | [12247943](https://dashboard.gitguardian.com/workspace/520314/incidents/12247943?occurrence=151362449) | Triggered | Generic High Entropy Secret | 7c822b712938d2ac54d0ed0e8f1ae7d41dea88ca | app/firebase/functions/test/__tests__/user.timeline.result.mock.json | [View secret](https://github.com/Common-SenseMakers/sensemakers/commit/7c822b712938d2ac54d0ed0e8f1ae7d41dea88ca#diff-d32120182dda07ea5bd30d3ecc8023e8cb607a4f3891a087a7d3fe9153199e26R1424) | | [12247944](https://dashboard.gitguardian.com/workspace/520314/incidents/12247944?occurrence=151362450) | Triggered | Generic High Entropy Secret | 7c822b712938d2ac54d0ed0e8f1ae7d41dea88ca | app/firebase/functions/test/__tests__/user.timeline.result.mock.json | [View secret](https://github.com/Common-SenseMakers/sensemakers/commit/7c822b712938d2ac54d0ed0e8f1ae7d41dea88ca#diff-d32120182dda07ea5bd30d3ecc8023e8cb607a4f3891a087a7d3fe9153199e26R1444) |
🛠 Guidelines to remediate hardcoded secrets
1. Understand the implications of revoking this secret by investigating where it is used in your code. 2. Replace and store your secrets safely. [Learn here](https://blog.gitguardian.com/secrets-api-management?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) the best practices. 3. Revoke and [rotate these secrets](https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/generics/generic_high_entropy_secret#revoke-the-secret?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment). 4. If possible, [rewrite git history](https://blog.gitguardian.com/rewriting-git-history-cheatsheet?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment). Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data. To avoid such incidents in the future consider - following these [best practices](https://blog.gitguardian.com/secrets-api-management/?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) for managing and storing secrets including API keys and other credentials - install [secret detection on pre-commit](https://docs.gitguardian.com/ggshield-docs/integrations/git-hooks/pre-commit?utm_source=product&utm_medium=GitHub_checks&utm_campaign=check_run_comment) to catch secret before it leaves your machine and ease remediation.

🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

pepoospina commented 3 months ago

@ronentk I merged and tried running main.test.py but I get the error

2024-06-28 15:26:07.799 | INFO     | shared_functions.parsers.post_parser_chain:__init__:27 - Initializing parser chain 'hashtags' 
2024-06-28 15:26:07.834 | INFO     | shared_functions.main:SM_FUNCTION_post_parser_imp:30 - Running parser on content: {'thread': [{'content': 'This is an interesting paper https://arxiv.org/abs/2312.05230 but I disagree with its sequel https://anotherlink.io  #user-hashtag'}], 'author': {'platformId': <enum 'SocialPlatformType'>, 'id': '12345', 'username': 'johndoe', 'name': 'John Doe'}}...
Traceback (most recent call last):
  File "/home/pepo/pr/cs/sensemakers/app/firebase-py/functions/main.test.py", line 35, in <module>
    result = SM_FUNCTION_post_parser_imp(thread_data, parameters, config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pepo/pr/cs/sensemakers/app/firebase-py/functions/shared_functions/main.py", line 33, in SM_FUNCTION_post_parser_imp
    result = parser.process_text(
             ^^^^^^^^^^^^^^^^^^^^
  File "/home/pepo/pr/cs/sensemakers/app/firebase-py/functions/shared_functions/parsers/multi_chain_parser.py", line 288, in process_text
    ref_post: RefPost = convert_text_to_ref_post(text)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pepo/pr/cs/sensemakers/app/firebase-py/functions/shared_functions/schema/helpers.py", line 12, in convert_text_to_ref_post
    urls = extract_and_expand_urls(text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pepo/pr/cs/sensemakers/app/firebase-py/functions/shared_functions/utils.py", line 165, in extract_and_expand_urls
    orig_urls = extract_urls(text)
                ^^^^^^^^^^^^^^^^^^
  File "/home/pepo/pr/cs/sensemakers/app/firebase-py/functions/shared_functions/utils.py", line 137, in extract_urls
    res = re.findall(url_regex, text)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pepo/anaconda3/lib/python3.11/re/__init__.py", line 216, in findall
    return _compile(pattern, flags).findall(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'dict'
pepoospina commented 3 months ago

Also, I removed the TypedDict interface that I created that it seems you ended up merging. Its better to have just one spec of these types and yours should be the ones.

Check the latest commit on https://github.com/Common-SenseMakers/sensemakers/tree/merge-nlp-dev