Skip to content

Commit

Permalink
Merge pull request #3769 from DataDog/vpellan/graphql-threat-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
vpellan committed Jul 24, 2024
2 parents 2cdc371 + 9295cad commit 26a5abf
Show file tree
Hide file tree
Showing 134 changed files with 9,343 additions and 648 deletions.
8 changes: 8 additions & 0 deletions Matrixfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
'activesupport' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby'
},
'graphql' => {
'graphql-2.3' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.2' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.1' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.0' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
Expand Down Expand Up @@ -258,6 +259,13 @@
'rails5-mysql2' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ❌ 3.4 / ❌ jruby',
'rails6-mysql2' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ❌ 3.4 / ❌ jruby',
'rails61-mysql2' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ❌ jruby'
},
'appsec:graphql' => {
'graphql-2.3' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.2' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.1' => '❌ 2.5 / ❌ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-2.0' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'graphql-1.13' => '❌ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
}
}.freeze
# rubocop:enable Layout/HashAlignment
Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ namespace :spec do
end

namespace :appsec do
task all: [:main, :rack, :rails, :sinatra, :devise]
task all: [:main, :rack, :rails, :sinatra, :devise, :graphql]

# Datadog AppSec main specs
desc '' # "Explicitly hiding from `rake -T`"
Expand All @@ -264,6 +264,7 @@ namespace :spec do
:sinatra,
:rails,
:devise,
:graphql,
].each do |contrib|
desc '' # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(contrib) do |t, args|
Expand Down
3 changes: 3 additions & 0 deletions appraisal/jruby-9.2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@
'2.0',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
3 changes: 3 additions & 0 deletions appraisal/jruby-9.3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
4 changes: 4 additions & 0 deletions appraisal/jruby-9.4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,17 @@
end

[
'2.3',
'2.2',
'2.1',
'2.0',
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
3 changes: 3 additions & 0 deletions appraisal/ruby-2.5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,10 @@
'2.0',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
3 changes: 3 additions & 0 deletions appraisal/ruby-2.6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
4 changes: 4 additions & 0 deletions appraisal/ruby-2.7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,17 @@
end

[
'2.3',
'2.2',
'2.1',
'2.0',
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
4 changes: 4 additions & 0 deletions appraisal/ruby-3.0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,17 @@
end

[
'2.3',
'2.2',
'2.1',
'2.0',
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
4 changes: 4 additions & 0 deletions appraisal/ruby-3.1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,17 @@
end

[
'2.3',
'2.2',
'2.1',
'2.0',
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
4 changes: 4 additions & 0 deletions appraisal/ruby-3.2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,17 @@
end

[
'2.3',
'2.2',
'2.1',
'2.0',
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
15 changes: 4 additions & 11 deletions appraisal/ruby-3.3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,17 @@
end

[
'2.3',
'2.2',
'2.1',
'2.0',
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
end
end

[
'2.2',
'2.1',
'2.0',
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
end
end

Expand Down
16 changes: 5 additions & 11 deletions appraisal/ruby-3.4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,18 @@
end

[
'2.3',
'2.2',
'2.1',
'2.0',
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'rails', '~> 6.1.0'
gem 'graphql', "~> #{v}.0"
end
end

[
'2.2',
'2.1',
'2.0',
'1.13',
].each do |v|
appraise "graphql-#{v}" do
gem 'graphql', "~> #{v}.0"
gem 'sprockets', '< 4'
gem 'lograge', '~> 0.11'
gem 'mutex_m', '>= 0.1.0'
end
end

Expand Down
14 changes: 7 additions & 7 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -855,13 +855,13 @@ YourSchema.execute(query, variables: {}, context: {}, operation_name: nil)

The `instrument :graphql` method accepts the following parameters. Additional options can be substituted in for `options`:

| Key | Env Var | Type | Description | Default |
| ------------------------ | - | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------- |
| `enabled` | `DD_TRACE_GRAPHQL_ENABLED` | `Bool` | Whether the integration should create spans. | `true` |
| `schemas` | | `Array` | Array of `GraphQL::Schema` objects (that support class-based schema only) to trace. If you do not provide any, then tracing will applied to all the schemas. | `[]` |
| `with_unified_tracer` | | `Bool` | Enable to instrument with `UnifiedTrace` tracer, enabling support for API Catalog. `with_deprecated_tracer` has priority over this. Default is `false`, using `GraphQL::Tracing::DataDogTrace` (Added in v2.2) | `false` |
| `with_deprecated_tracer` | | `Bool` | Enable to instrument with deprecated `GraphQL::Tracing::DataDogTracing`. Default is `false`, using `GraphQL::Tracing::DataDogTrace` | `false` |
| `service_name` | | `String` | Service name used for graphql instrumentation | `'ruby-graphql'` |
| Key | Env Var | Type | Description | Default |
| ------------------------ | -------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| `enabled` | `DD_TRACE_GRAPHQL_ENABLED` | `Bool` | Whether the integration should create spans. | `true` |
| `schemas` | | `Array` | Array of `GraphQL::Schema` objects (that support class-based schema only) to trace. If you do not provide any, then tracing will applied to all the schemas. | `[]` |
| `with_unified_tracer` | | `Bool` | Enable to instrument with `UnifiedTrace` tracer, enabling support for API Catalog. `with_deprecated_tracer` has priority over this. Default is `false`, using `GraphQL::Tracing::DataDogTrace` (Added in v2.2) | `false` |
| `with_deprecated_tracer` | | `Bool` | Enable to instrument with deprecated `GraphQL::Tracing::DataDogTracing`. This has priority over `with_unified_tracer`. Default is `false`, using `GraphQL::Tracing::DataDogTrace` | `false` |
| `service_name` | | `String` | Service name used for graphql instrumentation | `'ruby-graphql'` |

**Manually configuring GraphQL schemas**

Expand Down
3 changes: 3 additions & 0 deletions gemfiles/jruby_9.2_graphql_2.0.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 26a5abf

Please sign in to comment.