
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@daiyam/jsonc-preprocessor
Advanced tools
Disable/enable/ignore blocks based on rules found in the JSONC text
Disable/enable/ignore blocks based on rules found in the JSONC text
With node previously installed:
npm install @daiyam/jsonc-preprocessor
import {transform} from '@daiyam/jsonc-preprocessor';
const TYPES = {
version: 'version',
};
function preprocessJSON(text: string, {host: string, os: string, editor: string, version: string}): string {
const args = {
host,
os,
editor,
version,
};
return transform(text, TYPES, args);
}
enable
{
// #enable(os="linux")
// "key": "foobar"
}
If os
is equal to linux
, the block "key": "foobar"
will be uncommented. If not, the block will be commented.
if/else
{
// #if(os="mac")
// "key": "foo"
// #elif(os="windows", host="host1"|"host2")
// "key": "bar"
// #elif(version>="2.18.1")
// "key": "qux"
// #else
// "key": "baz"
// #endif
}
#elif(os="windows", host="host1"|"host2")
is true
when os
equals windows
and host
equals host1
or host2
.
#elif(os="windows", version>="2.18.1")
is true
when version
is greater than or equal to 2.18.1
.
ignore
{
// #ignore
"key": "foobar"
}
The block "key": "foobar"
will always be removed.
rewrite-enable
/rewrite-disable
{
// #rewrite-enable
// #if(os="mac"|"windows")
// "key": "#{os}"
// #else
// "key": "linux"
// #endif
// #rewrite-disable
// #if(os="mac"|"windows")
// "key2": "#{os}"
// #else
// "key2": "linux"
// #endif
}
key
will have the following values: max
, windows
or linux
.
key2
will have the following values: #{os}
or linux
.
rewrite-next-line
{
// #rewrite-next-line
// "key": "#{os}"
}
condition = expression ("," expression)*
expression = (unary-operator identifier) | (identifier operator values)
identifier = \w+
operator = "=" | "!=" | "<" | "<=" | ">" | ">="
unary-operator = "?" | "!?"
values = value ("|" value)*
value
is a double quote string.
The operators <
, <=
, >
, >=
are only working for the identifier version
.
Support this project by becoming a financial contributor.
![]() | ko-fi.com/daiyam |
![]() | liberapay.com/daiyam/donate |
![]() | paypal.me/daiyam99 |
Copyright © 2021-present Baptiste Augrain
Licensed under the MIT license.
FAQs
Disable/enable/ignore blocks based on rules found in the JSONC text
We found that @daiyam/jsonc-preprocessor 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.