neolabs-go

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0

README

neolabs-go

Shared Go foundation of the NeoLabs apps (NeoAgent, NeoRouter, NeoCloud, NeoRecall). One implementation of each protection and building block, used by every app, so the four share the same behaviour and the same security baseline.

Package What it gives you
secretbox AES-256-GCM sealed secrets at rest (enc:v1: layout)
sessionx HMAC-signed cookie sessions on a SQLite store, express-session compatible
passhash bcrypt hashes, random tokens, SHA-256 token digests, constant-time compare
secheaders baseline security headers and an ordered CSP builder
httpx JSON helpers, middleware chain, CORS, origin guard, API case guard, panic recovery
ratelimit fixed-window limiter with RateLimit-* headers
ssrf outbound HTTP client that only reaches public addresses
runtimecfg data directories (0700), private files (0600), .env loading
dbx SQLite (pure Go, FTS5), writer/reader pools, user_version migrations
testkit test helpers that never touch a real data directory

Compatibility with the existing Node servers is tested with vectors generated from the Node implementations (sealed values, cookie signatures, bcrypt hashes, helmet and rate-limit captures).

go vet ./... && go test -race ./...

Licensed under AGPL-3.0, like the apps that use it.

Directories

Path Synopsis
Package dbx opens the SQLite database every NeoLabs app uses and applies schema migrations.
Package dbx opens the SQLite database every NeoLabs app uses and applies schema migrations.
Package httpx is the shared HTTP toolkit of the NeoLabs apps: JSON helpers, middleware composition and the browser-origin protections (CORS, CSRF-style origin guard) that every app's `/api` surface relies on.
Package httpx is the shared HTTP toolkit of the NeoLabs apps: JSON helpers, middleware composition and the browser-origin protections (CORS, CSRF-style origin guard) that every app's `/api` surface relies on.
Package passhash holds the credential primitives every NeoLabs app shares: bcrypt password hashes (compatible with existing `$2b$` hashes), random tokens, SHA-256 token digests and constant-time comparison.
Package passhash holds the credential primitives every NeoLabs app shares: bcrypt password hashes (compatible with existing `$2b$` hashes), random tokens, SHA-256 token digests and constant-time comparison.
Package ratelimit is a fixed-window, per-client request limiter that answers exactly like express-rate-limit with `standardHeaders: true` (draft-6): RateLimit-Policy / RateLimit-Limit / RateLimit-Remaining / RateLimit-Reset, and on rejection a 429 JSON body plus Retry-After.
Package ratelimit is a fixed-window, per-client request limiter that answers exactly like express-rate-limit with `standardHeaders: true` (draft-6): RateLimit-Policy / RateLimit-Limit / RateLimit-Remaining / RateLimit-Reset, and on rejection a 429 JSON body plus Retry-After.
Package runtimecfg resolves where a NeoLabs app keeps its data and reads its environment.
Package runtimecfg resolves where a NeoLabs app keeps its data and reads its environment.
Package secheaders sets the baseline browser-hardening response headers every NeoLabs app ships (the helmet defaults the Node servers used), plus an ordered Content-Security-Policy builder so each app declares its own policy.
Package secheaders sets the baseline browser-hardening response headers every NeoLabs app ships (the helmet defaults the Node servers used), plus an ordered Content-Security-Policy builder so each app declares its own policy.
Package secretbox seals short secrets (API keys, tokens) at rest with AES-256-GCM.
Package secretbox seals short secrets (API keys, tokens) at rest with AES-256-GCM.
Package sessionx implements server-side cookie sessions that are wire- and storage-compatible with express-session + better-sqlite3-session-store, so users stay signed in across the Node → Go switch, and the other NeoLabs apps share one hardened session implementation.
Package sessionx implements server-side cookie sessions that are wire- and storage-compatible with express-session + better-sqlite3-session-store, so users stay signed in across the Node → Go switch, and the other NeoLabs apps share one hardened session implementation.
Package ssrf gives outbound HTTP clients protection against server-side request forgery: every destination IP is checked after DNS resolution and the checked address is the one that gets dialled, so DNS rebinding cannot swap in an internal address.
Package ssrf gives outbound HTTP clients protection against server-side request forgery: every destination IP is checked after DNS resolution and the checked address is the one that gets dialled, so DNS rebinding cannot swap in an internal address.
Package testkit holds helpers for tests across the NeoLabs apps.
Package testkit holds helpers for tests across the NeoLabs apps.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL