Skip to content

Commit be73b4a

Browse files
Use SafeDebug for AMQP messages (Azure#2653)
1 parent 88f1eea commit be73b4a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

sdk/core/azure_core_amqp/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Other Changes
1212

13+
- Use the `SafeDebug` macro to hide potential PII from trace logs. The SafeDebug macro currently applies to the `AmqpApplicationProperties` and `AmqpMessageBody` types.
1314

1415
## 0.3.1 (2025-05-08)
1516

sdk/core/azure_core_amqp/src/messaging.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::Deserializable;
1313
use azure_core::error::ErrorKind;
1414
use azure_core::{Result, Uuid};
1515
use std::time::Duration;
16+
use typespec_macros::SafeDebug;
1617

1718
#[cfg(all(feature = "fe2o3_amqp", not(target_arch = "wasm32")))]
1819
type DeliveryImplementation = super::fe2o3::messaging::messaging_types::Fe2o3AmqpDelivery;
@@ -892,7 +893,7 @@ fn test_size_of_serialized_timestamp() {
892893
assert!(size_result.is_ok());
893894
}
894895

895-
#[derive(Debug, Clone, PartialEq, Default)]
896+
#[derive(SafeDebug, Clone, PartialEq, Default)]
896897
pub enum AmqpMessageBody {
897898
Binary(Vec<Vec<u8>>),
898899
Sequence(Vec<AmqpList>),
@@ -1038,7 +1039,7 @@ where
10381039
}
10391040
}
10401041

1041-
#[derive(Debug, Clone, PartialEq, Default)]
1042+
#[derive(SafeDebug, Clone, PartialEq, Default)]
10421043
pub struct AmqpApplicationProperties(pub AmqpOrderedMap<String, AmqpSimpleValue>);
10431044

10441045
impl AmqpApplicationProperties {
@@ -1052,16 +1053,17 @@ impl AmqpApplicationProperties {
10521053
}
10531054
/// An AMQP message.
10541055
///
1055-
/// This is a simplified version of the AMQP message
1056-
/// that is used in the Azure SDK for Event Hubs
1057-
/// and is not a complete implementation of the AMQP message
1058-
/// as defined in the AMQP specification
1059-
/// <https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html>
1056+
/// An AMQP message is a composite type that contains various fields
1057+
/// that describe the message, its body, and its properties.
1058+
///
1059+
/// It is defined in the following specification:
1060+
/// <https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format>
10601061
///
10611062
#[derive(Debug, Clone, PartialEq, Default)]
10621063
pub struct AmqpMessage {
10631064
pub(crate) body: AmqpMessageBody,
10641065
pub(crate) header: Option<AmqpMessageHeader>,
1066+
// Application properties may potentially contain PII.
10651067
pub(crate) application_properties: Option<AmqpApplicationProperties>,
10661068
pub(crate) message_annotations: Option<AmqpAnnotations>,
10671069
pub(crate) delivery_annotations: Option<AmqpAnnotations>,

0 commit comments

Comments
 (0)