
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Ruby implementation of GraphQL trace data in the Apollo Tracing format.
Add this line to your application's Gemfile:
gem 'graphql-tracing'
And then execute:
$ bundle
Or install it yourself as:
$ gem install graphql-tracing
Define a GraphQL schema:
# Define a type
PostType = GraphQL::ObjectType.define do
name "Post"
field :id, !types.ID
field :title, !types.String
end
# Define a query
QueryType = GraphQL::ObjectType.define do
name "Query"
field :posts, !types[PostType] do
argument :user_id, !types.ID
resolve ->(obj, args, ctx) { Post.where(user_id: args[:user_id]) }
end
end
# Define a schema
Schema = GraphQL::Schema.define do
query QueryType
end
# Execute query
query = "query($user_id: ID!) {
posts(user_id: $user_id) {
id
title
}
}"
Schema.execute(query, variables: { user_id: 1 })
Add 'GraphQL::Tracing' to your schema:
Schema = GraphQL::Schema.define do query QueryType use GraphQL::Tracing.new end
Now your response should look something like:
{
"data":{
"posts":[
{
"id":"1",
"title":"Post Title"
}
]
},
"extensions":{
"tracing":{
"version":1,
"startTime":"2017-08-25T19:55:04.821Z",
"endTime":"2017-08-25T19:55:04.823Z",
"duration":1702785,
"execution":{
"resolvers":[
{
"path":[
"posts"
],
"parentType":"Query",
"fieldName":"posts",
"returnType":"[Post!]!",
"startOffset":1451015,
"duration":15735
},
{
"path":[
"posts",
0,
"id"
],
"parentType":"Post",
"fieldName":"id",
"returnType":"ID!",
"startOffset":1556873,
"duration":6914
},
{
"path":[
"posts",
0,
"title"
],
"parentType":"Post",
"fieldName":"title",
"returnType":"String!",
"startOffset":1604795,
"duration":4053
},
{
"path":[
"posts",
0,
"user_id"
],
"parentType":"Post",
"fieldName":"user_id",
"returnType":"ID!",
"startOffset":1642942,
"duration":3814
}
]
}
}
}
}
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/graphql-tracing. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that graphql-tracing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.