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

APIM-cli import breaks feAPIs with basic auth w/out password #470

Closed
emmanuel-galindo opened this issue Mar 13, 2024 · 12 comments
Closed

APIM-cli import breaks feAPIs with basic auth w/out password #470

emmanuel-galindo opened this issue Mar 13, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@emmanuel-galindo
Copy link

APIM-CLI version

1.14.2

API-Management version

7.7.3

Bug description

For a feAPI that has an outbound backend servier with BASIC auth, and only username defined and password is empty, "apim api get" retrieves:
" [...]
"authenticationProfiles" : [ {
"name" : "_default",
"isDefault" : true,
"parameters" : {
"username" : "user",
"id" : 0
},
[...]"
Doing an import with this, breaks the feAPI and user gets 500. Exception in logs reads:
"
[...]
nested fault: no password specified
java.lang.NullPointerException: no password specified
at com.vordel.dwe.http.ClientTransaction.basicAuthString(Native Method)
at com.vordel.circuit.net.BasicAuthNConnectionHandler$BasicState.getAuthToken(BasicAuthNConnectionHandler.java:152)
at com.vordel.circuit.net.BasicAuthNConnectionHandler$BasicState.expectContinue(BasicAuthNConnectionHandler.java:191)
[...]"

When setting this basic (user with no password) via API Manager UI, the PUT request body reads as:
" [...]
"authenticationProfiles": [
{
"name": "_default",
"isDefault": true,
"parameters": {
"username": "username",
"id": 0,
"password": ""
},
"type": "http_basic"
}
[...]"

Steps to reproduce

No response

Relevant log output

No response

@emmanuel-galindo emmanuel-galindo added the bug Something isn't working label Mar 13, 2024
@rathnapandi rathnapandi self-assigned this Mar 22, 2024
@emmanuel-galindo
Copy link
Author

@rathnapandi this is fixed in 1.14.4 right?

@rathnapandi
Copy link
Member

Hi @emmanuel-galindo, Can you test it with latest relelase?

rathnapandi pushed a commit that referenced this issue Aug 4, 2024
@jschutte27
Copy link

jschutte27 commented Feb 4, 2025

I am having this issue with 1.14.9 yet.

Actually, my issue may be different. The password in the file is not getting set at all and it is wiping out the existing one. I will have to test without a password to see if that also breaks it.

Ok, after testing it appears that a blank password does not break it, but setting the password in the api config file does not work.

@rathnapandi
Copy link
Member

Hi @jschutte27,

I can reproduce the issue; will let you know once it is fixed.

rathnapandi pushed a commit that referenced this issue Feb 25, 2025
rathnapandi pushed a commit that referenced this issue Feb 25, 2025
@rathnapandi
Copy link
Member

Hi @jschutte27,

I have fixed the issue. please test it with

axway-apimcli-1.14.11-SNAPSHOT.tar.gz

@rathnapandi
Copy link
Member

Fixed in 1.14.11

@jschutte27
Copy link

jschutte27 commented Feb 27, 2025

@rathnapandi, Sorry I wasn't able to test before the 1.14.11 release. I did some testing now with it and it still seems to cause issues with basic auth. I ran api get and then api import of one api with a password in the file (authenticationProfiles) and one without the password and they both result in error 500s when being accessed. Api gateway gives: java.lang.NullPointerException: no password specified

It seems like apim is removing the password either way and it we need it to ignore the password when missing or set it when provided.

Thanks.

@rathnapandi
Copy link
Member

Hi @jschutte27,

Due to security reasons APIM removes the password field from response for basic and 2-way SSL backend authentication. There are couple of options

  1. Enable a system property ( com.axway.apimanager.api.model.disable.confidential.fields to true) to return password from api manager.
  2. Add the password field in api-config.json before doing import operation. I did test and I don't see any issues connecting to the backend.

Thanks
Rathna

@jschutte27
Copy link

Sorry, I wasn't clear. I tried importing the file that was exported directly without the password field

"authenticationProfiles": [
{
"name": "_default",
"isDefault": true,
"parameters": {
"username": "xxxxxxxxxxxx",
"id": 0
},
"type": "http_basic"
}
]

and by adding the password field.

"authenticationProfiles": [
{
"name": "_default",
"isDefault": true,
"parameters": {
"username": "xxxxxxxxxxxxx",
"id": 0,
"password": "xxxxxxxxxxxxx"
},
"type": "http_basic"
}
]

Both ways seem to remove the password from the API so it returns error 500 with the null password stack trace.

@rathnapandi
Copy link
Member

I fixed the second item. Can you enable the traffic monitor and see whats being sent from CLI?

@jschutte27
Copy link

I am no longer able to reproduce the first issue (no password)... I don't know what happened this morning but it worked on two different API's now.

@jschutte27
Copy link

I misunderstood your previous comment. It does appear that the import is working correctly now if you specify the password in the api config file. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants