Skip to content

Commit

Permalink
fix: use secutils/{version} as the User-Agent HTTP header for all…
Browse files Browse the repository at this point in the history
… outbound HTTP requests
  • Loading branch information
azasypkin committed Oct 14, 2023
1 parent 9e7cae4 commit 0a2d7e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ pub use self::{
smtp_catch_all_config::SmtpCatchAllConfig, smtp_config::SmtpConfig,
};

/// Secutils.dev user agent name used for all HTTP requests.
pub static SECUTILS_USER_AGENT: &str =
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);

/// Main server config.
#[derive(Clone, Debug)]
pub struct Config {
Expand Down
2 changes: 2 additions & 0 deletions src/utils/web_security/api_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod csp_meta_parser;

use crate::{
api::Api,
config::SECUTILS_USER_AGENT,
network::{DnsResolver, EmailTransport},
users::{
DictionaryDataUserDataSetter, PublicUserDataNamespace, SharedResource, UserData, UserId,
Expand Down Expand Up @@ -88,6 +89,7 @@ impl<'a, DR: DnsResolver, ET: EmailTransport> WebSecurityApi<'a, DR, ET> {
} else {
RedirectPolicy::none()
})
.user_agent(SECUTILS_USER_AGENT)
.build()?;
match source {
ContentSecurityPolicySource::EnforcingHeader
Expand Down

0 comments on commit 0a2d7e2

Please sign in to comment.