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.
GraphQL bindings for Graphiti.
Write code like this:
class EmployeeResource < ApplicationResource
attribute :first_name, :string
attribute :age, :integer
has_many :positions
end
Get an API like this:
query {
employees(
filter: { firstName: { match: "arha" } },
sort: [{ att: age, dir: desc }],
first: 10,
after: "abc123"
) {
edges {
node {
id
firstName
age
positions {
nodes {
title
}
}
}
cursor
}
stats {
total {
count
}
}
}
}
# Gemfile
gem 'graphiti'
gem "graphiti-rails"
gem 'graphiti_gql'
# config/routes.rb
Rails.application.routes.draw do
scope path: ApplicationResource.endpoint_namespace do
mount GraphitiGql::Engine, at: "/gql"
end
end
Write your Graphiti code as normal, omit controllers.
This autogenerates graphql-ruby
code by introspecting Graphiti Resources. Something like this happens under-the-hood:
field :employees, [EmployeeType], null: false do
argument :filter, EmployeeFilter, required: false
# ... etc ...
end
def employees(**arguments)
EmployeeResource.all(**arguments).to_a
end
In practice it's more complicated, but this is the basic premise - use Graphiti resources to handle query and persistence operations; autogenerate graphql-ruby
code to expose those Resources as an API. This means we play nicely with e.g. telemetry and error-handling libraries because it's all graphql-ruby
under-the-hood...except for actually performing the operations, which is really more a Ruby thing than a GraphQL thing.
This rethinks the responsibilities of Graphiti, coupling the execution cycle to graphql-ruby
. We do this so we can play nicely with other gems in the GQL ecosystem, and saves on development time by offloading responsibilities. The downside is we can no longer run a JSON:API
with the same codebase, and certain documentation may be out of date.
Longer-term, we should rip out only the parts of Graphiti we really need and redocument.
FAQs
Unknown package
We found that graphiti_gql 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.