
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
graphql-ruby
integration
GraphQL Hive provides all the tools to get visibility of your GraphQL architecture at all stages, from standalone APIs to composed schemas (Federation, Stitching):
If you are using Hive as a service, please refer to our documentation: https://docs.graphql-hive.com/features/tokens.
graphql-hive
gemgem install graphql-hive
GraphQL::Hive
in your SchemaAdd GraphQL::Hive
at the end of your schema definition:
class Schema < GraphQL::Schema
query QueryType
use(
GraphQL::Hive,
{
token: '<YOUR_TOKEN>',
reporting: {
author: ENV['GITHUB_USER'],
commit: ENV['GITHUB_COMMIT']
},
}
)
end
The reporting
configuration is required to push your GraphQL Schema to the Hive registry.
Doing so will help better detect breaking changes and more upcoming features.
If you only want to use the operations monitoring, replace the reporting
option with the following report_schema: false
.
Calling these hooks are situational - it's likely that you may not need to call them at all!
on_start
Call this hook if you are running GraphQL::Hive
in a process that fork
s
itself.
example: puma
web server running in ("clustered
mode")
# config/puma.rb
preload_app!
on_worker_boot do
GraphQL::Hive.instance.on_start
end
on_exit
If your GraphQL API process is shut down non-gracefully but has a shutdown hook
to call into, call on_worker_exit
.
puma
example:
# config/puma.rb
on_worker_shutdown do
GraphQL::Hive.instance.on_exit
end
You are all set! 🚀
When deploying or starting up your GraphQL API, graphql-hive
will immediately:
You should now see operations information (RPM, error rate, queries performed) on your GraphQL Hive dashboard:
Stay on top of your GraphQL Schema changes by installing the Hive Github Application and enabling Slack notifications about breaking changes:
https://docs.graphql-hive.com/features/integrations#github
You will find below the complete list of options of GraphQL::Hive
:
class MySchema < GraphQL::Schema
use(
GraphQL::Hive,
{
# Token is the only required configuration value.
token: 'YOUR-REGISTRY-TOKEN',
#
# The following are optional configuration values.
#
# Enable/disable Hive Client.
enabled: true,
# Verbose logs.
debug: false,
# A custom logger.
logger: MyLogger.new,
# Endpoint and port of the Hive API. Change this if you are using a self-hosted Hive instance.
endpoint: 'app.graphql-hive.com',
port: 80,
# Number of operations sent to Hive in a batch (AFTER sampling).
buffer_size: 50,
# Size of the queue used to send operations to the buffer before sampling.
queue_size: 1000,
# Report usage to Hive.
collect_usage: true,
# Usage sampling configurations.
collect_usage_sampling: {
# % of operations recorded.
sample_rate: 0.5,
# Custom sampler to assign custom sampling rates.
sampler: proc { |context| context.operation_name.includes?('someQuery') 1 : 0.5 },
# Sample every distinct operation at least once.
at_least_once: true,
# Assign custom keys to distinguish between distinct operations.
key_generator: proc { |context| context.operation_name }
},
# Publish schema to Hive.
report_schema: true,
# Mandatory if `report_schema: true`.
reporting: {
# Mandatory members of `reporting`.
author: 'Author of the latest change',
commit: 'git sha or any identifier',
# Optional members of `reporting`.
service_name: '',
service_url: '',
},
# Pass an optional proc to client_info to help identify the client (ex: Apollo web app) that performed the query.
client_info: proc { |context|
{ name: context.client_name, version: context.client_version }
}
}
)
# ...
end
See default options for the optional parameters here.
[!Important]
buffer_size
andqueue_size
will affect memory consumption.
buffer_size
is the number of operations sent to Hive in a batch after operations have been sampled.queue_size
is the size of the queue used to send operations to the buffer before sampling. Adjust these values according to your application's memory constraints and throughput. High throughput applications will need a largerqueue_size
.
FAQs
Unknown package
We found that graphql-hive demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.