Bugzilla – Attachment 176718 Details for
Bug 37816
Stop SIP2 from logging passwords
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37816: (QA follow-up) Avoid repetition, typo and pipe test
Bug-37816-QA-follow-up-Avoid-repetition-typo-and-p.patch (text/plain), 2.76 KB, created by
Marcel de Rooy
on 2025-01-17 10:55:34 UTC
(
hide
)
Description:
Bug 37816: (QA follow-up) Avoid repetition, typo and pipe test
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2025-01-17 10:55:34 UTC
Size:
2.76 KB
patch
obsolete
>From 456b64439d446bbb0bcded4516870eedc656d0eb Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 17 Jan 2025 10:51:42 +0000 >Subject: [PATCH] Bug 37816: (QA follow-up) Avoid repetition, typo and pipe > test >Content-Type: text/plain; charset=utf-8 > >Combining three regexes into one. Typo replcing. >Adding a test with pipe in pwd. > >Test plan: >Run t/SIP/Sip.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/SIP/Sip.pm | 10 +++++----- > t/SIP/Sip.t | 9 ++++++++- > 2 files changed, 13 insertions(+), 6 deletions(-) > >diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm >index 189b8b54cd..fa65951bd9 100644 >--- a/C4/SIP/Sip.pm >+++ b/C4/SIP/Sip.pm >@@ -249,7 +249,7 @@ We do this by looking for: > > delimiter + AC/AD/CO + something + delimiter > >-and replcing it with: >+and replacing it with: > > delimiter + field name + asterisks + delimiter > >@@ -275,10 +275,10 @@ Messages and fields that can contain passwords: > sub remove_password_from_message { > my ($message) = @_; > >- $message =~ s/\Q${field_delimiter}\EAC.*?\Q${field_delimiter}\E/${field_delimiter}AC***${field_delimiter}/g; >- $message =~ s/\Q${field_delimiter}\EAD.*?\Q${field_delimiter}\E/${field_delimiter}AD***${field_delimiter}/g; >- $message =~ s/\Q${field_delimiter}\ECO.*?\Q${field_delimiter}\E/${field_delimiter}CO***${field_delimiter}/g; >- >+ # regex does not work with (AC|AD|CO), probably due to .*? and the g modifier >+ # NOTE: Does not work correctly if the password contains a field delimiter, but you cannot login either. >+ $message =~ s/\Q${field_delimiter}\E$_.*?\Q${field_delimiter}\E/${field_delimiter}$_***${field_delimiter}/g >+ for ( 'AC', 'AD', 'CO' ); > return $message; > } > >diff --git a/t/SIP/Sip.t b/t/SIP/Sip.t >index 8f58f46bb8..652a6d5e0e 100755 >--- a/t/SIP/Sip.t >+++ b/t/SIP/Sip.t >@@ -56,7 +56,7 @@ warning_is { $invalidTest = C4::SIP::Sip::Checksum::verify_cksum("1234567") } > is($invalidTest, 0, "Checksum: 1234567 is invalid as expected"); > > subtest 'remove_password_from_message' => sub { >- plan tests => 8; >+ plan tests => 9; > > is( > C4::SIP::Sip::remove_password_from_message("INPUT MSG: '9300CNterm1|COterm1|CPCPL|'"), >@@ -85,6 +85,13 @@ subtest 'remove_password_from_message' => sub { > "11 Checkout" > ); > >+ is( >+ C4::SIP::Sip::remove_password_from_message( >+ "11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC12|34|AD1234|BON"), >+ '11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC***|34|AD***|BON', >+ "11 Checkout with pipe in password" >+ ); >+ > is( > C4::SIP::Sip::remove_password_from_message( > "11YN20240903 134450 AOCPL|AA23529000035676|AB39999000003697|AC|AD1234|BON"), >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37816
:
171011
|
175039
|
175079
|
175639
|
176717
| 176718