Skip to content

Commit d224454

Browse files
amkalvinnchau
andcommitted
fix: bind marketplace credentials to their origin
Co-authored-by: Kalvin Chau <kalvin@block.xyz> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
1 parent 681d364 commit d224454

3 files changed

Lines changed: 509 additions & 45 deletions

File tree

bb-cli/src/bb/agents_install.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,26 @@ impl Drop for AgentLock {
777777
#[cfg(test)]
778778
mod tests {
779779
use super::*;
780+
use crate::bb::agents_models::AgentInstallArtifact;
781+
use crate::bb::skills_api::MarketplaceClient;
782+
783+
#[test]
784+
fn agent_install_download_rejects_malformed_artifact_url() {
785+
let artifact: AgentInstallArtifact = serde_json::from_value(serde_json::json!({
786+
"id": "artifact",
787+
"download_url": "data:text/plain,secret",
788+
"sha256": "unused",
789+
"size_bytes": 0,
790+
"media_type": "application/zip"
791+
}))
792+
.expect("parse artifact");
793+
let client = MarketplaceClient::unauthenticated_for_test("http://127.0.0.1:1");
794+
let error = client
795+
.download(&artifact.download_url)
796+
.expect_err("agent install URL must fail safely");
797+
798+
assert!(format!("{error:#}").contains("artifact URL must be an absolute HTTP(S) URL"));
799+
}
780800

781801
fn temp_paths(slug: &str) -> (tempfile::TempDir, AgentPaths) {
782802
let root = tempfile::tempdir().unwrap();

0 commit comments

Comments
 (0)