fix: block MCP app form submissions (#10985)
This commit is contained in:
@@ -217,6 +217,7 @@ fn build_outer_csp(
|
||||
media-src 'self' data: blob:{resources}; \
|
||||
{frame_src}; \
|
||||
object-src 'none'; \
|
||||
form-action 'none'; \
|
||||
base-uri 'self'{base_uris}"
|
||||
)
|
||||
}
|
||||
@@ -392,7 +393,7 @@ pub(crate) fn routes(secret_key: String) -> Router {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{normalize_csp_source, parse_domains, peer_addr_is_loopback};
|
||||
use super::{build_outer_csp, normalize_csp_source, parse_domains, peer_addr_is_loopback};
|
||||
use axum::{
|
||||
body::Body,
|
||||
extract::ConnectInfo,
|
||||
@@ -467,6 +468,13 @@ mod tests {
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outer_csp_blocks_form_submission() {
|
||||
let csp = build_outer_csp(&[], &[], &[], &[], &[], "http://127.0.0.1:12345");
|
||||
|
||||
assert!(csp.contains("form-action 'none'"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn stores_guest_html_larger_than_default_body_limit() {
|
||||
let app = super::routes("test-secret".to_string());
|
||||
|
||||
Reference in New Issue
Block a user