@@ -5,6 +5,69 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.1.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 5.7.0] ( https://github.com/SocketDev/socket-lib/releases/tag/v5.7.0 ) - 2026-02-12
9+
10+ ### Added
11+
12+ - ** env** : Added ` isInEnv() ` helper function to check if an environment variable key exists, regardless of its value
13+ - Returns ` true ` even for empty strings, ` "false" ` , ` "0" ` , etc.
14+ - Follows same override resolution order as ` getEnvValue() ` (isolated overrides → shared overrides → process.env)
15+ - Useful for detecting presence of environment variables independent of their value
16+
17+ - ** dlx** : Added new exported helper functions
18+ - ` downloadBinaryFile() ` - Downloads a binary file from a URL to the dlx cache directory
19+ - ` ensurePackageInstalled() ` - Ensures an npm package is installed and cached via Arborist
20+ - ` getBinaryCacheMetadataPath() ` - Gets the file path to dlx binary cache metadata (` .dlx-metadata.json ` )
21+ - ` isBinaryCacheValid() ` - Checks if a cached dlx binary is still valid based on TTL and timestamp
22+ - ` makePackageBinsExecutable() ` - Makes npm package binaries executable on Unix systems
23+ - ` parsePackageSpec() ` - Parses npm package spec strings (e.g., ` pkg@1.0.0 ` ) into name and version
24+ - ` resolveBinaryPath() ` - Resolves the absolute path to a binary within an installed package
25+ - ` writeBinaryCacheMetadata() ` - Writes dlx binary cache metadata with integrity, size, and source info
26+
27+ - ** releases** : Added ` createAssetMatcher() ` utility function for GitHub release asset pattern matching
28+ - Creates matcher functions that test strings against glob patterns, prefix/suffix, or RegExp
29+ - Used for dynamic asset discovery in GitHub releases (e.g., matching platform-specific binaries)
30+
31+ ### Changed
32+
33+ - ** env** : Updated ` getCI() ` to use ` isInEnv() ` for more accurate CI detection
34+ - Now returns ` true ` whenever the ` CI ` key exists in the environment, not just when truthy
35+ - Matches standard CI detection behavior where the presence of the key (not its value) indicates a CI environment
36+
37+ ### Fixed
38+
39+ - ** github** : Fixed JSON parsing crash vulnerability by adding try-catch around ` JSON.parse() ` in GitHub API responses
40+ - Prevents crashes on malformed, incomplete, or binary responses
41+ - Error messages now include the response URL for better debugging
42+
43+ - ** dlx/binary** : Fixed clock skew vulnerabilities in cache validation
44+ - Cache entries with future timestamps (clock skew) are now treated as expired
45+ - Metadata writes now use atomic write-then-rename pattern to prevent corruption
46+ - Added TOCTOU race protection by re-checking binary existence after metadata read
47+
48+ - ** dlx/cache cleanup** : Fixed handling of future timestamps during cache cleanup
49+ - Entries with future timestamps (due to clock skew) are now properly treated as expired
50+
51+ - ** dlx/package** : Fixed scoped package parsing bug where ` @scope/package ` was incorrectly parsed
52+ - Changed condition from ` startsWith('@') ` to ` atIndex === 0 ` for more precise detection
53+ - Fixes installation failures for scoped packages like ` @socketregistry/lib `
54+
55+ - ** cache-with-ttl** : Added clock skew detection to TTL cache
56+ - Far-future ` expiresAt ` values (>2x TTL) are now treated as expired
57+ - Protects against cache poisoning from clock skew
58+
59+ - ** packages/specs** : Fixed unconditional ` .git ` truncation in Git URL parsing
60+ - Now only removes ` .git ` suffix when URL actually ends with ` .git `
61+ - Prevents incorrect truncation of URLs containing ` .git ` in the middle
62+
63+ - ** releases/github** : Fixed TOCTOU race condition in binary download verification
64+ - Re-checks binary existence after reading version file
65+ - Ensures binary is re-downloaded if missing despite version file presence
66+
67+ - ** provenance** : Fixed incorrect package name in provenance workflow
68+ - Changed from ` @socketregistry/lib ` to ` @socketsecurity/lib `
69+
70+
871## [ 5.6.0] ( https://github.com/SocketDev/socket-lib/releases/tag/v5.6.0 ) - 2026-02-08
972
1073### Added
@@ -811,7 +874,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
811874
812875### Changed
813876
814- - ** DLX binary metadata structure** : Updated ` writeMetadata ()` to use unified schema with additional fields
877+ - ** DLX binary metadata structure** : Updated ` writeBinaryCacheMetadata ()` to use unified schema with additional fields
815878 - Now includes ` cache_key ` (first 16 chars of SHA-512 hash)
816879 - Added ` size ` field for cached binary size
817880 - Added ` checksum_algorithm ` field (currently "sha256")
0 commit comments