Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3337245
D13529.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13529.diff
View Options
diff --git a/services/identity/src/websockets/mod.rs b/services/identity/src/websockets/mod.rs
--- a/services/identity/src/websockets/mod.rs
+++ b/services/identity/src/websockets/mod.rs
@@ -28,6 +28,7 @@
IDENTITY_SERVICE_WEBSOCKET_ADDR, SOCKET_HEARTBEAT_TIMEOUT,
};
use crate::cors::cors_layer;
+use crate::regex::is_valid_username;
use opensearch::OpenSearchResponse;
use send::{send_message, WebsocketSink};
pub mod errors;
@@ -158,11 +159,19 @@
request_id: &str,
prefix_request: identity_search_messages::IdentitySearchPrefix,
) -> Result<IdentitySearchResult, errors::WebsocketError> {
+ let username_prefix = prefix_request.prefix.trim().to_string();
+ if !is_valid_username(&username_prefix) {
+ return Ok(IdentitySearchResult {
+ id: request_id.to_string(),
+ hits: Vec::new(),
+ });
+ }
+
let prefix_query = Query {
size: IDENTITY_SEARCH_RESULT_SIZE,
query: Prefix {
prefix: Username {
- username: prefix_request.prefix.trim().to_string(),
+ username: username_prefix,
},
},
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 4:14 PM (18 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2562564
Default Alt Text
D13529.diff (1 KB)
Attached To
Mode
D13529: [identity] Validate username prefix queries with identity search
Attached
Detach File
Event Timeline
Log In to Comment