Skip to content

[TENABLE_IO] Use script to convert strings to numeric in asset datastream - #14681

Merged
StacieClark-Elastic merged 2 commits into
elastic:mainfrom
StacieClark-Elastic:bugfix/tenable-io-asset-datastream-use-script-for-long-conversion
Jul 25, 2025
Merged

[TENABLE_IO] Use script to convert strings to numeric in asset datastream #14681
StacieClark-Elastic merged 2 commits into
elastic:mainfrom
StacieClark-Elastic:bugfix/tenable-io-asset-datastream-use-script-for-long-conversion

Conversation

@StacieClark-Elastic

@StacieClark-Elastic StacieClark-Elastic commented Jul 24, 2025

Copy link
Copy Markdown
Contributor

The tenable io API for fetching asset data changed the response definition to return decimal values in strings that are defined by the API as integers. The convert processor for string to long fails on decimals. We replaced the convert processor with a painless script for fields exposure_score which becomes tenable_io.asset.exposure_score and acr_score which becomes tenable_io.asset.acr_score.

Proposed commit message

Fixes issue where string values that represent longs in fields acr_score and exposure score started to be returned from the tenable io asset API as strings with decimals. This caused the convert processor for strings to long to fail. Replaced the convert processor with a painless sctipt that handles strings as longs or decimals as well as primtive long, integer and double values. The issue is a due to the source changing returned values and violating the API contract

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • 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

Closes #14684

@StacieClark-Elastic
StacieClark-Elastic requested a review from a team as a code owner July 24, 2025 18:29
@StacieClark-Elastic StacieClark-Elastic added Integration:tenable_io Tenable Vulnerability Management bugfix Pull request that fixes a bug issue Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] labels Jul 24, 2025
@elasticmachine

Copy link
Copy Markdown

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

@StacieClark-Elastic
StacieClark-Elastic force-pushed the bugfix/tenable-io-asset-datastream-use-script-for-long-conversion branch from 9c4e98b to bdc349a Compare July 24, 2025 18:32
@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Jul 24, 2025

Copy link
Copy Markdown
Contributor

🚀 Benchmarks report

Package tenable_io 👍(2) 💚(2) 💔(1)

Expand to view
Data stream Previous EPS New EPS Diff (%) Result
asset 2450.98 1742.16 -708.82 (-28.92%) 💔

To see the full report comment with /test benchmark fullreport

@StacieClark-Elastic
StacieClark-Elastic force-pushed the bugfix/tenable-io-asset-datastream-use-script-for-long-conversion branch from bdc349a to 7999c84 Compare July 24, 2025 20:47
Fixes issue where string values that represent longs started to be returned from the tenable io asset API as strings with decimals. This caused the convert processor for strings to long to fail. Replaced the convert processor with a painless sctipt that handles strings as longs or decimals as well as primtive long, integer and double values. The issue is a due to the source changing returned values and violating the API contract
@StacieClark-Elastic
StacieClark-Elastic force-pushed the bugfix/tenable-io-asset-datastream-use-script-for-long-conversion branch from 7999c84 to 0416d37 Compare July 24, 2025 22:37
@elasticmachine

Copy link
Copy Markdown

💚 Build Succeeded

History

@StacieClark-Elastic
StacieClark-Elastic merged commit 3345a16 into elastic:main Jul 25, 2025
9 checks passed
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

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

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

Too late.

# newer versions go on top
- version: "4.2.1"
changes:
- description: |

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.

We don't need to preserve new lines so

Suggested change
- description: |
- description: >-
if: ctx.json?.acr_score != ''
ignore_missing: true
- script:
if: ctx.json?.acr_score != null && ctx.json?.acr_score != ''

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.

Suggested change
if: ctx.json?.acr_score != null && ctx.json?.acr_score != ''
if: ctx.json?.acr_score != null && ctx.json.acr_score != ''
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:tenable_io Tenable Vulnerability Management Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

4 participants