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

fix: url #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix: url #118

wants to merge 1 commit into from

Conversation

khulnasoft-bot
Copy link
Collaborator

@khulnasoft-bot khulnasoft-bot commented Oct 5, 2024

User description

(Please add to the PR name the issue/s that this PR would close if merged by using a Github keyword. Example: <feature name>. Closes #999. If your PR is made by a single commit, please add that clause in the commit too. This is all required to automate the closure of related issues.)

Description

Please include a summary of the change and link to the related issue.

Type of change

Please delete options that are not relevant.

  • [*] Bug fix (non-breaking change which fixes an issue).
  • [*] New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist

  • [*] I have read and understood the rules about how to Contribute to this project
  • The pull request is for the branch develop
  • A new plugin (analyzer, connector, visualizer, playbook, pivot or ingestor) was added or changed, in which case:
    • I strictly followed the documentation "How to create a Plugin"
    • Usage file was updated.
    • Advanced-Usage was updated (in case the plugin provides additional optional configuration).
    • I have dumped the configuration from Django Admin using the dumpplugin command and added it in the project as a data migration. ("How to share a plugin with the community")
    • If a File analyzer was added and it supports a mimetype which is not already supported, you added a sample of that type inside the archive test_files.zip and you added the default tests for that mimetype in test_classes.py.
    • If you created a new analyzer and it is free (does not require any API key), please add it in the FREE_TO_USE_ANALYZERS playbook by following this guide.
    • Check if it could make sense to add that analyzer/connector to other freely available playbooks.
    • I have provided the resulting raw JSON of a finished analysis and a screenshot of the results.
    • If the plugin interacts with an external service, I have created an attribute called precisely url that contains this information. This is required for Health Checks.
    • If the plugin requires mocked testing, _monkeypatch() was used in its class to apply the necessary decorators.
    • I have added that raw JSON sample to the MockUpResponse of the _monkeypatch() method. This serves us to provide a valid sample for testing.
  • If external libraries/packages with restrictive licenses were used, they were added in the Legal Notice section.
  • Linters (Black, Flake, Isort) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • I have added tests for the feature/bug I solved (see tests folder). All the tests (new and old ones) gave 0 errors.
  • If changes were made to an existing model/serializer/view, the docs were updated and regenerated (check CONTRIBUTE.md).
  • If the GUI has been modified:
    • I have a provided a screenshot of the result in the PR.
    • I have created new frontend tests for the new component or updated existing ones.
  • After you had submitted the PR, if DeepSource, Django Doctors or other third-party linters have triggered any alerts during the CI checks, I have solved those alerts.

Important Rules

  • If you miss to compile the Checklist properly, your PR won't be reviewed by the maintainers.
  • Everytime you make changes to the PR and you think the work is done, you should explicitly ask for a review. After being reviewed and received a "change request", you should explicitly ask for a review again once you have made the requested changes.

PR Type

Bug fix, Enhancement


Description

  • Updated URLs and email domains from threatmatrix.com to khulnasoft.com across multiple files for consistency.
  • Standardized casing in Dockerfile FROM statements.
  • Updated oletools dependency to a new commit hash in the requirements file.

Changes walkthrough 📝

Relevant files
Bug fix
queryset.py
Update URL in queryset alias for test                                       

api_app/queryset.py

  • Updated URL in Case statement from threatmatrix.com to khulnasoft.com.

  • +1/-1     
    Tests
    __init__.py
    Update email domains in test data setup                                   

    tests/init.py

  • Changed email domains from threatmatrix.com to khulnasoft.com in test
    data setup.
  • +4/-4     
    test_classes.py
    Update observable name email domain in test                           

    tests/api_app/analyzers_manager/test_classes.py

    • Updated observable name email domain in test job creation.
    +1/-1     
    test_classes.py
    Update URL in connector manager test                                         

    tests/api_app/connectors_manager/test_classes.py

    • Changed URL value in PluginConfig creation for tests.
    +1/-1     
    test_serializers.py
    Update URL in serializer tests                                                     

    tests/api_app/test_serializers.py

  • Updated URL values in PluginConfig creation for serializer tests.
  • +2/-2     
    test_views.py
    Update email domains in view tests                                             

    tests/api_app/test_views.py

    • Changed email domains for users in view tests.
    +2/-2     
    Formatting
    Dockerfile
    Standardize casing in Dockerfile FROM statements                 

    docker/Dockerfile

    • Changed FROM statement casing for consistency.
    +2/-2     
    Dependencies
    project-requirements.txt
    Update oletools dependency to new commit                                 

    requirements/project-requirements.txt

    • Updated oletools git reference to a new commit hash.
    +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Summary by Sourcery

    Fix email domains and update URLs in test data and configurations to reflect the new domain 'khulnasoft.com'.

    Bug Fixes:

    • Correct email domains in test data from 'threatmatrix.com' to 'khulnasoft.com'.

    Enhancements:

    Copy link

    sourcery-ai bot commented Oct 5, 2024

    Reviewer's Guide by Sourcery

    This pull request updates the email domain and URL from 'threatmatrix.com' to 'khulnasoft.com' across multiple test files and the main application code. The changes are consistent and appear to be part of a rebranding or domain change effort.

    No diagrams generated as the changes look simple and do not need a visual representation.

    File-Level Changes

    Change Details Files
    Update email domain and URL from 'threatmatrix.com' to 'khulnasoft.com'
    • Change email addresses for test users
    • Update URL in test data and mock responses
    • Modify email addresses in user creation tests
    • Adjust URL in plugin configuration tests
    tests/__init__.py
    tests/api_app/test_serializers.py
    tests/api_app/test_views.py
    api_app/queryset.py
    tests/api_app/analyzers_manager/test_classes.py
    tests/api_app/connectors_manager/test_classes.py

    Tips and commands

    Interacting with Sourcery

    • Trigger a new review: Comment @sourcery-ai review on the pull request.
    • Continue discussions: Reply directly to Sourcery's review comments.
    • Generate a GitHub issue from a review comment: Ask Sourcery to create an
      issue from a review comment by replying to it.
    • Generate a pull request title: Write @sourcery-ai anywhere in the pull
      request title to generate a title at any time.
    • Generate a pull request summary: Write @sourcery-ai summary anywhere in
      the pull request body to generate a PR summary at any time. You can also use
      this command to specify where the summary should be inserted.

    Customizing Your Experience

    Access your dashboard to:

    • Enable or disable review features such as the Sourcery-generated pull request
      summary, the reviewer's guide, and others.
    • Change the review language.
    • Add, remove or edit custom review instructions.
    • Adjust other review settings.

    Getting Help

    @codiumai-pr-agent-free codiumai-pr-agent-free bot added enhancement New feature or request Bug fix labels Oct 5, 2024
    Copy link

    @sourcery-ai sourcery-ai bot left a comment

    Choose a reason for hiding this comment

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

    We have skipped reviewing this pull request. It seems to have been created by a bot (hey, khulnasoft-bot!). We assume it knows what it's doing!

    Copy link

    deepsource-io bot commented Oct 5, 2024

    Here's the code health analysis summary for commits 29093ed..e214c02. View details on DeepSource ↗.

    Analysis Summary

    AnalyzerStatusSummaryLink
    DeepSource Python LogoPython❌ Failure
    ❗ 10 occurences introduced
    🎯 10 occurences resolved
    View Check ↗
    DeepSource Docker LogoDocker✅ SuccessView Check ↗

    💡 If you’re a repository administrator, you can configure the quality gates from the settings.

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Inconsistent Email Domain
    The superuser's email domain is still set to 'threatmatrix.org' while other users' email domains have been updated to 'khulnasoft.com'.

    Inconsistent Casing
    The 'AS' keyword in the FROM statements is now capitalized, which may cause issues if the Docker build process is case-sensitive.

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Security
    Use a secure method for setting passwords in test data

    Consider using a more secure method for setting passwords in test data, such as
    make_password() from Django's authentication utilities. This ensures that passwords
    are properly hashed even in test environments.

    tests/init.py [35-37]

    +from django.contrib.auth.hashers import make_password
    +
     cls.guest = User.objects.create(
    -    username="guest", email="guest@khulnasoft.com", password="test"
    +    username="guest", email="guest@khulnasoft.com", password=make_password("test")
     )
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Using make_password() enhances security by ensuring that passwords are hashed, even in test environments, which aligns with best practices for handling sensitive data.

    8
    Maintainability
    Use a constant for the email domain to improve maintainability

    Consider using a constant or configuration variable for the email domain instead of
    hardcoding it. This would make it easier to update the domain across all test cases
    if needed in the future.

    tests/init.py [35-37]

    +EMAIL_DOMAIN = "khulnasoft.com"
     cls.guest = User.objects.create(
    -    username="guest", email="guest@khulnasoft.com", password="test"
    +    username="guest", email=f"guest@{EMAIL_DOMAIN}", password="test"
     )
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Using a constant for the email domain improves maintainability by centralizing the domain value, making future updates easier and reducing the risk of inconsistencies across the codebase.

    7
    Best practice
    Use a tagged release version for Git dependencies when possible

    Instead of using a specific commit hash for the oletools Git reference, consider
    using a tagged release version if available. This makes it easier to track and
    update dependencies, and ensures you're using a stable, released version of the
    tool.

    requirements/project-requirements.txt [52]

    -git+https://github.com/decalage2/oletools.git@b565533d6757f3dde2501e946ed6977ebbf2830a
    +git+https://github.com/decalage2/oletools.git@v0.60.1
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Using a tagged release version for dependencies ensures stability and makes it easier to track and update dependencies, as tagged releases are typically more stable and well-documented than specific commit hashes.

    7
    Use a specific version for the Node.js base image to ensure reproducibility

    Consider using a specific version for the Node.js image instead of the
    lts-alpine3.18 tag. This ensures reproducibility and prevents unexpected changes
    when rebuilding the image.

    docker/Dockerfile [3]

    -FROM node:lts-alpine3.18 AS frontend-build
    +FROM node:18.17.1-alpine3.18 AS frontend-build
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Specifying a specific version for the Node.js image improves reproducibility by preventing unexpected changes during image rebuilds, which is a good practice for maintaining consistent environments.

    6

    💡 Need additional feedback ? start a PR chat

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant