Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Ruby gem for GraphQL arguments sharing within fields
Sometimes you want to use the same arguments for multiple fields in custom object type. To avoid repeating those declarations and DRY-up your schema, I introduce you shared_arguments field.
This gem is mostly usable when you have:
gem install shared-arguments
Include SharedArguments in your schema
#graphql/your_schema.rb
YourSchema = GraphQL::Schema.define do
use GraphQL::SharedArguments.new
end
#graphql/types/analytics_type.rb
Types::AnalyticsType = GraphQL::ObjectType.define do
name 'Analytics'
field :invoices, types.[Types::Invoice] do
argument :from, !Types::DateType
argument :to, !Types::DateType
argument :companyID, types.ID
end
field :registeredUsers, types.[Types::User] do
argument :from, !Types::DateType
argument :to, !Types::DateType
argument :companyID, types.ID
end
field :downloadsAmount, types.Int do
argument :from, !Types::DateType
argument :to, !Types::DateType
argument :userAmount, types.ID
end
end
This can be shortened like in below example
#graphql/types/analytics_type.rb
Types::AnalyticsType = GraphQL::ObjectType.define do
name 'Analytics'
field :invoices, types.[Types::Invoice]
field :registeredUsers, types.[Types::User]
field :downloadsAmount, types.Int do
argument :userAmount, types.ID
end
shared_arguments do
argument :from, !Types::DateType
argument :to, !Types::DateType
end
shared_arguments except: %i(downloadsAmount) do
argument :companyID, types.ID
end
end
shared_arguments
field takes both except
and only
keyword with array of symbols so you can omit or select specified fields.
Any contributions/suggestions/opened issues are welcomed.
License: MIT
FAQs
Unknown package
We found that shared-arguments demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.