-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create SECURITY.md #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
* @JimmyPettersson85 @xernobyl @yaziine | ||
* @JimmyPettersson85 @xernobyl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Reporting a Vulnerability | ||
At Stream we are committed to the security of our Software. We appreciate your efforts in disclosing vulnerabilities responsibly and we will make every effort to acknowledge your contributions. | ||
|
||
Report security vulnerabilities at the following email address: | ||
``` | ||
[[email protected]](mailto:[email protected]) | ||
``` | ||
Alternatively it is also possible to open a new issue in the affected repository, tagging it with the `security` tag. | ||
|
||
A team member will acknowledge the vulnerability and will follow-up with more detailed information. A representative of the security team will be in touch if more information is needed. | ||
|
||
# Information to include in a report | ||
While we appreciate any information that you are willing to provide, please make sure to include the following: | ||
* Which repository is affected | ||
* Which branch, if relevant | ||
* Be as descriptive as possible, the team will replicate the vulnerability before working on a fix. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
__copyright__ = "Copyright 2022, Stream.io, Inc" | ||
__credits__ = ["Thierry Schellenbach, mellowmorning.com, @tschellenbach"] | ||
__license__ = "BSD-3-Clause" | ||
__version__ = "5.2.1" | ||
__version__ = "5.3.1" | ||
__maintainer__ = "Thierry Schellenbach" | ||
__email__ = "[email protected]" | ||
__status__ = "Production" | ||
|
@@ -31,6 +31,9 @@ def connect( | |
""" | ||
from stream.client import AsyncStreamClient, StreamClient | ||
|
||
if location is None: | ||
location = os.environ.get("STREAM_REGION") | ||
|
||
stream_url = os.environ.get("STREAM_URL") | ||
# support for the heroku STREAM_URL syntax | ||
if stream_url and not api_key: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,11 @@ def update(self, reaction_id, data=None, target_feeds=None): | |
pass | ||
|
||
@abstractmethod | ||
def delete(self, reaction_id): | ||
def delete(self, reaction_id, soft=False): | ||
pass | ||
|
||
@abstractmethod | ||
def restore(self, reaction_id): | ||
pass | ||
Comment on lines
+26
to
31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Add tests for Currently, there are no tests covering the
Implementing these tests will enhance the reliability and maintainability of the 🔗 Analysis chainEnsure concrete implementations and tests are updated. The changes to the
To help identify the classes that need to be updated, you can run the following script: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Find all Python files that likely contain implementations of AbstractReactions
echo "Files potentially containing AbstractReactions implementations:"
rg --type python -l "class \w+\(.*AbstractReactions.*\):"
# Find all test files related to reactions
echo -e "\nTest files related to reactions:"
fd -e py test.*reaction
Length of output: 336 Script: #!/bin/bash
# Corrected script to find all Python files that likely contain implementations of AbstractReactions
echo "Files potentially containing AbstractReactions implementations:"
rg --type py -l "class \w+\(.*AbstractReactions.*\):"
# Corrected script to find all test files related to reactions with a more flexible pattern
echo -e "\nTest files related to reactions:"
fd -e py -g "*test*reaction*"
Length of output: 330 Script: #!/bin/bash
# Find all Python test files that mention 'reaction' in their filenames
echo "All Python test files related to reactions:"
rg --type py -l "reaction" <<< "$(fd -e py)"
# Additionally, search within test files for mentions of 'restore' or 'soft delete'
echo -e "\nSearching within test files for 'restore' or 'soft delete' functionalities:"
rg --type py "(def restore|soft\s*delete)" -- test/
Length of output: 422 Script: #!/bin/bash
# Find all Python test files that include 'test' in their filenames, regardless of their location
echo "All Python test files related to reactions:"
fd -e py -g "*test*.py"
# Capture the list of test files
TEST_FILES=$(fd -e py -g "*test*.py")
# Check if any test files were found
if [ -z "$TEST_FILES" ]; then
echo -e "\nNo test files related to reactions were found."
else
echo -e "\nSearching within test files for 'restore' or 'soft delete' functionalities:"
# Search within the found test files for 'restore' or 'soft delete'
rg --type py "(def restore|soft\s*delete)" $TEST_FILES
fi
Length of output: 751 |
||
|
||
@abstractmethod | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -17,7 +17,7 @@ | |||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
import stream | ||||||||||||||||||||||||||||
from stream import serializer | ||||||||||||||||||||||||||||
from stream.exceptions import ApiKeyException, InputException | ||||||||||||||||||||||||||||
from stream.exceptions import ApiKeyException, InputException, DoesNotExistException | ||||||||||||||||||||||||||||
from stream.feed import Feed | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
@@ -150,14 +150,14 @@ def test_api_url(self): | |||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def test_collections_url_default(self): | ||||||||||||||||||||||||||||
c = stream.connect("key", "secret") | ||||||||||||||||||||||||||||
c = stream.connect("key", "secret", location="") | ||||||||||||||||||||||||||||
feed_url = c.get_full_url(relative_url="meta/", service_name="api") | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
if not self.local_tests: | ||||||||||||||||||||||||||||
self.assertEqual(feed_url, "https://api.stream-io-api.com/api/v1.0/meta/") | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def test_personalization_url_default(self): | ||||||||||||||||||||||||||||
c = stream.connect("key", "secret") | ||||||||||||||||||||||||||||
c = stream.connect("key", "secret", location="") | ||||||||||||||||||||||||||||
feed_url = c.get_full_url( | ||||||||||||||||||||||||||||
relative_url="recommended", service_name="personalization" | ||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
|
@@ -169,7 +169,7 @@ def test_personalization_url_default(self): | |||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def test_api_url_default(self): | ||||||||||||||||||||||||||||
c = stream.connect("key", "secret") | ||||||||||||||||||||||||||||
c = stream.connect("key", "secret", location="") | ||||||||||||||||||||||||||||
feed_url = c.get_full_url(service_name="api", relative_url="feed/") | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
if not self.local_tests: | ||||||||||||||||||||||||||||
|
@@ -1439,6 +1439,37 @@ def test_reaction_delete(self): | |||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
self.c.reactions.delete(response["id"]) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def test_reaction_hard_delete(self): | ||||||||||||||||||||||||||||
response = self.c.reactions.add( | ||||||||||||||||||||||||||||
"like", "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4", "mike" | ||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
self.c.reactions.delete(response["id"], soft=False) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
Comment on lines
+1442
to
+1447
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add assertions to verify reaction hard deletion The method Apply this diff to add the assertion: def test_reaction_hard_delete(self):
response = self.c.reactions.add(
"like", "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4", "mike"
)
self.c.reactions.delete(response["id"], soft=False)
+ self.assertRaises(
+ DoesNotExistException, lambda: self.c.reactions.get(response["id"])
+ ) 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||
def test_reaction_soft_delete(self): | ||||||||||||||||||||||||||||
response = self.c.reactions.add( | ||||||||||||||||||||||||||||
"like", "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4", "mike" | ||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
self.c.reactions.delete(response["id"], soft=True) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
Comment on lines
+1448
to
+1453
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add assertions to verify reaction soft deletion In Apply this diff to add the assertion: def test_reaction_soft_delete(self):
response = self.c.reactions.add(
"like", "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4", "mike"
)
self.c.reactions.delete(response["id"], soft=True)
+ r1 = self.c.reactions.get(response["id"])
+ self.assertIsNotNone(r1.get("deleted_at")) 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||
def test_reaction_soft_delete_and_restore(self): | ||||||||||||||||||||||||||||
response = self.c.reactions.add( | ||||||||||||||||||||||||||||
"like", "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4", "mike" | ||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
self.c.reactions.delete(response["id"], soft=True) | ||||||||||||||||||||||||||||
r1 = self.c.reactions.get(response["id"]) | ||||||||||||||||||||||||||||
self.assertIsNot(r1["deleted_at"], None) | ||||||||||||||||||||||||||||
self.c.reactions.restore(response["id"]) | ||||||||||||||||||||||||||||
r1 = self.c.reactions.get(response["id"]) | ||||||||||||||||||||||||||||
self.assertTrue("deleted_at" not in r1) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def test_reaction_invalid_restore(self): | ||||||||||||||||||||||||||||
response = self.c.reactions.add( | ||||||||||||||||||||||||||||
"like", "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4", "mike" | ||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
self.assertRaises( | ||||||||||||||||||||||||||||
DoesNotExistException, lambda: self.c.reactions.restore(response["id"]) | ||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
Comment on lines
+1465
to
+1472
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verify correct exception is raised when restoring non-deleted reaction In |
||||||||||||||||||||||||||||
def test_reaction_add_child(self): | ||||||||||||||||||||||||||||
response = self.c.reactions.add( | ||||||||||||||||||||||||||||
"like", "54a60c1e-4ee3-494b-a1e3-50c06acb5ed4", "mike" | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
CHANGELOG.md is not updated to reflect the new version.
stream/__init__.py
is updated to version 5.3.1.CHANGELOG.md
still lists version 5.2.0.Please update
CHANGELOG.md
to include the new version 5.3.1.🔗 Analysis chain
Version update looks good. Verify consistency across the project.
The version bump from 5.2.1 to 5.3.1 is appropriate given the new features mentioned in the summary.
Please ensure this version update is consistent across the project. Run the following script to check:
Version inconsistency detected.
__init__.py
file is updated to version 5.3.1, but theCHANGELOG.md
reflects version 5.2.0.setup.py
due to a file type recognition issue.Please run the following script to check the version in
setup.py
without specifying the file type:🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 448
Script:
Length of output: 103