Skip to content

[beyondinsight_password_safe] Handle null password ion authentication - #17411

Merged
StacieClark-Elastic merged 10 commits into
elastic:mainfrom
StacieClark-Elastic:beyondinsight_password_safe-handle-null-password
Feb 25, 2026
Merged

StacieClark-Elastic merged 10 commits into
elastic:mainfrom
StacieClark-Elastic:beyondinsight_password_safe-handle-null-password

Conversation

@StacieClark-Elastic

@StacieClark-Elastic StacieClark-Elastic commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Proposed commit message

beyondinsight_password_safe: handle optional password in authentication

The BeyondInsight API does not always require a password for
authentication. The password will be null when it is not supplied.
Whether one is needed depends on the "User Password
Required" setting on the API registration in BeyondInsight. When no
password was configured, the integration failed because it assumed
the password field was always present in state.

ref: https://docs.beyondtrust.com/bips/docs/bi-cloud-configure-api

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • [x ] I have verified that all data streams collect metrics or logs.
  • [ x] I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

@StacieClark-Elastic
StacieClark-Elastic requested a review from a team as a code owner February 13, 2026 20:37
@StacieClark-Elastic StacieClark-Elastic added bugfix Pull request that fixes a bug issue Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] Integration:beyondinsight_password_safe BeyondInsight and Password Safe labels Feb 13, 2026
@elasticmachine

Copy link
Copy Markdown

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@StacieClark-Elastic StacieClark-Elastic changed the title Handle null password ion authentication [beyondinsight_password_safe] Handle null password ion authentication Feb 13, 2026
@StacieClark-Elastic
StacieClark-Elastic force-pushed the beyondinsight_password_safe-handle-null-password branch from 751fd99 to 49b09d2 Compare February 13, 2026 20:39
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@efd6 efd6 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.

Suggest the following commit message

beyondinsight_password_safe: handle optional password in authentication

The BeyondInsight API does not always require a password for
authentication. Whether one is needed depends on the "User Password
Required" setting on the API registration in BeyondInsight. When no
password was configured, the integration failed because it assumed
the password field was always present in state.

ref: https://docs.beyondtrust.com/bips/docs/bi-cloud-configure-api

url: http://{{Hostname}}:{{Port}}/BeyondTrust/api/public/v3
apikey: test_api_key
username: testuser2
password: null

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.

This has no default in the manifest, so it can be omitted here.

Suggested change
password: null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The test is specifically for when the password is null. Should we ever add a default in the manifest then this test will no longer test the condition for which it is written.

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.

In the state construction I think the password field should be conditionally included

{{#if password}}
  password: {{escape_string password}}
{{/if}}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The password always exists. Sometimes it is null.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I discussed this with @andrewkroh before I did the fix as I was also confused about the password existing and being null. This fix will allow users to not have to update their policies when the integration is updated.

"Authorization": [
sprintf("PS-Auth key=%s; runas=%s;", [state.apikey, state.username]) +
((state.password != "") ? (sprintf(" pwd=[%s];", [state.password])) : ""),
((state.?password.orValue("") != "") ? (sprintf(" pwd=[%s];", [state.password])) : ""),

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.

With conditional rendering into the config, this becomes has(state.password) ? …

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The password always exists. sometimes it is null.

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.

Can you confirm that password: {{escape_string password}} gives {"password": ""} if the password var is null?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

password: {{escape_string password}} gives null if the password is null. I added in the 'if' block and added some policy tests for null and empty string to verify that no password is set if the variable is null or empty and changed the system tests to test for a missing password.

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.

Can you confirm that a password state update from "something" to falsey will remove the password from the profile's configuration state?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If I update a policy that had a password, then leave the password field blank when I update the policy, it generates a policy with no password:
original:

        state:
          limit: 1000
          apikey: ${SECRET_0}
          password: ${SECRET_1}
          username: amiauser

updated:

        state:
          limit: 1000
          apikey: ${SECRET_0}
          username: amiauser

@efd6 efd6 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.

There are some whitespace changes that should be reverted and a query. After that LGTM.

}
]
`}}

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.

These deleted blank lines (also below) are stanza breaks for clarity. They should not be removed.

"Name": "Test User"
}
`}}

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.

Same here and below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

elastic-package format made those changes. That needs to be fixed.

"Name": "Test User"
}
`}}

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.

And here and below.

"Name": "Test User"
}
`}}

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.

And here and below.

"Name": "Test User"
}
`}}

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.

And here and below.

"Authorization": [
sprintf("PS-Auth key=%s; runas=%s;", [state.apikey, state.username]) +
((state.password != "") ? (sprintf(" pwd=[%s];", [state.password])) : ""),
((state.?password.orValue("") != "") ? (sprintf(" pwd=[%s];", [state.password])) : ""),

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.

Can you confirm that a password state update from "something" to falsey will remove the password from the profile's configuration state?

…k lines that had been removed by elastic-package format
@StacieClark-Elastic
StacieClark-Elastic enabled auto-merge (squash) February 24, 2026 18:11
@efd6

efd6 commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

/test

@elasticmachine

Copy link
Copy Markdown

💚 Build Succeeded

History

@StacieClark-Elastic
StacieClark-Elastic merged commit 8743104 into elastic:main Feb 25, 2026
9 checks passed
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package beyondinsight_password_safe - 0.12.2 containing this change is available at https://epr.elastic.co/package/beyondinsight_password_safe/0.12.2/

navnit-elastic pushed a commit to navnit-elastic/integrations that referenced this pull request Mar 2, 2026
…elastic#17411)

beyondinsight_password_safe: handle optional password in authentication

The BeyondInsight API does not always require a password for
authentication. The password will be null when it is not supplied.
Whether one is needed depends on the "User Password
Required" setting on the API registration in BeyondInsight. When no
password was configured, the integration failed because it assumed
the password field was always present in state.

ref: https://docs.beyondtrust.com/bips/docs/bi-cloud-configure-api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes a bug issue Integration:beyondinsight_password_safe BeyondInsight and Password Safe Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants