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

cisco_duo.auth: Provide option to ignore ingesting API Errors. #12870

Merged
merged 5 commits into from
Feb 28, 2025

Conversation

kcreddy
Copy link
Contributor

@kcreddy kcreddy commented Feb 24, 2025

Proposed commit message

Cisco Duo auth API rate limit is very low i.e., once per minute. 
Sometimes 429s are received even when requests are made 
less than once per minute. This leads to users ingesting 429 
API errors very often. 

Provide an option to users to ignore ingesting API Errors.
Currently only 429s are ignored when this option is enabled. 

Also add system tests for CEL input in auth data-stream.

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

Author's Checklist

  • [ ]

How to test this PR locally

System tests pass for auth data-stream:

--- Test results for package: cisco_duo - START ---
╭───────────┬─────────────┬───────────┬───────────┬────────┬───────────────╮
│ PACKAGE   │ DATA STREAM │ TEST TYPE │ TEST NAME │ RESULT │  TIME ELAPSED │
├───────────┼─────────────┼───────────┼───────────┼────────┼───────────────┤
│ cisco_duo │ auth        │ system    │ cel       │ PASS   │ 46.284483459s │
│ cisco_duo │ auth        │ system    │ httpjson  │ PASS   │ 43.683903833s │
╰───────────┴─────────────┴───────────┴───────────┴────────┴───────────────╯
--- Test results for package: cisco_duo - END   ---
Done

@kcreddy kcreddy self-assigned this Feb 24, 2025
@kcreddy kcreddy added enhancement New feature or request Integration:cisco_duo Cisco Duo Team:Security-Service Integrations Security Service Integrations Team [elastic/security-service-integrations] labels Feb 24, 2025
@kcreddy kcreddy marked this pull request as ready for review February 24, 2025 06:56
@kcreddy kcreddy requested a review from a team as a code owner February 24, 2025 06:56
@elasticmachine
Copy link

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

@elastic-vault-github-plugin-prod
Copy link

elastic-vault-github-plugin-prod bot commented Feb 24, 2025

🚀 Benchmarks report

Package cisco_duo 👍(3) 💚(0) 💔(5)

Expand to view
Data stream Previous EPS New EPS Diff (%) Result
auth 3322.26 2141.33 -1180.93 (-35.55%) 💔
offline_enrollment 31250 17857.14 -13392.86 (-42.86%) 💔
summary 55555.56 27777.78 -27777.78 (-50%) 💔
telephony 58823.53 32258.06 -26565.47 (-45.16%) 💔
telephony_v2 45454.55 14705.88 -30748.67 (-67.65%) 💔

To see the full report comment with /test benchmark fullreport

@kcreddy kcreddy requested a review from efd6 February 25, 2025 08:00
Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

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

Minor query only, otherwise LGTM

@@ -107,23 +108,36 @@ program: |

)
:
bytes(resp.Body).decode_json().as(body,
resp.StatusCode == 429 && (state.ignore_api_errors == "true") ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Does state.ignore_api_errors not get interpreted as a boolean by YAML?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it seems like without the quote, I get this error inside system tests:

Unit state changed cel-default-cel-cisco_duo-a76f1110-a53c-4c59-bf68-fec5bf59b33f (STARTING->FAILED): failed to check program: failed compilation: ERROR: <input>:76:64: found no matching overload for '_==_' applied to '(string, bool)'\n |             resp.StatusCode == 429 && (state.ignore_api_errors == true) ?\n | ...............................................................^ accessing config

I defined ignore_api_errors as boolean inside manifest.yml but still the program considers it as string.

Copy link
Contributor

Choose a reason for hiding this comment

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

It may be worth doing the converse conversion, bool(state.ignore_api_errors) in order to catch "ture" and similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in c3f9c49

@kcreddy kcreddy requested a review from efd6 February 27, 2025 06:40
Convert string option to bool.
@@ -107,23 +108,36 @@ program: |

)
:
bytes(resp.Body).decode_json().as(body,
resp.StatusCode == 429 && (bool(state.ignore_api_errors) == true) ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
resp.StatusCode == 429 && (bool(state.ignore_api_errors) == true) ?
resp.StatusCode == 429 && bool(state.ignore_api_errors) ?

Here, otherwise madness lies.

resp.StatusCode == 429 && (…((bool(state.ignore_api_errors) == true) == true) = true) …) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching. Done in 6fff53b

@kcreddy kcreddy requested a review from efd6 February 28, 2025 05:00
@elasticmachine
Copy link

💚 Build Succeeded

History

cc @kcreddy

@kcreddy kcreddy merged commit bf201c2 into elastic:main Feb 28, 2025
7 checks passed
@elastic-vault-github-plugin-prod

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Integration:cisco_duo Cisco Duo 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