mirror of
https://github.com/block/goose.git
synced 2026-06-01 22:11:07 +02:00
address PR comment
This commit is contained in:
@@ -224,12 +224,20 @@ fn detect_direction(command: &str) -> EgressDirection {
|
||||
|
||||
static CURL_UPLOAD_RE: OnceLock<Regex> = OnceLock::new();
|
||||
let curl_upload_re = CURL_UPLOAD_RE.get_or_init(|| {
|
||||
Regex::new(r"(?i)\b(curl|wget|xh|httpie)\b.*(-X\s*(POST|PUT|PATCH)|--data|--data-raw|--data-binary|-d\s|-F\s|--form|--upload-file|-T\s)").unwrap()
|
||||
Regex::new(r"(?i)\bcurl\b.*(-X\s*(POST|PUT|PATCH)|--data|--data-raw|--data-binary|-d\s|-F\s|--form|--upload-file|-T\s)").unwrap()
|
||||
});
|
||||
if curl_upload_re.is_match(command) {
|
||||
return EgressDirection::Outbound;
|
||||
}
|
||||
|
||||
static WGET_UPLOAD_RE: OnceLock<Regex> = OnceLock::new();
|
||||
let wget_upload_re = WGET_UPLOAD_RE.get_or_init(|| {
|
||||
Regex::new(r"(?i)\bwget\b.*(--post-data|--post-file|--body-data|--body-file)").unwrap()
|
||||
});
|
||||
if wget_upload_re.is_match(command) {
|
||||
return EgressDirection::Outbound;
|
||||
}
|
||||
|
||||
if lower.contains("npm publish")
|
||||
|| lower.contains("cargo publish")
|
||||
|| lower.contains("pip upload")
|
||||
|
||||
Reference in New Issue
Block a user