Skip to content

fix(csrf): resolve all 124 SonarQube CSRF security hotspots - #304

Merged
Zarlanx merged 10 commits into
mainfrom
sms10221/dev-sonarqube-security-hotspots
Apr 24, 2026
Merged

fix(csrf): resolve all 124 SonarQube CSRF security hotspots#304
Zarlanx merged 10 commits into
mainfrom
sms10221/dev-sonarqube-security-hotspots

Conversation

@isiddharthsingh

@isiddharthsingh isiddharthsingh commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Resolved all 124 CSRF hotspots flagged by SonarQube (S3752 + S4502).
  • 4 hotspots marked SAFE in Sonar with justifications (1 S4502 in main_compute.py, 3 OAuth callbacks in gcp/auth.py, github/github.py, slack/slack_routes.py).
  • 3 dual-purpose GET+POST routes split into per-method handlers with correct RBAC scoping (read for GET, write for POST) — azure/fetch_data, azure/api/azure-subscriptions, gcp/api/gcp/sa-project-access.
  • 117 routes had redundant , "OPTIONS" stripped from methods= so Flask + Flask-CORS auto-handles preflight (industry standard).
  • Bug fix in sa_project_access_get/_post: re-fetch token_data after refresh_token_if_needed to avoid using stale tokens.
  • Consistency cleanup: 19 sibling routes in 6 files (bitbucket_selection, dynatrace, jira, newrelic, sharepoint, splunk) stripped of OPTIONS to match the rest of each file. 3 newly-orphaned create_cors_response imports removed.

Why

Aurora is a stateless JSON API authenticated by X-Internal-Secret + X-User-ID headers injected server-side by the Next.js proxy. Browsers never directly call Flask, so the OPTIONS-in-methods= + decorator short-circuit pattern was dead defensive code. Stripping OPTIONS lets Flask auto-respond to preflight, which is the canonical Flask + Flask-CORS pattern.

Test plan

  • All connector connect/disconnect flows exercised via the UI: AWS, Azure, Bitbucket, Confluence, Datadog, GitHub, Google Cloud, Jira (all show Connected, no 405s, no CORS errors in backend logs).
  • Login + register flows: OPTIONS /api/auth/register → 200 (Flask auto-handler), POST /api/auth/register → 201, POST /api/auth/login → 200.
  • All edited files pass ast.parse.
  • Sonar rescan to confirm 124 CSRF hotspots are resolved.

Summary by CodeRabbit

Chores

  • API Route Cleanup: Removed HTTP OPTIONS method support from numerous API endpoints across integration connectors (including Atlassian, AWS, Azure, BigPanda, Bitbucket, Cloudflare, Datadog, GitHub, Jenkins, Jira, and many others), streamlining request handling.
  • Route Refactoring: Separated combined GET/POST endpoint handlers into distinct routes for improved clarity in GCP, Azure, and organization endpoints.

@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@isiddharthsingh has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 25 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 13 minutes and 25 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b791014c-9731-4dec-934a-5a8c073ff2ae

📥 Commits

Reviewing files that changed from the base of the PR and between be37a85 and 8c43013.

📒 Files selected for processing (39)
  • server/routes/account_management.py
  • server/routes/atlassian/atlassian_routes.py
  • server/routes/auth_routes.py
  • server/routes/aws/auth.py
  • server/routes/aws/aws_routes.py
  • server/routes/aws/onboarding.py
  • server/routes/azure/azure_routes.py
  • server/routes/bigpanda/bigpanda_routes.py
  • server/routes/bitbucket/bitbucket.py
  • server/routes/bitbucket/bitbucket_browsing.py
  • server/routes/ci_shared.py
  • server/routes/cloudbees/cloudbees_routes.py
  • server/routes/cloudflare/cloudflare_routes.py
  • server/routes/command_policies.py
  • server/routes/confluence/confluence_routes.py
  • server/routes/connector_status.py
  • server/routes/coroot/coroot_routes.py
  • server/routes/datadog/datadog_routes.py
  • server/routes/debug/debug_routes.py
  • server/routes/gcp/projects.py
  • server/routes/gcp/root_project.py
  • server/routes/github/github.py
  • server/routes/github/github_user_repos.py
  • server/routes/grafana/grafana_routes.py
  • server/routes/jenkins/jenkins_routes.py
  • server/routes/knowledge_base/routes.py
  • server/routes/llm_usage_routes.py
  • server/routes/netdata/netdata_routes.py
  • server/routes/notion/notion_routes.py
  • server/routes/opsgenie/opsgenie_routes.py
  • server/routes/org_routes.py
  • server/routes/ovh/ovh_api_routes.py
  • server/routes/pagerduty/pagerduty_routes.py
  • server/routes/scaleway/scaleway_routes.py
  • server/routes/spinnaker/spinnaker_routes.py
  • server/routes/splunk/search_routes.py
  • server/routes/thousandeyes/thousandeyes_routes.py
  • server/routes/user_connections.py
  • server/routes/user_preferences.py

Walkthrough

This pull request systematically removes explicit HTTP OPTIONS method handling from Flask route endpoints across multiple connector modules and core routes. This eliminates CORS preflight response logic by removing OPTIONS from route method declarations and deleting conditional branches that returned preflight responses.

Changes

