Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Changed
- The Coana CLI is now downloaded from Socket's servers instead of npm, and is now cached in `$XDG_CACHE_HOME/socket/coana` (`~/.cache/socket/coana` by default).
- Updated the Coana CLI to v `15.12.10`.

### Removed
- The `SOCKET_CLI_COANA_LAUNCHER` environment variable no longer has an effect.
Expand Down
2 changes: 1 addition & 1 deletion src/constants.mts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const ALERT_TYPE_MILD_CVE = 'mildCVE'
const API_V0_URL = 'https://api.socket.dev/v0/'
// The Coana CLI version Socket CLI runs by default. Coana's release workflow
// rewrites this line in its bump PRs.
const COANA_CLI_VERSION = '15.12.9'
const COANA_CLI_VERSION = '15.12.10'
const CONFIG_KEY_API_BASE_URL = 'apiBaseUrl'
const CONFIG_KEY_API_PROXY = 'apiProxy'
const CONFIG_KEY_API_TOKEN = 'apiToken'
Expand Down
9 changes: 7 additions & 2 deletions src/vendor/coana-cache.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,19 @@ function indexFile(version, component) {
return join2(cacheRoot(), "versions", versionSegment(version), component);
}
async function lookup(version, component) {
const sha256 = (await readFile(indexFile(version, component), "utf8").catch(() => "")).trim();
const index = indexFile(version, component);
const sha256 = (await readFile(index, "utf8").catch(() => "")).trim();
if (!SHA256.test(sha256)) return void 0;
const dir = objectDir(sha256);
const isDirectory = await stat(dir).then(
(s) => s.isDirectory(),
() => false
);
return isDirectory ? dir : void 0;
if (!isDirectory) return void 0;
const now = /* @__PURE__ */ new Date();
await utimes(index, now, now).catch(() => writeFileAtomically(index, sha256)).catch(() => {
});
return dir;
}
async function install(version, component, sha256, populate) {
if (!SHA256.test(sha256)) throw new InvalidCacheKey(`Invalid SHA-256: ${sha256}`);
Expand Down
Loading