Skip to content

Commit e692581

Browse files
Copilot0xrinegade
andcommitted
Final safety improvements - fix remaining regex unwrap() calls
Co-authored-by: 0xrinegade <[email protected]>
1 parent 77f8e96 commit e692581

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/utils/audit.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,8 @@ impl AuditCoordinator {
15531553
];
15541554

15551555
for pattern in &command_patterns {
1556-
if regex::Regex::new(pattern).unwrap().is_match(content) {
1556+
if let Some(regex) = safe_regex_new(pattern) {
1557+
if regex.is_match(content) {
15571558
findings.push(AuditFinding {
15581559
id: format!("OSVM-{:03}", *finding_id),
15591560
title: "Potential command injection vulnerability".to_string(),
@@ -1597,7 +1598,8 @@ impl AuditCoordinator {
15971598
];
15981599

15991600
for pattern in &path_patterns {
1600-
if regex::Regex::new(pattern).unwrap().is_match(content) {
1601+
if let Some(regex) = safe_regex_new(pattern) {
1602+
if regex.is_match(content) {
16011603
findings.push(AuditFinding {
16021604
id: format!("OSVM-{:03}", *finding_id),
16031605
title: "Potential path traversal vulnerability".to_string(),
@@ -1672,7 +1674,8 @@ impl AuditCoordinator {
16721674
];
16731675

16741676
for pattern in &tls_bypass_patterns {
1675-
if regex::Regex::new(pattern).unwrap().is_match(content) {
1677+
if let Some(regex) = safe_regex_new(pattern) {
1678+
if regex.is_match(content) {
16761679
findings.push(AuditFinding {
16771680
id: format!("OSVM-{:03}", *finding_id),
16781681
title: "TLS certificate verification bypass".to_string(),

0 commit comments

Comments
 (0)