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

[APPSEC-55194] Handle low-level libddwaf exceptions #4041

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

Strech
Copy link
Contributor

@Strech Strech commented Oct 28, 2024

What does this PR do?

Wrap Processor::Context#run with an error handling and telemetry reporting.

Motivation:

Is some specific situations, our libddwaf-rb is going to throw an exception when it fails to convert C-object into Ruby-object and some other low-level occasions.

Change log entry

Not needed.

Additional Notes:

Likely we would change the interface of libddwaf-rb soon™️, but in foreseen future we need to be able to land on feet when something wrong happen with our FFI binding.

How to test the change?

CI is enough.

@Strech Strech added appsec Application Security monitoring product dev/internal Other internal work that does not need to be included in the changelog labels Oct 28, 2024
@Strech Strech marked this pull request as ready for review October 28, 2024 21:16
@Strech Strech requested a review from a team as a code owner October 28, 2024 21:16
@pr-commenter
Copy link

pr-commenter bot commented Oct 28, 2024

Benchmarks

Benchmark execution time: 2024-10-29 10:37:16

Comparing candidate commit a1ebf22 in PR branch appsec-55194-handle-low-level-libddwaf-exceptions with baseline commit 7f64645 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 2 unstable metrics.

@Strech Strech marked this pull request as draft October 29, 2024 06:56
@Strech Strech force-pushed the appsec-55194-handle-low-level-libddwaf-exceptions branch from 178d1d8 to 2cb89c0 Compare October 29, 2024 09:41
@Strech Strech force-pushed the appsec-55194-handle-low-level-libddwaf-exceptions branch from 2cb89c0 to a1ebf22 Compare October 29, 2024 09:59
@Strech Strech marked this pull request as ready for review October 29, 2024 10:00
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.85%. Comparing base (7f64645) to head (a1ebf22).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
lib/datadog/appsec/processor/context.rb 90.90% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4041   +/-   ##
=======================================
  Coverage   97.85%   97.85%           
=======================================
  Files        1321     1321           
  Lines       79318    79331   +13     
  Branches     3904     3905    +1     
=======================================
+ Hits        77620    77633   +13     
  Misses       1698     1698           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +268 to +269
expect(telemetry).to receive(:error).with(/libddwaf:[\d.]+ execution error: :err_internal/)
expect(telemetry).to receive(:report)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This suppose to be very unfortunate case, we will start with this approach and refactor it next (to report once?)

@Strech Strech merged commit 99a8dfb into master Oct 29, 2024
271 checks passed
@Strech Strech deleted the appsec-55194-handle-low-level-libddwaf-exceptions branch October 29, 2024 10:45
@github-actions github-actions bot added this to the 2.5.0 milestone Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appsec Application Security monitoring product dev/internal Other internal work that does not need to be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants