Skip to content

refactor: address maintainability and security violations in McpController - #2069

Open
kishore08-07 wants to merge 3 commits into
microcks:masterfrom
kishore08-07:mcp-controller
Open

kishore08-07 wants to merge 3 commits into
microcks:masterfrom
kishore08-07:mcp-controller

Conversation

@kishore08-07

Copy link
Copy Markdown
Contributor

Description

This PR addresses SonarQube maintainability and security issues inMcpController as part of #2058.

The changes fix 18 violations across critical, major and minor severity levels without changing existing behaviour.

Critical:

  • Replace generic wildcard ResponseEntity<?> with ResponseEntity<Object> (S1452)
  • Add default cases to switch statements in handleMcpRequest and getResourceType (S131)

Major:

  • Remove unused variables (clientCapabilities, clientInfo) (S1481 & S1854)
  • Remove unused request parameter in handleToolsListRequest (S1172)
  • Remove unused getHeader method (S1144)

Minor:

  • Replace @RequestMapping with @GetMapping (S4488)
  • Sanitize user-controlled inputs in log statements (S5145)
  • Remove redundant switch blocks (S6205)
  • Replace switch with if in buildMcpToolConverter (S1301)

Introduce sanitize() helper method for safe logging of HTTP inputs

Related issue(s)

See also #2058

Address SonarQube maintainability and security violations

Critical:
- Replace wildcard ResponseEntity<?> with ResponseEntity<Object> (S1452)
- Add default cases to switch statements in handleMcpRequest and getResourceType (S131)

Major:
- Remove unused variables (clientCapabilities, clientInfo) (S1481)
- Remove unused request parameter in handleToolsListRequest and update call sites (S1172)
- Remove unused getHeader method (S1144)

Minor / Security:
- Replace @RequestMapping with @GetMapping (S4488)
- Sanitize user-controlled inputs in log statements (S5145)
- Remove redundant switch blocks (S6201)
- Replace switch with if in buildMcpToolConverter (S1301)

Introduce sanitize() helper method for safe logging of HTTP inputs

Signed-off-by: kishore08-07 <[email protected]>
@kishore08-07

Copy link
Copy Markdown
Contributor Author

@lbroudoux , @SebastienDegodez requesting your review whenever you have time.

@kishore08-07 kishore08-07 changed the title refactor: address SonarQube issues in McpController refactor: address maintainability and security violations in McpController May 8, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 30 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation.

There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. Microcks is a Cloud Native Computing Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions Bot added the stale State due to inactivity label Jul 20, 2026
@SebastienDegodez SebastienDegodez added the keep-open Explicitily keep open label Jul 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

keep-open Explicitily keep open stale State due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants