
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Add this line to your application's Gemfile:
gem 'json-schema_builder'
And then execute:
$ bundle
Or install it yourself as:
$ gem install json-schema_builder
require 'json/schema_builder'
class YourSchema
include JSON::SchemaBuilder
def schema
object do
string :name, min_length: 1, required: true
array :your_ids do
max_items 10
unique_items true
items type: :integer
end
end
end
end
builder = YourSchema.new
builder.schema.as_json
will return a valid JSON schema:
{
"type": "object",
"required": "name",
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"your_ids": {
"type": "array",
"maxItems": 10,
"uniqueItems": true,
"items": { "type": "integer" }
}
}
}
More examples can be found in the specs.
builder.schema.validate(data)
will validate your object against the schema:
builder.schema.validate({ }) # => false
builder.schema.validate name: 'Your Name' # => true
builder.schema.validate!(data)
validates your object, raising an exception on failure:
builder.schema.validate!({ })
# JSON::Schema::ValidationError: The property '#/' did not contain a required property of 'name'
builder.schema.validate! name: 'Your Name', your_ids: [1, 1, 2]
# JSON::Schema::ValidationError: The property '#/your_ids' contained duplicated array values
builder.schema.fully_validate(data)
validates the object and reports all invalid properties:
builder.schema.fully_validate your_ids: 'fail'
# [
# "The property '#/your_ids' of type String did not match the following type: array ",
# "The property '#/' did not contain a required property of 'name'"
# ]
Fragment validation can be accomplished by specifying the schema fragment:
builder.schema.validate [1], fragment: '#/properties/your_ids' # => true
json-schema validation options can be specified in several contexts:
# As a global default
JSON::SchemaBuilder.configure do |opts|
opts.validate_schema = true
end
# As a class-level default
YourSchema.configure do |opts|
opts.insert_defaults = true
end
# Or at validation
builder.schema.validate data, strict: true, validate_schema: false
# Results in
{
validate_schema: false,
insert_defaults: true,
strict: true
}
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that json-schema_builder 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.