Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/CosmicToast/libuconf
= libuconf: your one stop configuration shop
Libuconf is a small go library to handle all sorts of configuration tasks. It consists of three primary components:
If this sounds confusing, don't worry! As a user you don't need to worry about any of this. If you're interested in the internals, head over to the "READING" file for a guided source-reading experience.
var s1, s2, s3 *string s1 = optionset.String("myflag", 0, "initial value", "myflag help string") <1> optionset.StringVar(s2, "otherflag", 'o', "different value", "otherflag help string") <2>
<1> The 0 here is the null byte - if you set the short option to that, it's considered disabled.
<2> In this example, you can configure s2 with command line flags using --otherflag
or -o
.
<3> You can also create the underlying "Option" types.
<4> If you do that, however, you must register them with your OptionSet separately!
<1> If an option is set in both app.toml and .apprc, .apprc will take precedence because it was parsed afterwards. <2> With the default option types, as in this example, s1 will be configured by the MYAPP_MYFLAG environment variable. <3> All the Parse* functions actually return error - please check them! <4> Parse() will parse all of the standard files for your OS, followed by the environment, and finally the cli.
That's it, you're done, all your options should be set now.
== Advanced Usage
Every parsing method ("Env", "Flags", "Toml") is associated with an interface: EnvOpt
, FlagOpt
and TomlOpt
respectively.
All of these include the Setter
interface, which defines the Set(interface{}) error
function.
ParseEnv()
will look for environment variables that start with the capitalized contents of the OptionSet's application name, followed by an underscore and the output of Env()
of each flag.
ParseToml*
will run the flag's Toml()
output as a query against each TOML tree.
Finally, ParseFlags()
will look for long flags Flag()
and short flags ShortFlag()
.
Bool()
is needed for implicitly setting boolean flags on.
Usage()
consumes AppName
, Help()
, Get()
and the two Flag*
functions to generate a usage string - this means it shows you the "current" value in the help string, rather than the default you set.
If you want to add additional configuration sources (such as consul, for example), you would simply define a new interface that includes Setter
and any functions you need.
Then you would add a new Parse*
function to OptionSet
that includes a type assertion (or uses a new Visit* function).
FAQs
Unknown package
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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.