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

Add appsec.blocked tag to span #2895

Merged
merged 5 commits into from
Jun 6, 2023
Merged

Conversation

GustavoCaso
Copy link
Member

@GustavoCaso GustavoCaso commented Jun 5, 2023

What does this PR do?

Make sure to add the appsec.blocked at the span when the request has been blocked.

The main change is on the different watcher files:

if span
  span.set_tag('appsec.blocked', 'true') if result.actions.include?('block')
  span.set_tag('appsec.event', 'true')
end

The line span.set_tag('appsec.blocked', 'true') if result.actions.include?('block') is the one adding the tag.

The rest of the changes are improving the codebase:

  • Added Event.build_service_entry_tags helper method to reduce the size of Event.record_via_span
  • Extract the shared examples for our integration specs to a separate file so they can be reuse by all the rack integrations specs

Motivation

Make sure our code is up to date with RFCs and system tests

Additional Notes

How to test the change?

CI

@github-actions github-actions bot added appsec Application Security monitoring product integrations Involves tracing integrations labels Jun 5, 2023
@GustavoCaso GustavoCaso force-pushed the appsec-add-appsec.blocked-tag branch 3 times, most recently from 27ae1a7 to 2034a37 Compare June 5, 2023 12:30
@GustavoCaso GustavoCaso changed the title WIP Add appsec.blocked tag to span Jun 5, 2023
@GustavoCaso GustavoCaso marked this pull request as ready for review June 5, 2023 12:35
@GustavoCaso GustavoCaso requested a review from a team June 5, 2023 12:35
@GustavoCaso GustavoCaso force-pushed the appsec-add-appsec.blocked-tag branch from deb8eb8 to 576335d Compare June 5, 2023 13:08
@GustavoCaso GustavoCaso force-pushed the appsec-add-appsec.blocked-tag branch from 576335d to 17b4d92 Compare June 5, 2023 13:26
@GustavoCaso GustavoCaso requested a review from lloeki June 5, 2023 13:47
@codecov-commenter
Copy link

Codecov Report

Merging #2895 (17b4d92) into master (5af21bc) will decrease coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2895      +/-   ##
==========================================
- Coverage   98.10%   98.09%   -0.02%     
==========================================
  Files        1266     1267       +1     
  Lines       70140    70000     -140     
  Branches     3186     3194       +8     
==========================================
- Hits        68813    68664     -149     
- Misses       1327     1336       +9     

see 14 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@lloeki lloeki left a comment

Choose a reason for hiding this comment

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

LGTM, save for a bit about naming that would bring confusion to future readers.

lib/datadog/appsec/event.rb Outdated Show resolved Hide resolved
lib/datadog/appsec/event.rb Outdated Show resolved Hide resolved
lib/datadog/appsec/event.rb Outdated Show resolved Hide resolved
@GustavoCaso GustavoCaso merged commit 62a7a8d into master Jun 6, 2023
@GustavoCaso GustavoCaso deleted the appsec-add-appsec.blocked-tag branch June 6, 2023 14:58
@github-actions github-actions bot added this to the 1.13.0 milestone Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appsec Application Security monitoring product integrations Involves tracing integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants