Skip to content

Commit

Permalink
Merge pull request #578 from wazuh/3.9-api-credentials
Browse files Browse the repository at this point in the history
Permit special charsets in API credentials
  • Loading branch information
Jesús Ángel authored Feb 25, 2019
2 parents 6287210 + 731e5d9 commit 7286d18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion SplunkAppForWazuh/appserver/controllers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_credentials(self, the_id):
opt_password = api['data']["passapi"]
opt_base_url = api['data']["url"]
opt_base_port = api['data']["portapi"]
url = opt_base_url + ":" + opt_base_port
url = str(opt_base_url) + ":" + str(opt_base_port)
auth = requestsbak.auth.HTTPBasicAuth(opt_username, opt_password)
verify = False
return url, auth, verify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ define(['../module'], function (module) {
api.userapi &&
api.passapi
) {
const checkConnectionEndpoint = `/manager/check_connection?ip=${
api.url
}&port=${api.portapi}&user=${api.userapi}&pass=${api.passapi}`
// Encode user and password, this prevent fails with special charsets
const user = encodeURIComponent(api.userapi)
const pass = encodeURIComponent(api.passapi)
const checkConnectionEndpoint = `/manager/check_connection?ip=${api.url}&port=${api.portapi}&user=${user}&pass=${pass}`
const result = await $requestService.httpReq(
'GET',
checkConnectionEndpoint
Expand Down Expand Up @@ -284,6 +285,7 @@ define(['../module'], function (module) {
const checkApiConnection = async id => {
try {
const api = await select(id)//Before update cluster or not cluster
const connect = await checkRawConnection(api)
const apiSaved = { ...api }
const updatedApi = await updateApiFilter(api)
let equal = true
Expand Down

0 comments on commit 7286d18

Please sign in to comment.