You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1413d21
Browse filesBrowse the repository at this point in the historyBrowse files
feat(coana): download the Coana CLI through SOCKET_COANA_MIRROR_URL (#1825)
* feat(coana): download the Coana CLI through SOCKET_COANA_MIRROR_URL
Machines that can't reach storage.googleapis.com can mirror Coana's bucket,
for example with an Artifactory remote repository, and set
SOCKET_COANA_MIRROR_URL to it. Each signed URL for the cli component then
has its https://storage.googleapis.com/socket-coana-cli/ prefix replaced
with the mirror's URL, keeping the signature, including the URL requested
anew after a 4xx. Coana, which inherits the variable, follows the same rule
for its own components.
A signed URL outside the bucket is refused rather than fetched from GCS. A
mirror URL that isn't https, or that has a query or fragment, is refused
before the API is asked, without echoing the value. socket-cli downloads
over https only, so unlike Coana it doesn't accept an http mirror.
* refactor(coana): simplify the mirror URL rewrite
Parse the signed URL once into a URL, and have the mirror rule throw its
errors so that the existing catch reports them as failures to get the
Coana CLI. installComponent takes the request function instead of the
org slug and mirror rule. The tests share one tarball fixture and API
response.
* docs(coana): tighten the mirror rewrite comments
* docs: drop the Coana mirror paragraph from the README
* fix(coana): check the mirror only when a download is certain
Parse SOCKET_COANA_MIRROR_URL and rewrite the signed URL only after the
resolved version missed the cache, so a stale value or a URL outside the
bucket no longer breaks a run that needs no download. An invalid value
is an InputError.
Downloads get a 60 s inactivity timeout, so a stalled mirror can't hang
the run, and a failed download names the host it went to.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
7
7
## [Unreleased]
8
8
9
9
### Added
10
+
- Download the Coana CLI on networks that can't reach `storage.googleapis.com`: set `SOCKET_COANA_MIRROR_URL` to an https mirror of Socket's download bucket, such as an Artifactory remote repository.
10
11
- Catch reachability analyses that stop early: with `--reach-incomplete-analysis-as-error`, `socket scan create --reach` and `socket scan reach` report a vulnerability whose analysis hit the timeout or memory limit before finding a reachable path as an analysis error instead of unreachable.
11
12
- Scan many repositories with `--dynamic-sbom-inference` without a `socket.json` in each: `--dynamic-sbom-inference-ignore-unresolved` tolerates unresolved dependencies in every build. A build that cannot be loaded, for example over a missing imported Maven BOM, still fails.
'refuses %s, outside the bucket, without showing its signature',
461
+
asyncurl=>{
462
+
const{ downloads, result }=awaitrunFromMirror({signedUrls: [url]})
463
+
464
+
expect(result).toEqual({
465
+
ok: false,
466
+
message: `Failed to get the Coana CLI ${VERSION}`,
467
+
cause:
468
+
'Socket provided the Coana CLI at https://storage.googleapis.com/another-bucket/objects/SHA.tar.gz, outside https://storage.googleapis.com/socket-coana-cli/, which SOCKET_COANA_MIRROR_URL mirrors.',
469
+
})
470
+
expect(downloads).toEqual([])
471
+
},
472
+
)
473
+
474
+
it.for([
475
+
'not a URL',
476
+
'http://mirror.test/',
477
+
'ftp://mirror.test/',
478
+
'https://mirror.test/?token=secret',
479
+
'https://mirror.test/#secret',
480
+
'https://mirror.test/?',
481
+
'https://mirror.test/#',
482
+
])('refuses %s without showing it',asyncmirrorUrl=>{
483
+
const{ downloads, result }=awaitrunFromMirror({
484
+
mirrorUrl,
485
+
signedUrls: [signedUrl('first')],
486
+
})
487
+
488
+
expect(result).toEqual({
489
+
ok: false,
490
+
message: `Failed to get the Coana CLI ${VERSION}`,
491
+
cause:
492
+
'SOCKET_COANA_MIRROR_URL must be an https URL without a query or fragment.',
493
+
})
494
+
expect(downloads).toEqual([])
495
+
})
496
+
})
497
+
318
498
it('surfaces captured stdout when stderr is empty (Coana logs some failures to stdout)',async()=>{
0 commit comments