
Security News
Critical Security Vulnerability in React Server Components
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.
simple_contracts
Advanced tools
This project contains the most simple implementation of Contract written in Ruby (and maybe later in other languages).
The Contract is inspired by Design by Contracts approach and pushes Fail Fast techinque further.
So, Contract is a class with the only public method , that validates some action/behavior agains Contract Rules:
Contract validates, that:
Otherwise, Contract raises an exception with details, at least on what step behavior was broken.
Add this line to your application's Gemfile:
gem 'simple_contracts'
And then execute:
$ bundle
Or install it yourself as:
$ gem install simple_contracts
class TwitterContract < SimpleContracts::Base
def initialize(post)
super
@post = post
end
private
def guarantee_verified_delete
return true if Twitter::REST::Client.statuses(@post.tweet_id).empty?
false
end
def expect_some_action1
...
end
def expect_some_action2
...
end
# ... other rules
end
@post = Post.find(params.require(:post_id))
# Use synchronously, (raises exception, "Fails Fast"™):
TwitterContract.(@post, async: false) { TwitterAPI.destroy(@post) }
# Use asynchronously (does not affect TwitterAPI.destroy,
# but tracks any problems with TwitterContract validation)
TwitterContract.(@post) { TwitterAPI.destroy(@post) }
Bug reports and pull requests are welcome on GitHub at https://github.com/bibendi/simple_contracts.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that simple_contracts 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.

Security News
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.

Research
/Security News
We spotted a wave of auto-generated “elf-*” npm packages published every two minutes from new accounts, with simple malware variants and early takedowns underway.

Security News
TypeScript 6.0 will be the last JavaScript-based major release, as the project shifts to the TypeScript 7 native toolchain with major build speedups.