Cohort / File(s) Summary
Authentication & Core Routes
server/routes/auth_routes.py, server/routes/atlassian/atlassian_routes.py, server/routes/aws/auth.py
Removed OPTIONS from POST/DELETE endpoints; eliminated early-return CORS response branches and create_cors_response imports.
AWS Integration
server/routes/aws/onboarding.py
Removed OPTIONS from five AWS onboarding endpoints (/aws/role, /aws/cleanup, /aws/accounts/*); deleted inline CORS preflight handling.
Azure & GCP Cloud Providers
server/routes/azure/azure_routes.py, server/routes/gcp/auth.py, server/routes/gcp/projects.py
Azure: split combined GET/POST /azure-subscriptions into separate handlers with distinct permissions. GCP: split sa_project_access into GET and POST handlers; extracted token loading and IAM logic into helpers.
Monitoring & Observability Connectors
server/routes/datadog/datadog_routes.py, server/routes/dynatrace/dynatrace_routes.py, server/routes/grafana/grafana_routes.py, server/routes/newrelic/newrelic_routes.py, server/routes/netdata/netdata_routes.py, server/routes/splunk/splunk_routes.py, server/routes/splunk/search_routes.py
Removed OPTIONS from connect/disconnect/webhook/status endpoints across all monitoring integrations; deleted conditional CORS preflight branches in webhook handlers.
Repository & CI Connectors
server/routes/github/github.py, server/routes/jenkins/jenkins_routes.py, server/routes/bitbucket/bitbucket.py, server/routes/bitbucket/bitbucket_selection.py, server/routes/spinnaker/spinnaker_routes.py
Removed OPTIONS from login/disconnect/webhook endpoints; eliminated in-handler CORS response logic and create_cors_response imports.
Ticketing & Incident Management
server/routes/jira/jira_routes.py, server/routes/pagerduty/pagerduty_routes.py, server/routes/opsgenie/opsgenie_routes.py
Removed OPTIONS from all endpoint method declarations; deleted early-return CORS response branches in webhook/management endpoints.
Other Integrations
server/routes/bigpanda/bigpanda_routes.py, server/routes/cloudbees/cloudbees_routes.py, server/routes/cloudflare/cloudflare_routes.py, server/routes/confluence/confluence_routes.py, server/routes/coroot/coroot_routes.py, server/routes/notion/notion_routes.py, server/routes/scaleway/scaleway_routes.py, server/routes/sharepoint/sharepoint_routes.py, server/routes/thousandeyes/thousandeyes_routes.py, server/routes/ovh/...
Systematically removed OPTIONS from route method lists; eliminated inline CORS preflight handling branches.
Infrastructure Routes
server/routes/org_routes.py, server/routes/command_policies.py, server/routes/knowledge_base/routes.py, server/routes/ci_shared.py
Removed OPTIONS from org/command-policy/KB endpoints. Org routes: split /invitations into separate GET and POST handlers (list_invitations, create_invitation).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

security

Suggested reviewers

  • Zarlanx
  • damianloch

Poem

🐰 With a hop and a skip through OPTIONS we go,
Removing preflight paths that once took the show,
CORS requests simplified across the land,
Routes now firmer, more carefully planned! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 69.83% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely summarizes the main change: resolving CSRF security hotspots flagged by SonarQube by removing redundant OPTIONS handling from Flask routes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sms10221/dev-sonarqube-security-hotspots

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Base automatically changed from sms10221/dev-sonarqube-202-sweep to main April 24, 2026 02:36
@isiddharthsingh
isiddharthsingh force-pushed the sms10221/dev-sonarqube-security-hotspots branch from 772a680 to be37a85 Compare April 24, 2026 03:00
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (21)
server/routes/ci_shared.py (1)

19-19: 🧹 Nitpick | 🔵 Trivial

Inconsistent OPTIONS cleanup — strip "OPTIONS" from the GET route too.

The PR's stated intent is to drop redundant "OPTIONS" from methods= so Flask + Flask-CORS handle preflight automatically, and the @require_permission decorator also short-circuits OPTIONS via create_cors_response() as defense-in-depth. Line 25 follows this pattern for PUT, but line 19 still declares "OPTIONS" on GET /rca-settings. Since both handlers are registered on the same URL rule, this leaves preflight behavior wired through the GET handler for this path only, which is inconsistent with the rest of the 117-route cleanup done in this PR.

♻️ Suggested consistency fix
-    `@blueprint.route`("/rca-settings", methods=["GET", "OPTIONS"])
+    `@blueprint.route`("/rca-settings", methods=["GET"])
     `@require_permission`("connectors", "read")
     def get_rca_settings(user_id):

Based on learnings: "Applies to server/connectors/**/*.py : Do not manually call get_user_id_from_request() or handle OPTIONS in connector routes decorated with require_permission" — the same principle is being applied across server/routes/** in this PR.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/ci_shared.py` at line 19, The GET route decorated with
`@blueprint.route`("/rca-settings", methods=["GET", "OPTIONS"]) is inconsistent
with the rest of the refactor; remove "OPTIONS" from the methods list so it
becomes methods=["GET"] (letting Flask/Flask-CORS and the
require_permission/create_cors_response flow handle preflight), mirroring the
PUT handler change and keeping preflight behavior consistent for the
"/rca-settings" route.
server/routes/azure/azure_routes.py (1)

77-81: ⚠️ Potential issue | 🟠 Major

Missed OPTIONS cleanup contradicts the PR's stated objective.

Per the PR description, this is one of the three routes targeted for CSRF / preflight cleanup ("azure/fetch_data ... GET scoped to read"), yet OPTIONS is still declared in methods= and the handler still branches on request.method == 'OPTIONS' to call create_cors_response(). Flask‑CORS should handle preflight automatically, consistent with the treatment applied to the other 117 routes in this PR. Please drop both the method entry and the branch (and then create_cors_response will no longer be referenced from this function).

🔧 Suggested fix
-@azure_bp.route("/azure/fetch_data", methods=["GET", "OPTIONS"])
+@azure_bp.route("/azure/fetch_data", methods=["GET"])
 `@require_permission`("connectors", "read")
 def fetch_data(user_id):
-    if flask.request.method == 'OPTIONS':
-        return create_cors_response()
     try:

Based on learnings: "Applies to server/connectors/**/*.py : Do not manually call get_user_id_from_request() or handle OPTIONS in connector routes decorated with require_permission" (the same pattern is the explicit goal of this PR for server/routes/**).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/azure/azure_routes.py` around lines 77 - 81, The route handler
azure_bp.route("/azure/fetch_data", methods=["GET", "OPTIONS"]) should be
simplified to only handle GET: remove "OPTIONS" from the methods list and delete
the branch that checks flask.request.method == 'OPTIONS' and calls
create_cors_response() inside fetch_data; leave the
require_permission("connectors", "read") decorator and the GET logic intact so
Flask‑CORS handles preflight automatically and create_cors_response is no longer
referenced from this function.
server/routes/netdata/netdata_routes.py (1)

12-12: ⚠️ Potential issue | 🟡 Minor

Remove unused create_cors_response import.

create_cors_response is not referenced anywhere in the file after OPTIONS handlers were removed. Remove this unused import to clean up the file.

♻️ Proposed fix
-from utils.web.cors_utils import create_cors_response
 from utils.auth.token_management import get_token_data, store_tokens_in_db
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/netdata/netdata_routes.py` at line 12, Remove the unused import
create_cors_response from the top-level imports (the import statement
referencing utils.web.cors_utils and create_cors_response) in netdata_routes.py;
simply delete that identifier from the import line (or remove the entire import
if nothing else is imported from utils.web.cors_utils) so no unused symbols
remain.
server/routes/thousandeyes/thousandeyes_routes.py (1)

15-15: ⚠️ Potential issue | 🟡 Minor

Remove unused create_cors_response import.

The import at line 15 is not referenced anywhere in the file and should be dropped to clean up orphaned imports.

Proposed fix
-from utils.web.cors_utils import create_cors_response
 from utils.auth.rbac_decorators import require_permission
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/thousandeyes/thousandeyes_routes.py` at line 15, Remove the
unused import create_cors_response from the top of the file: locate the import
statement that references create_cors_response and delete it so there are no
orphaned imports; ensure no other references to create_cors_response exist in
the module (e.g., in route handlers or helper functions) before committing the
change.
server/routes/cloudbees/cloudbees_routes.py (1)

16-16: ⚠️ Potential issue | 🟡 Minor

Remove unused create_cors_response import.

The create_cors_response function is imported at line 16 but is not referenced anywhere in this file. Since the PR removed similar orphaned imports from other route files, this one should be removed for consistency.

Proposed fix
-from utils.web.cors_utils import create_cors_response
 from utils.web.webhook_signature import SIGNATURE_HEADER, verify_webhook_signature
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/cloudbees/cloudbees_routes.py` at line 16, The import
create_cors_response is unused in this module; remove the offending import
statement that references create_cors_response to eliminate the orphaned import
and keep imports consistent with other route files—search for the symbol
create_cors_response in this file and delete its import line (from
utils.web.cors_utils import create_cors_response).
server/routes/opsgenie/opsgenie_routes.py (1)

14-14: 🧹 Nitpick | 🔵 Trivial

Remove unused create_cors_response import.

After the OPTIONS branches were removed, create_cors_response is no longer referenced. Drop it to clean up orphaned imports.

♻️ Proposed fix
-from utils.web.cors_utils import create_cors_response
 from utils.auth.token_management import get_token_data, store_tokens_in_db
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/opsgenie/opsgenie_routes.py` at line 14, The import
create_cors_response in opsgenie_routes.py is no longer used; remove it from the
top-level import statement (delete the create_cors_response symbol or the entire
import line if it only contained that symbol) so the file no longer has an
orphaned import; ensure there are no other references to create_cors_response in
functions or route handlers before committing.
server/routes/github/github.py (1)

499-511: 🧹 Nitpick | 🔵 Trivial

Ad-hoc CORS headers in download_github_repo violate coding guidelines.

While outside this diff, this hand-rolled CORS block is inconsistent with the PR theme and still advertises Access-Control-Allow-Methods: 'GET, POST, OPTIONS' even though the route decorator is now POST-only after your change on line 444. Consider removing these manual headers and letting Flask-CORS populate them — or at minimum update the Allow-Methods value to reflect that only POST is supported.

As per coding guidelines: "Use centralized CORS utility for CORS handling (never add ad-hoc Access-Control-* headers in route files)".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/github/github.py` around lines 499 - 511, The
download_github_repo route currently sets ad-hoc CORS headers on response_data
(Access-Control-Allow-Origin/Headers/Methods/Credentials) which violates the
centralized CORS policy; remove this manual CORS block from download_github_repo
and let the centralized Flask-CORS utility manage CORS, or if you must keep
local headers temporarily, at minimum change the Access-Control-Allow-Methods
value to only include POST and ensure Origin handling uses the centralized
allowed origins list rather than inline os.getenv; reference the
download_github_repo function and the response_data variable to locate and
remove/update the header-setting code.
server/routes/coroot/coroot_routes.py (1)

16-16: 🧹 Nitpick | 🔵 Trivial

Orphaned create_cors_response import.

After the OPTIONS removals in /connect and /disconnect, create_cors_response is no longer referenced anywhere in this file. Per the PR summary ("Removed three now-orphaned create_cors_response imports"), this file appears to have been missed — please remove the import for consistency.

♻️ Proposed cleanup
-from utils.web.cors_utils import create_cors_response
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/coroot/coroot_routes.py` at line 16, Remove the now-orphaned
import "create_cors_response" from the top of the file (the line reading "from
utils.web.cors_utils import create_cors_response") because OPTIONS handling for
"/connect" and "/disconnect" was removed and this symbol is no longer
referenced; simply delete that import to keep imports consistent and avoid
unused-import warnings.
server/routes/jenkins/jenkins_routes.py (1)

11-11: ⚠️ Potential issue | 🟡 Minor

Remove orphaned create_cors_response import.

The import on line 11 is unused and should be removed.

Diff
-from utils.web.cors_utils import create_cors_response
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/jenkins/jenkins_routes.py` at line 11, Remove the unused import
create_cors_response from utils.web.cors_utils in the jenkins_routes module;
locate the import statement "from utils.web.cors_utils import
create_cors_response" and delete it so the file no longer contains the orphaned
symbol and linter warnings are resolved.
server/routes/grafana/grafana_routes.py (1)

10-10: ⚠️ Potential issue | 🟡 Minor

Remove orphaned create_cors_response import.

The import at line 10 is no longer used anywhere in this file. After removing the OPTIONS branches from handlers, this dependency should be dropped.

♻️ Proposed cleanup
-from utils.web.cors_utils import create_cors_response
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/grafana/grafana_routes.py` at line 10, Remove the now-unused
import create_cors_response from the top of the module to eliminate the orphaned
dependency; locate the import statement that reads "from utils.web.cors_utils
import create_cors_response" and delete it so the module no longer imports
create_cors_response (verify no other references to create_cors_response remain
in functions or handlers such as any OPTIONS branches you removed).
server/routes/cloudflare/cloudflare_routes.py (1)

123-123: ⚠️ Potential issue | 🟡 Minor

GET routes still list "OPTIONS" — inconsistent with the rest of the file.

POST /cloudflare/connect, POST /cloudflare/zones, and POST /cloudflare/disconnect were narrowed correctly, but GET /cloudflare/zones (Line 123) and GET /cloudflare/status (Line 210) still have methods=['GET', 'OPTIONS']. Per the PR objective, these should be trimmed too so Flask‑CORS handles preflight uniformly.

-@cloudflare_bp.route('/cloudflare/zones', methods=['GET', 'OPTIONS'])
+@cloudflare_bp.route('/cloudflare/zones', methods=['GET'])
...
-@cloudflare_bp.route('/cloudflare/status', methods=['GET', 'OPTIONS'])
+@cloudflare_bp.route('/cloudflare/status', methods=['GET'])

Also applies to: 210-210

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/cloudflare/cloudflare_routes.py` at line 123, The GET routes
still include 'OPTIONS' in their route decorators; update the
cloudflare_bp.route declarations for the GET endpoints (specifically the
'/cloudflare/zones' and '/cloudflare/status' route decorators) to remove
'OPTIONS' so their methods lists are just ['GET'], allowing Flask-CORS to handle
preflight uniformly like the POST routes were updated.
server/routes/confluence/confluence_routes.py (1)

25-25: ⚠️ Potential issue | 🟡 Minor

/status still has the "OPTIONS" method + create_cors_response() branch.

/connect, /disconnect, /fetch, and /parse were correctly cleaned, but status (Lines 272‑277) still declares methods=["GET", "OPTIONS"] and retains the if request.method == "OPTIONS": return create_cors_response() early return. This is the only remaining reason create_cors_response is imported on Line 25. Either finish the cleanup here, or the file ends up in a mixed state inconsistent with the rest of the PR.

-@confluence_bp.route("/status", methods=["GET", "OPTIONS"])
+@confluence_bp.route("/status", methods=["GET"])
 `@require_permission`("connectors", "read")
 def status(user_id):
     """Check Confluence connection status."""
-    if request.method == "OPTIONS":
-        return create_cors_response()
-
     creds = _get_stored_confluence_credentials(user_id)

Then drop the now‑unused from utils.web.cors_utils import create_cors_response on Line 25.

Also applies to: 272-277

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/confluence/confluence_routes.py` at line 25, The /status route
still handles "OPTIONS" and calls create_cors_response; update the route
decorator for the status endpoint to only declare methods=["GET"] and remove the
early branch that checks request.method == "OPTIONS" and returns
create_cors_response(), and then delete the now-unused import
create_cors_response from the top of the file; locate the status view (the
function handling the "/status" route) and remove the OPTIONS handling and
import to match the cleanup done for /connect, /disconnect, /fetch, and /parse.
server/routes/notion/notion_routes.py (1)

206-206: ⚠️ Potential issue | 🟡 Minor

Leftover "OPTIONS" on GET routes breaks the PR's consistency goal.

/connect, /oauth/callback, and /disconnect were correctly narrowed, but /status (Line 206), /databases (Line 323), and /databases/<db_id> (Line 386) still declare methods=["GET", "OPTIONS"]. Per the PR objective (strip OPTIONS from all ~117 routes so Flask‑CORS handles preflight), these should be updated as well — otherwise the file has a mixed pattern that future readers will find confusing.

-@notion_bp.route("/status", methods=["GET", "OPTIONS"])
+@notion_bp.route("/status", methods=["GET"])
...
-@notion_bp.route("/databases", methods=["GET", "OPTIONS"])
+@notion_bp.route("/databases", methods=["GET"])
...
-@notion_bp.route("/databases/<db_id>", methods=["GET", "OPTIONS"])
+@notion_bp.route("/databases/<db_id>", methods=["GET"])

Also applies to: 323-323, 386-386

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/notion/notion_routes.py` at line 206, Routes for
`@notion_bp.route`("/status"), `@notion_bp.route`("/databases") and
`@notion_bp.route`("/databases/<db_id>") still include "OPTIONS" in their methods
list which contradicts the PR goal to let Flask‑CORS handle preflight; edit each
route decorator to remove "OPTIONS" so the methods array only lists the actual
HTTP verbs (e.g., "GET") used by the view functions (status, databases,
databases/<db_id>), keeping the rest of the decorator and function body
unchanged.
server/routes/knowledge_base/routes.py (1)

68-73: ⚠️ Potential issue | 🟡 Minor

Partial OPTIONS cleanup: GET handlers still register and branch on OPTIONS.

The write-side endpoints (PUT /memory, POST /upload, DELETE /documents/<doc_id>, POST /search) were correctly cleaned, but the read-side GETs (get_memory, list_documents, get_document) still declare methods=["GET", "OPTIONS"] and retain the in-handler if request.method == "OPTIONS": return create_cors_response() branch. This leaves the file in a mixed state that contradicts the PR's stated goal of letting Flask‑CORS handle preflight uniformly, and it's the only remaining reason create_cors_response is still imported on Line 19.

🧹 Suggested diff
-@knowledge_base_bp.route("/memory", methods=["GET", "OPTIONS"])
+@knowledge_base_bp.route("/memory", methods=["GET"])
 `@require_permission`("knowledge_base", "read")
 def get_memory(user_id):
     """Get the org's knowledge base memory content."""
-    if request.method == "OPTIONS":
-        return create_cors_response()
-
     org_id = get_org_id_from_request()
@@
-@knowledge_base_bp.route("/documents", methods=["GET", "OPTIONS"])
+@knowledge_base_bp.route("/documents", methods=["GET"])
 `@require_permission`("knowledge_base", "read")
 def list_documents(user_id):
     """List all documents for the user."""
-    if request.method == "OPTIONS":
-        return create_cors_response()
-
     org_id = get_org_id_from_request()
@@
-@knowledge_base_bp.route("/documents/<doc_id>", methods=["GET", "OPTIONS"])
+@knowledge_base_bp.route("/documents/<doc_id>", methods=["GET"])
 `@require_permission`("knowledge_base", "read")
 def get_document(user_id, doc_id: str):
     """Get a specific document's details."""
-    if request.method == "OPTIONS":
-        return create_cors_response()
-
     org_id = get_org_id_from_request()

Then the from utils.web.cors_utils import create_cors_response import on Line 19 can be removed.

Also applies to: 165-170, 367-372

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/knowledge_base/routes.py` around lines 68 - 73, GET handlers
get_memory, list_documents, and get_document still declare methods=["GET",
"OPTIONS"] and contain in-handler branches returning create_cors_response;
remove OPTIONS from the route decorators for these functions (e.g.,
`@knowledge_base_bp.route`("/memory", methods=["GET"]),
`@knowledge_base_bp.route`("/documents", methods=["GET"]) and
`@knowledge_base_bp.route`("/documents/<doc_id>", methods=["GET"]) as applicable),
delete the in-handler checks "if request.method == 'OPTIONS': return
create_cors_response()" from those functions, and then remove the now-unused
import create_cors_response from the top of the file to finish the cleanup.
server/routes/command_policies.py (1)

46-50: ⚠️ Potential issue | 🟡 Minor

Two GET routes still register "OPTIONS" and short-circuit with ad-hoc jsonify({}), 200.

list_policies (Lines 46‑50) and list_templates (Lines 286‑290) were missed by this PR: they still declare methods=["GET", "OPTIONS"] and return an empty JSON body for OPTIONS. This both contradicts the PR objective of letting Flask‑CORS handle preflight, and it's an ad‑hoc response path that bypasses the project's centralized CORS utility.

-@command_policies_bp.route("/command-policies", methods=["GET", "OPTIONS"])
+@command_policies_bp.route("/command-policies", methods=["GET"])
 `@require_auth_only`
 def list_policies(user_id):
-    if request.method == "OPTIONS":
-        return jsonify({}), 200
-
     org_id = get_org_id_from_request()
@@
-@command_policies_bp.route("/command-policy-templates", methods=["GET", "OPTIONS"])
+@command_policies_bp.route("/command-policy-templates", methods=["GET"])
 `@require_auth_only`
 def list_templates(user_id):
-    if request.method == "OPTIONS":
-        return jsonify({}), 200
-
     templates = get_policy_templates()

As per coding guidelines ("Use centralized CORS utility for CORS handling (never add ad-hoc Access-Control-* headers in route files)"), these ad‑hoc preflight responses should be removed so the CORS layer handles it.

Also applies to: 286-290

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/command_policies.py` around lines 46 - 50, Remove the ad-hoc
preflight handling from the route definitions and let the centralized CORS
utility handle OPTIONS: in the list_policies and list_templates route handlers
remove "OPTIONS" from the methods=["GET", "OPTIONS"] declaration (make them
GET-only) and delete the request.method == "OPTIONS" conditional and its
jsonify({}), 200 return so the handler no longer short-circuits preflight
responses.
server/routes/bigpanda/bigpanda_routes.py (1)

16-16: ⚠️ Potential issue | 🟡 Minor

Remove unused import and complete OPTIONS cleanup for consistency.

The import create_cors_response (line 16) is unused in this file and should be removed. Additionally, routes on lines 72 and 167 still declare "OPTIONS" in their methods, while the PR removes OPTIONS handling elsewhere to let Flask-CORS handle preflight automatically. Bring these two routes into alignment:

  • Line 72: Change methods=["GET", "OPTIONS"] to methods=["GET"]
  • Line 167: Change methods=["GET", "OPTIONS"] to methods=["GET"]
  • Line 16: Remove the import statement
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/bigpanda/bigpanda_routes.py` at line 16, Remove the unused
import create_cors_response from the top of the file and update the two route
decorators that currently declare methods=["GET", "OPTIONS"] so they only
declare methods=["GET"] (i.e., remove "OPTIONS" from those methods arrays) to
let Flask-CORS handle preflight automatically; search for the import name
create_cors_response to delete and for route decorators containing
methods=["GET", "OPTIONS"] to change to methods=["GET"] so both locations are
updated consistently.
server/routes/spinnaker/spinnaker_routes.py (1)

17-17: ⚠️ Potential issue | 🟡 Minor

Remove orphaned create_cors_response import and trim OPTIONS from GET routes for consistency.

The POST/DELETE endpoints and /webhook/<user_id> were correctly narrowed in this PR, but every GET route still declares methods=["GET", "OPTIONS"] despite none of them using the CORS utility. Remove the now-unused import on line 17 and trim OPTIONS from /status, /applications, /applications/<app>/pipelines, /applications/<app>/pipeline-configs, /applications/<app>/health, /webhook-url, and /deployments.

Suggested diff
-from utils.web.cors_utils import create_cors_response
@@
-@spinnaker_bp.route("/status", methods=["GET", "OPTIONS"])
+@spinnaker_bp.route("/status", methods=["GET"])
@@
-@spinnaker_bp.route("/applications", methods=["GET", "OPTIONS"])
+@spinnaker_bp.route("/applications", methods=["GET"])
@@
-@spinnaker_bp.route("/applications/<app>/pipelines", methods=["GET", "OPTIONS"])
+@spinnaker_bp.route("/applications/<app>/pipelines", methods=["GET"])
@@
-@spinnaker_bp.route("/applications/<app>/pipeline-configs", methods=["GET", "OPTIONS"])
+@spinnaker_bp.route("/applications/<app>/pipeline-configs", methods=["GET"])
@@
-@spinnaker_bp.route("/applications/<app>/health", methods=["GET", "OPTIONS"])
+@spinnaker_bp.route("/applications/<app>/health", methods=["GET"])
@@
-@spinnaker_bp.route("/webhook-url", methods=["GET", "OPTIONS"])
+@spinnaker_bp.route("/webhook-url", methods=["GET"])
@@
-@spinnaker_bp.route("/deployments", methods=["GET", "OPTIONS"])
+@spinnaker_bp.route("/deployments", methods=["GET"])
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/spinnaker/spinnaker_routes.py` at line 17, Remove the unused
create_cors_response import (symbol: create_cors_response) and update the GET
route decorators so they only specify "GET" (remove "OPTIONS") for the endpoints
handling /status, /applications, /applications/<app>/pipelines,
/applications/<app>/pipeline-configs, /applications/<app>/health, /webhook-url,
and /deployments; keep POST/DELETE and the /webhook/<user_id> route as-is.
Ensure no other code references create_cors_response before deleting the import
and run tests/lint to confirm no unused-import warnings remain.
server/routes/datadog/datadog_routes.py (1)

12-12: ⚠️ Potential issue | 🟡 Minor

Remove OPTIONS from GET routes and the orphaned create_cors_response import.

Connector routes decorated with @require_permission should not manually handle OPTIONS. The five GET endpoints (/status, /events, /monitors, /events/ingested, /webhook-url) still declare methods=["GET", "OPTIONS"], and the create_cors_response import on line 12 is no longer called anywhere in this file.

Suggested diff
-from utils.web.cors_utils import create_cors_response
@@
-@datadog_bp.route("/status", methods=["GET", "OPTIONS"])
+@datadog_bp.route("/status", methods=["GET"])
@@
-@datadog_bp.route("/events", methods=["GET", "OPTIONS"])
+@datadog_bp.route("/events", methods=["GET"])
@@
-@datadog_bp.route("/monitors", methods=["GET", "OPTIONS"])
+@datadog_bp.route("/monitors", methods=["GET"])
@@
-@datadog_bp.route("/events/ingested", methods=["GET", "OPTIONS"])
+@datadog_bp.route("/events/ingested", methods=["GET"])
@@
-@datadog_bp.route("/webhook-url", methods=["GET", "OPTIONS"])
+@datadog_bp.route("/webhook-url", methods=["GET"])
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/datadog/datadog_routes.py` at line 12, Remove the unused import
create_cors_response and stop manually handling OPTIONS on GET connector
endpoints: delete the from utils.web.cors_utils import create_cors_response line
and change the route decorators for the five GET handlers (the functions
handling /status, /events, /monitors, /events/ingested, /webhook-url) to only
declare methods=["GET"] (remove "OPTIONS"); keep the existing
`@require_permission` decorators unchanged so framework CORS/OPTIONS handling is
used automatically.
server/routes/org_routes.py (1)

244-244: 🧹 Nitpick | 🔵 Trivial

Inconsistent OPTIONS cleanup remaining on six sibling routes.

This file still registers OPTIONS and keeps the if request.method == "OPTIONS": return jsonify({}), 200 short-circuit on /current (244), / PATCH (298), /my-invitations (502), /stats (880), /activity (928), and /preferences GET (1039). The PATCH on line 298 is a mutating route, so Sonar S3752/S4502 may still flag it. For the stated consistency goal of the PR, consider dropping "OPTIONS" from these methods= lists and removing the in-handler early return, matching the treatment applied to the other routes in this file.

Also applies to: 298-298, 502-502, 880-880, 928-928, 1039-1039

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/org_routes.py` at line 244, Remove the explicit OPTIONS
handling and the in-handler OPTIONS short-circuit from the six routes to match
the rest of the file: update the decorators for the routes registered as
`@org_bp.route`("/current", methods=["GET", "OPTIONS"]), the PATCH route at
`@org_bp.route`("/", methods=["PATCH","OPTIONS"]) (and the sibling routes for
"/my-invitations", "/stats", "/activity", and the GET "/preferences") to drop
"OPTIONS" from their methods lists, and delete the corresponding if
request.method == "OPTIONS": return jsonify({}), 200 early-return blocks inside
those view functions so normal Flask/CORS handling will apply. Ensure you only
remove the OPTIONS entries and short-circuit logic; leave the route names and
other behavior unchanged.
server/routes/aws/onboarding.py (1)

27-27: 🧹 Nitpick | 🔵 Trivial

Inconsistency: several GET routes in this file still carry explicit OPTIONS + create_cors_response().

The PR removes explicit preflight handling from the POST/DELETE routes here (set_aws_role, workspace_cleanup, bulk_register_aws_accounts, delete_aws_account, reconnect_aws_account), relying on Flask + Flask-CORS to auto-handle OPTIONS. However, the surrounding GET routes in the same file (check_aws_environment, get_aws_onboarding_links, get_aws_onboarding_status, list_user_workspaces, list_aws_accounts, list_inactive_aws_accounts, get_cfn_template, get_cfn_quickcreate_link) still include 'OPTIONS' in their methods= list and short-circuit with create_cors_response().

Mixing both patterns within the same blueprint is surprising for future maintainers and means create_cors_response cannot yet be removed from the imports in this file. Consider applying the same cleanup to the remaining GET routes for consistency, or add a brief comment explaining why they are intentionally left as-is (e.g., out of SonarQube S3752 scope).

Also applies to: 72-72, 230-230, 268-268, 374-374, 520-520, 610-610, 708-708

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/aws/onboarding.py` at line 27, Several GET routes in this
blueprint still declare 'OPTIONS' and call create_cors_response(), which is
inconsistent with the POST/DELETE routes that rely on Flask-CORS; update each
GET route handler (check_aws_environment, get_aws_onboarding_links,
get_aws_onboarding_status, list_user_workspaces, list_aws_accounts,
list_inactive_aws_accounts, get_cfn_template, get_cfn_quickcreate_link) to
remove 'OPTIONS' from the methods list and remove the early
create_cors_response() short-circuit so they rely on Flask/Flask-CORS preflight
handling; after that, remove create_cors_response import (or if there is an
intentional exception, add a brief comment above the specific handler explaining
why it must keep explicit OPTIONS handling).
server/routes/aws/auth.py (1)

9-9: ⚠️ Potential issue | 🟡 Minor

Remove orphaned create_cors_response import.

The import on line 9 is unused. Both routes in this file use only POST methods with no OPTIONS handling, so create_cors_response is no longer needed.

Proposed fix
-from utils.web.cors_utils import create_cors_response
 from utils.auth.rbac_decorators import require_permission
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes/aws/auth.py` at line 9, Remove the unused import
create_cors_response from the top of the module: locate the import statement
"from utils.web.cors_utils import create_cors_response" and delete it so the
module no longer imports an orphaned symbol; verify no other references to
create_cors_response exist in this file (e.g., in any functions or route
handlers) and run linters/tests to confirm the unused-import warning is
resolved.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/routes/azure/azure_routes.py`:
- Around line 148-152: The GET handler azure_subscriptions_get still lists
"OPTIONS" in its route methods and contains an explicit OPTIONS branch, which
duplicates preflight handling and bypasses the S3752 hardening; update the route
decorator for azure_subscriptions_get to remove "OPTIONS" from methods and
delete the if request.method == "OPTIONS": return create_cors_response() branch
so that CORS preflight is handled centrally (as done for other routes) rather
than inside this handler.
- Around line 172-182: The POST handler azure_subscriptions_post currently only
logs the incoming projects and returns success without persisting or using the
injected user_id, causing silent data loss; either persist the selection by
calling the existing persistence helper (e.g., store_tokens_in_db(user_id,
{"projects": projects}, "azure") or a similar store_user_preference(...)
function) and validate the payload before storing, or add a clear comment that
selections are UI-only and will not be saved; also change the logging call to a
parameterized form (e.g., logging.info("Azure subscription selection update
received (count=%d)", len(projects))) to avoid f-strings and avoid logging raw
client payloads, and remove the unused user_id warning by using it when
persisting.

In `@server/routes/gcp/projects.py`:
- Around line 170-208: The route sa_project_access_get currently declares
methods=["GET", "OPTIONS"] and contains an in-function OPTIONS branch returning
create_cors_response(), which is redundant with global Flask-CORS and the
require_permission decorator behavior; update the `@gcp_projects_bp.route`
decorator on sa_project_access_get to remove "OPTIONS" so it only registers GET,
and delete the in-function check that returns create_cors_response() (the lines
handling request.method == "OPTIONS"), leaving the rest of sa_project_access_get
intact.

---

Outside diff comments:
In `@server/routes/aws/auth.py`:
- Line 9: Remove the unused import create_cors_response from the top of the
module: locate the import statement "from utils.web.cors_utils import
create_cors_response" and delete it so the module no longer imports an orphaned
symbol; verify no other references to create_cors_response exist in this file
(e.g., in any functions or route handlers) and run linters/tests to confirm the
unused-import warning is resolved.

In `@server/routes/aws/onboarding.py`:
- Line 27: Several GET routes in this blueprint still declare 'OPTIONS' and call
create_cors_response(), which is inconsistent with the POST/DELETE routes that
rely on Flask-CORS; update each GET route handler (check_aws_environment,
get_aws_onboarding_links, get_aws_onboarding_status, list_user_workspaces,
list_aws_accounts, list_inactive_aws_accounts, get_cfn_template,
get_cfn_quickcreate_link) to remove 'OPTIONS' from the methods list and remove
the early create_cors_response() short-circuit so they rely on Flask/Flask-CORS
preflight handling; after that, remove create_cors_response import (or if there
is an intentional exception, add a brief comment above the specific handler
explaining why it must keep explicit OPTIONS handling).

In `@server/routes/azure/azure_routes.py`:
- Around line 77-81: The route handler azure_bp.route("/azure/fetch_data",
methods=["GET", "OPTIONS"]) should be simplified to only handle GET: remove
"OPTIONS" from the methods list and delete the branch that checks
flask.request.method == 'OPTIONS' and calls create_cors_response() inside
fetch_data; leave the require_permission("connectors", "read") decorator and the
GET logic intact so Flask‑CORS handles preflight automatically and
create_cors_response is no longer referenced from this function.

In `@server/routes/bigpanda/bigpanda_routes.py`:
- Line 16: Remove the unused import create_cors_response from the top of the
file and update the two route decorators that currently declare methods=["GET",
"OPTIONS"] so they only declare methods=["GET"] (i.e., remove "OPTIONS" from
those methods arrays) to let Flask-CORS handle preflight automatically; search
for the import name create_cors_response to delete and for route decorators
containing methods=["GET", "OPTIONS"] to change to methods=["GET"] so both
locations are updated consistently.

In `@server/routes/ci_shared.py`:
- Line 19: The GET route decorated with `@blueprint.route`("/rca-settings",
methods=["GET", "OPTIONS"]) is inconsistent with the rest of the refactor;
remove "OPTIONS" from the methods list so it becomes methods=["GET"] (letting
Flask/Flask-CORS and the require_permission/create_cors_response flow handle
preflight), mirroring the PUT handler change and keeping preflight behavior
consistent for the "/rca-settings" route.

In `@server/routes/cloudbees/cloudbees_routes.py`:
- Line 16: The import create_cors_response is unused in this module; remove the
offending import statement that references create_cors_response to eliminate the
orphaned import and keep imports consistent with other route files—search for
the symbol create_cors_response in this file and delete its import line (from
utils.web.cors_utils import create_cors_response).

In `@server/routes/cloudflare/cloudflare_routes.py`:
- Line 123: The GET routes still include 'OPTIONS' in their route decorators;
update the cloudflare_bp.route declarations for the GET endpoints (specifically
the '/cloudflare/zones' and '/cloudflare/status' route decorators) to remove
'OPTIONS' so their methods lists are just ['GET'], allowing Flask-CORS to handle
preflight uniformly like the POST routes were updated.

In `@server/routes/command_policies.py`:
- Around line 46-50: Remove the ad-hoc preflight handling from the route
definitions and let the centralized CORS utility handle OPTIONS: in the
list_policies and list_templates route handlers remove "OPTIONS" from the
methods=["GET", "OPTIONS"] declaration (make them GET-only) and delete the
request.method == "OPTIONS" conditional and its jsonify({}), 200 return so the
handler no longer short-circuits preflight responses.

In `@server/routes/confluence/confluence_routes.py`:
- Line 25: The /status route still handles "OPTIONS" and calls
create_cors_response; update the route decorator for the status endpoint to only
declare methods=["GET"] and remove the early branch that checks request.method
== "OPTIONS" and returns create_cors_response(), and then delete the now-unused
import create_cors_response from the top of the file; locate the status view
(the function handling the "/status" route) and remove the OPTIONS handling and
import to match the cleanup done for /connect, /disconnect, /fetch, and /parse.

In `@server/routes/coroot/coroot_routes.py`:
- Line 16: Remove the now-orphaned import "create_cors_response" from the top of
the file (the line reading "from utils.web.cors_utils import
create_cors_response") because OPTIONS handling for "/connect" and "/disconnect"
was removed and this symbol is no longer referenced; simply delete that import
to keep imports consistent and avoid unused-import warnings.

In `@server/routes/datadog/datadog_routes.py`:
- Line 12: Remove the unused import create_cors_response and stop manually
handling OPTIONS on GET connector endpoints: delete the from
utils.web.cors_utils import create_cors_response line and change the route
decorators for the five GET handlers (the functions handling /status, /events,
/monitors, /events/ingested, /webhook-url) to only declare methods=["GET"]
(remove "OPTIONS"); keep the existing `@require_permission` decorators unchanged
so framework CORS/OPTIONS handling is used automatically.

In `@server/routes/github/github.py`:
- Around line 499-511: The download_github_repo route currently sets ad-hoc CORS
headers on response_data
(Access-Control-Allow-Origin/Headers/Methods/Credentials) which violates the
centralized CORS policy; remove this manual CORS block from download_github_repo
and let the centralized Flask-CORS utility manage CORS, or if you must keep
local headers temporarily, at minimum change the Access-Control-Allow-Methods
value to only include POST and ensure Origin handling uses the centralized
allowed origins list rather than inline os.getenv; reference the
download_github_repo function and the response_data variable to locate and
remove/update the header-setting code.

In `@server/routes/grafana/grafana_routes.py`:
- Line 10: Remove the now-unused import create_cors_response from the top of the
module to eliminate the orphaned dependency; locate the import statement that
reads "from utils.web.cors_utils import create_cors_response" and delete it so
the module no longer imports create_cors_response (verify no other references to
create_cors_response remain in functions or handlers such as any OPTIONS
branches you removed).

In `@server/routes/jenkins/jenkins_routes.py`:
- Line 11: Remove the unused import create_cors_response from
utils.web.cors_utils in the jenkins_routes module; locate the import statement
"from utils.web.cors_utils import create_cors_response" and delete it so the
file no longer contains the orphaned symbol and linter warnings are resolved.

In `@server/routes/knowledge_base/routes.py`:
- Around line 68-73: GET handlers get_memory, list_documents, and get_document
still declare methods=["GET", "OPTIONS"] and contain in-handler branches
returning create_cors_response; remove OPTIONS from the route decorators for
these functions (e.g., `@knowledge_base_bp.route`("/memory", methods=["GET"]),
`@knowledge_base_bp.route`("/documents", methods=["GET"]) and
`@knowledge_base_bp.route`("/documents/<doc_id>", methods=["GET"]) as applicable),
delete the in-handler checks "if request.method == 'OPTIONS': return
create_cors_response()" from those functions, and then remove the now-unused
import create_cors_response from the top of the file to finish the cleanup.

In `@server/routes/netdata/netdata_routes.py`:
- Line 12: Remove the unused import create_cors_response from the top-level
imports (the import statement referencing utils.web.cors_utils and
create_cors_response) in netdata_routes.py; simply delete that identifier from
the import line (or remove the entire import if nothing else is imported from
utils.web.cors_utils) so no unused symbols remain.

In `@server/routes/notion/notion_routes.py`:
- Line 206: Routes for `@notion_bp.route`("/status"),
`@notion_bp.route`("/databases") and `@notion_bp.route`("/databases/<db_id>") still
include "OPTIONS" in their methods list which contradicts the PR goal to let
Flask‑CORS handle preflight; edit each route decorator to remove "OPTIONS" so
the methods array only lists the actual HTTP verbs (e.g., "GET") used by the
view functions (status, databases, databases/<db_id>), keeping the rest of the
decorator and function body unchanged.

In `@server/routes/opsgenie/opsgenie_routes.py`:
- Line 14: The import create_cors_response in opsgenie_routes.py is no longer
used; remove it from the top-level import statement (delete the
create_cors_response symbol or the entire import line if it only contained that
symbol) so the file no longer has an orphaned import; ensure there are no other
references to create_cors_response in functions or route handlers before
committing.

In `@server/routes/org_routes.py`:
- Line 244: Remove the explicit OPTIONS handling and the in-handler OPTIONS
short-circuit from the six routes to match the rest of the file: update the
decorators for the routes registered as `@org_bp.route`("/current",
methods=["GET", "OPTIONS"]), the PATCH route at `@org_bp.route`("/",
methods=["PATCH","OPTIONS"]) (and the sibling routes for "/my-invitations",
"/stats", "/activity", and the GET "/preferences") to drop "OPTIONS" from their
methods lists, and delete the corresponding if request.method == "OPTIONS":
return jsonify({}), 200 early-return blocks inside those view functions so
normal Flask/CORS handling will apply. Ensure you only remove the OPTIONS
entries and short-circuit logic; leave the route names and other behavior
unchanged.

In `@server/routes/spinnaker/spinnaker_routes.py`:
- Line 17: Remove the unused create_cors_response import (symbol:
create_cors_response) and update the GET route decorators so they only specify
"GET" (remove "OPTIONS") for the endpoints handling /status, /applications,
/applications/<app>/pipelines, /applications/<app>/pipeline-configs,
/applications/<app>/health, /webhook-url, and /deployments; keep POST/DELETE and
the /webhook/<user_id> route as-is. Ensure no other code references
create_cors_response before deleting the import and run tests/lint to confirm no
unused-import warnings remain.

In `@server/routes/thousandeyes/thousandeyes_routes.py`:
- Line 15: Remove the unused import create_cors_response from the top of the
file: locate the import statement that references create_cors_response and
delete it so there are no orphaned imports; ensure no other references to
create_cors_response exist in the module (e.g., in route handlers or helper
functions) before committing the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 380fb5bc-5181-45d5-8e79-2714f8b7ac74

📥 Commits

Reviewing files that changed from the base of the PR and between 1900854 and be37a85.

📒 Files selected for processing (37)
  • server/routes/atlassian/atlassian_routes.py
  • server/routes/auth_routes.py
  • server/routes/aws/auth.py
  • server/routes/aws/onboarding.py
  • server/routes/azure/azure_routes.py
  • server/routes/bigpanda/bigpanda_routes.py
  • server/routes/bitbucket/bitbucket.py
  • server/routes/bitbucket/bitbucket_selection.py
  • server/routes/ci_shared.py
  • server/routes/cloudbees/cloudbees_routes.py
  • server/routes/cloudflare/cloudflare_routes.py
  • server/routes/command_policies.py
  • server/routes/confluence/confluence_routes.py
  • server/routes/coroot/coroot_routes.py
  • server/routes/datadog/datadog_routes.py
  • server/routes/dynatrace/dynatrace_routes.py
  • server/routes/gcp/auth.py
  • server/routes/gcp/projects.py
  • server/routes/github/github.py
  • server/routes/grafana/grafana_routes.py
  • server/routes/jenkins/jenkins_routes.py
  • server/routes/jira/jira_routes.py
  • server/routes/knowledge_base/routes.py
  • server/routes/netdata/netdata_routes.py
  • server/routes/newrelic/newrelic_routes.py
  • server/routes/notion/notion_routes.py
  • server/routes/opsgenie/opsgenie_routes.py
  • server/routes/org_routes.py
  • server/routes/ovh/oauth2_auth_code_flow.py
  • server/routes/ovh/ovh_api_routes.py
  • server/routes/pagerduty/pagerduty_routes.py
  • server/routes/scaleway/scaleway_routes.py
  • server/routes/sharepoint/sharepoint_routes.py
  • server/routes/spinnaker/spinnaker_routes.py
  • server/routes/splunk/search_routes.py
  • server/routes/splunk/splunk_routes.py
  • server/routes/thousandeyes/thousandeyes_routes.py

Comment thread server/routes/azure/azure_routes.py Outdated
Comment thread server/routes/azure/azure_routes.py
Comment thread server/routes/gcp/projects.py Outdated
Comment thread server/routes/aws/auth.py
Comment thread server/routes/aws/onboarding.py
Comment thread server/routes/azure/azure_routes.py
Comment thread server/routes/azure/azure_routes.py Outdated
Comment thread server/routes/azure/azure_routes.py Outdated
Comment thread server/routes/azure/azure_routes.py
Comment thread server/routes/auth_routes.py
Comment thread server/routes/gcp/projects.py Outdated
Comment thread server/routes/gcp/projects.py Outdated
Comment thread server/routes/gcp/projects.py
Comment thread server/routes/gcp/projects.py
Comment thread server/routes/cloudbees/cloudbees_routes.py
Comment thread server/routes/gcp/projects.py Outdated
Comment thread server/routes/azure/azure_routes.py Outdated
Comment thread server/routes/auth_routes.py Outdated
Comment thread server/routes/aws/auth.py Outdated
@sonarqubecloud

Copy link
Copy Markdown

@Zarlanx
Zarlanx merged commit 1c68e5c into main Apr 24, 2026
15 checks passed
@Zarlanx
Zarlanx deleted the sms10221/dev-sonarqube-security-hotspots branch April 24, 2026 04:00
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.

2 participants