microcks-cli icon indicating copy to clipboard operation
microcks-cli copied to clipboard

fix: replace bare type assertions in API clients with proper error handling

Open rubrx opened this issue 7 months ago • 2 comments

Describe the bug

here both microcks_client.go and keycloak_client.go are unmarshalling into map[string]interface{} and then doing direct type assertions… which can get a bit risky

like configResp["enabled"].(bool) or openIDResp["access_token"].(string) etc (few spots across both files)

if the response shape is off then missing field, wrong type, or even an HTML error page and this will just panic and crash the CLI instead of returning a proper error.. better to switch to typed structs and let json.Unmarshal handle validation, also gets rid of all those assertions.

happy to open a PR if that works!!!!

rubrx avatar May 02 '26 20:05 rubrx

That works for sure! Please check what the scope covered by #272 is. From what I understand, it only covers the Keycloak connector but you'd better check

lbroudoux avatar May 04 '26 12:05 lbroudoux

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

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

There can be many reasons why some specific issue 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 issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] avatar Jun 04 '26 01:06 github-actions[bot]