Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 6 additions & 170 deletions bottlecap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bottlecap/src/appsec/processor/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl Context {
self.process_result(result);
}
Err(e) => log_waf_run_error(e),
};
}
}

/// Obtain the information about the endpoint that was invoked, if available.
Expand Down
14 changes: 7 additions & 7 deletions bottlecap/src/appsec/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct Processor {
context_buffer: VecDeque<Context>,
}
impl Processor {
const CONTEXT_BUFFER_DEFAULT_CAPACITY: NonZero<usize> = unsafe { NonZero::new_unchecked(5) };
const CONTEXT_BUFFER_DEFAULT_CAPACITY: NonZero<usize> = NonZero::new(5).unwrap();

/// Creates a new [`Processor`] instance using the provided [`Config`].
///
Expand Down Expand Up @@ -578,9 +578,9 @@ impl InvocationPayload for IdentifiedTrigger {
.unwrap_or_default()
.iter()
.flat_map(parse_cookie)
.chunk_by(|(k, _)| (*k).to_string())
.chunk_by(|(k, _)| (*k).clone())
.into_iter()
.map(|(k, v)| (k, v.into_iter().map(|(_, v)| v.to_string()).collect()))
.map(|(k, v)| (k, v.into_iter().map(|(_, v)| v.clone()).collect()))
.collect(),
Self::APIGatewayWebSocketEvent(t) => t
.multi_value_headers
Expand All @@ -589,9 +589,9 @@ impl InvocationPayload for IdentifiedTrigger {
.unwrap_or_default()
.iter()
.flat_map(parse_cookie)
.chunk_by(|(k, _)| k.to_string())
.chunk_by(|(k, _)| k.clone())
.into_iter()
.map(|(k, v)| (k, v.into_iter().map(|(_, v)| v.to_string()).collect()))
.map(|(k, v)| (k, v.into_iter().map(|(_, v)| v.clone()).collect()))
.collect(),
Self::ALBEvent(t) => t
.multi_value_headers
Expand All @@ -601,9 +601,9 @@ impl InvocationPayload for IdentifiedTrigger {
.unwrap_or_default()
.iter()
.flat_map(parse_cookie)
.chunk_by(|(k, _)| (*k).to_string())
.chunk_by(|(k, _)| (*k).clone())
.into_iter()
.map(|(k, v)| (k, v.into_iter().map(|(_, v)| v.to_string()).collect()))
.map(|(k, v)| (k, v.into_iter().map(|(_, v)| v.clone()).collect()))
.collect(),
Self::LambdaFunctionUrlEvent(t) => {
t.cookies.as_ref().map(list_to_map).unwrap_or_default()
Expand Down
8 changes: 2 additions & 6 deletions bottlecap/src/appsec/processor/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::appsec::processor::InvocationPayload;
use crate::lifecycle::invocation::triggers::body::Body;

/// The expected payload of a response. This is different from trigger to trigger.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ExpectedResponseFormat {
/// API Gateway style integration responses (REST and HTTP)
ApiGatewayResponse,
Expand All @@ -16,6 +16,7 @@ pub enum ExpectedResponseFormat {
Raw,

/// Unknown or unsupported response format
#[default]
Unknown,
}
impl ExpectedResponseFormat {
Expand All @@ -39,11 +40,6 @@ impl ExpectedResponseFormat {
}
}
}
impl Default for ExpectedResponseFormat {
fn default() -> Self {
Self::Unknown
}
}

#[derive(Debug, Default, Deserialize)]
#[serde(default)]
Expand Down
Loading
Loading