Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/axiomhq/axiom-go
Axiom unlocks observability at any scale.
For more information check out the official documentation and our community Discord.
Install using go get
:
go get github.com/axiomhq/axiom-go/axiom
Import the package:
import "github.com/axiomhq/axiom-go/axiom"
If you use the Axiom CLI, run
eval $(axiom config export -f)
to configure your environment variables.
Otherwise create a personal token in the Axiom settings
and export it as AXIOM_TOKEN
. Set AXIOM_ORG_ID
to the organization ID from
the settings page of the organization you want to access.
[!NOTE] The organization ID is the slug below your organizations full name in the Axiom settings which resembles the full name. It has a copy button next to it. Alternatively you can just extract it from your browsers address bar when browsing the Axiom App:
https://app.dev.axiomtestlabs.co/<your-org-id>/datasets
.
You can also configure the client using options
passed to the axiom.NewClient
function:
client, err := axiom.NewClient(
axiom.SetPersonalTokenConfig("AXIOM_TOKEN", "AXIOM_ORG_ID"),
)
[!NOTE] When only performing ingest or query operations, we recommend using an API token with minimal privileges, only! Create an API token with the appropriate scopes in the Axiom API tokens settings and export it as
AXIOM_TOKEN
.
Create and use a client like this:
package main
import (
"context"
"fmt"
"log"
"github.com/axiomhq/axiom-go/axiom"
"github.com/axiomhq/axiom-go/axiom/ingest"
)
func main() {
ctx := context.Background()
client, err := axiom.NewClient()
if err != nil {
log.Fatal(err)
}
if _, err = client.IngestEvents(ctx, "my-dataset", []axiom.Event{
{ingest.TimestampField: time.Now(), "foo": "bar"},
{ingest.TimestampField: time.Now(), "bar": "foo"},
}); err != nil {
log.Fatal(err)
}
res, err := client.Query(ctx, "['my-dataset'] | where foo == 'bar' | limit 100")
if err != nil {
log.Fatal(err)
} else if res.Status.RowsMatched == 0 {
log.Fatal("No matches found")
}
rows := res.Tables[0].Rows()
if err := rows.Range(ctx, func(_ context.Context, row query.Row) error {
_, err := fmt.Println(row)
return err
}); err != nil {
log.Fatal(err)
}
}
For further examples, head over to the examples directory.
If you want to use a logging package, check if there is already an adapter in the adapters directory. We happily accept contributions for new adapters.
Distributed under the MIT License.
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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.