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

Api v2 delete note #734

Merged
merged 82 commits into from
Feb 28, 2025
Merged

Api v2 delete note #734

merged 82 commits into from
Feb 28, 2025

Conversation

c8y3
Copy link
Contributor

@c8y3 c8y3 commented Feb 28, 2025

Implementation of endpoint DELETE /api/v2/cases/{case_identifier}/notes/{identifier} to delete a note.

Tasks performed:

  • deprecated POST /case/notes/delete/{note_id}
  • fixed: PUT /api/v2/cases/{case_identifier}/notes/{identifier} should return 403 when user has no permission to access to case
  • quality: activated Ruff rule E303 and fixed all warnings

This PR goes with the accompanying documentation iris-doc-src PR#44.
It is built on top of branch api_v2_update_node. So it should not be merged before PR#732

c8y3 added 30 commits February 28, 2025 08:02
c8y3 added 23 commits February 28, 2025 08:11
…v2/cases/{case_identifier}/notes/{identifier}
@c8y3 c8y3 requested a review from whikernel February 28, 2025 13:53
Copy link

coderabbitai bot commented Feb 28, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@c8y3 c8y3 linked an issue Feb 28, 2025 that may be closed by this pull request
8 tasks
@@ -130,5 +124,4 @@
track_activity(f'user \'{user.user}\' successfully logged-in', ctx_less=True, display_in_ui=False)

next_url = _filter_next_url(request.args.get('next'), user.ctx_case)

return redirect(next_url)
return redirect(next_url)

Check warning

Code scanning / CodeQL

URL redirection from remote source Medium

Untrusted URL redirection depends on a
user-provided value
.

Copilot Autofix AI 4 days ago

To fix the problem, we need to enhance the URL validation to ensure that the next_url is safe for redirection. We will:

  1. Update the _is_safe_url function to handle additional edge cases, such as URLs with backslashes and malformed URLs.
  2. Ensure that the next_url is either a relative URL or has the same host as the current request.
  3. Use the url_has_allowed_host_and_scheme function from Django (if available) or implement similar logic to validate the URL.
Suggested changeset 1
source/app/business/auth.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/source/app/business/auth.py b/source/app/business/auth.py
--- a/source/app/business/auth.py
+++ b/source/app/business/auth.py
@@ -76,5 +76,5 @@
     """
-    ref_url = urlparse(request.host_url)
+    target = target.replace('\\', '')
     test_url = urlparse(urljoin(request.host_url, target))
-    return test_url.scheme in ('http', 'https') and ref_url.netloc == test_url.netloc
+    return test_url.scheme in ('http', 'https') and not test_url.netloc or test_url.netloc == urlparse(request.host_url).netloc
 
EOF
@@ -76,5 +76,5 @@
"""
ref_url = urlparse(request.host_url)
target = target.replace('\\', '')
test_url = urlparse(urljoin(request.host_url, target))
return test_url.scheme in ('http', 'https') and ref_url.netloc == test_url.netloc
return test_url.scheme in ('http', 'https') and not test_url.netloc or test_url.netloc == urlparse(request.host_url).netloc

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@whikernel whikernel merged commit f8bd485 into develop Feb 28, 2025
18 of 19 checks passed
@whikernel whikernel deleted the api_v2_delete_note branch February 28, 2025 16:29
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.

API v2 delete note
2 participants