Repository navigation
Download the Coana CLI through SOCKET_COANA_MIRROR_URL - #486
Conversation
When SOCKET_COANA_MIRROR_URL is set, the signed URL's prefix https://storage.googleapis.com/socket-coana-cli/ is replaced with the mirror's URL, keeping the query that holds the signature. The value is read only after a cache miss. Signed URLs outside the bucket and invalid values are refused without showing the signature or the value, and download errors name the host without credentials. Port of SocketDev/socket-cli#1825. Unlike the Node CLI, http mirrors are accepted, as in Coana.
PR SummaryMedium Risk Overview In Unit tests cover URL rewriting, retry after 4xx, validation edge cases, and cached-version behavior. Reviewed by Cursor Bugbot for commit 08d2f8e. Configure here. |
Jeppe Fredsgaard Blaabjerg (jfblaa)
left a comment
There was a problem hiding this comment.
🎉
eb4ae61
into
main
socket-python-cli's side of mirror support for Coana's downloads, following socket-cli's SocketDev/socket-cli#1825.
Machines that can't reach
storage.googleapis.comcan mirror Coana's bucket, for example with an Artifactory generic remote repository with "Propagate Query Params" turned on, and setSOCKET_COANA_MIRROR_URLto it. The CLI then downloads theclicomponent from the mirror:https://storage.googleapis.com/socket-coana-cli/of the signed URL is replaced with the mirror's URL, with a/appended when it lacks one. The query string, which holds the signature, is kept..or..segment, percent-encoded or not. The error leaves out the signature.raise_for_statusis no longer used, since its message shows the whole URL.Unlike socket-cli, http mirrors are accepted, as in Coana:
requestsspeaks both.The pinned Coana 15.15.12 already honours the inherited variable for its
analyzersandfactsdownloads. The variable isn't documented indocs/yet, since the feature isn't GA.Known gap, unchanged by this PR: a connection, TLS or proxy error from
requestsstill shows the request path and signature (not credentials) in its message.Why?
Customers whose CI runners can't reach
storage.googleapis.comcan't download Coana since the CLI started downloading it from GCS.Tests
New cases in
tests/unit/test_reachability.pymock the Socket API and the download, and use an empty cache per test with the real cache script:/and with credentials;Public Changelog
SOCKET_COANA_MIRROR_URLto download the reachability engine through a mirror ofstorage.googleapis.com/socket-coana-cli.Expected reviewer effort: High-level design decisions