
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
The abort_if
procedural macro guarantees that a specific function panics if a condition is met.
Put this in your Cargo.toml
file:
[dependencies]
abort-if = "0.1.2"
You can assure that a function won't be used if feature x
is enabled
use abort_if::abort_if;
#[abort_if(feature = x)]
fn foo() {
using_that_feature();
}
fn main() {
foo();
}
This code will panic if that feature is enabled.
The default is panicking using compiler_error!
. This will output the following information:
error: Condition was met.
--> src/main.rs:5:1
|
5 | #[abort_if(feature = "x")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `abort_if` (in Nightly builds, run with -Z macro-backtrace for more info)
You can use the feature custom_abort
to write a custom abort macro. When using this feature, make sure to have a custom_abort_error!
macro with an expr
as the argument.
If you use the custom_abort
feature, you can also use the keep_going
one. This feature functions that, if your custom_abort_error
macro works as a warning instead of a hard error, the code will keep going.
FAQs
Unknown package
We found that abort-if 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
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.