feat: npm full proxy — URL rewriting, scoped packages, publish, integrity cache (v0.2.31)

npm proxy:
- Rewrite tarball URLs in metadata to point to NORA (was broken — tarballs bypassed NORA)
- Scoped packages (@scope/package) full support in handler and repo index
- Metadata cache TTL (NORA_NPM_METADATA_TTL, default 300s) with stale-while-revalidate
- proxy_auth now wired into fetch_from_proxy (was configured but unused)

npm publish:
- PUT /npm/{package} — accepts standard npm publish payload
- Version immutability — 409 Conflict on duplicate version
- Tarball URL rewriting in published metadata

Security:
- SHA256 integrity verification on cached tarballs (immutable cache)
- Attachment filename validation (path traversal protection)
- Package name mismatch detection (URL vs payload)

Config:
- npm.metadata_ttl — configurable cache TTL (env: NORA_NPM_METADATA_TTL)
This commit is contained in:
2026-03-16 12:32:16 +00:00
parent d41b55fa3a
commit b3b74b8b2d
5 changed files with 516 additions and 71 deletions

6
Cargo.lock generated
View File

@@ -1247,7 +1247,7 @@ checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21"
[[package]]
name = "nora-cli"
version = "0.2.30"
version = "0.2.31"
dependencies = [
"clap",
"flate2",
@@ -1261,7 +1261,7 @@ dependencies = [
[[package]]
name = "nora-registry"
version = "0.2.30"
version = "0.2.31"
dependencies = [
"async-trait",
"axum",
@@ -1299,7 +1299,7 @@ dependencies = [
[[package]]
name = "nora-storage"
version = "0.2.30"
version = "0.2.31"
dependencies = [
"axum",
"base64",