Bug 2053177 - booth: pcs should validate ticket names
Summary: booth: pcs should validate ticket names
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: pcs
Version: 9.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 9.1
Assignee: Tomas Jelinek
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
: 2027769 (view as bug list)
Depends On:
Blocks: 2027771
TreeView+ depends on / blocked
 
Reported: 2022-02-10 16:20 UTC by Tomas Jelinek
Modified: 2023-07-25 18:21 UTC (History)
11 users (show)

Fixed In Version: pcs-0.11.2-1.el9
Doc Type: Bug Fix
Doc Text:
Cause: User creates a new booth ticket. Consequence: Because pcs doesn't check the ticket's name, it may be unprocessable by booth. Fix: Implement ticket name validation in pcs. Result: Ticket names which are not processable by booth are not allowed in the configuration. Pcs exits with an error describing the correct format of the name.
Clone Of: 1791661
Environment:
Last Closed: 2022-11-15 09:48:38 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CLUSTERQE-5825 0 None None None 2022-06-16 18:03:21 UTC
Red Hat Issue Tracker KCSOPP-1861 0 None None None 2023-07-25 18:21:52 UTC
Red Hat Issue Tracker RHELPLAN-111933 0 None None None 2022-02-10 16:29:39 UTC
Red Hat Product Errata RHSA-2022:7935 0 None None None 2022-11-15 09:48:58 UTC

Description Tomas Jelinek 2022-02-10 16:20:58 UTC
+++ This bug was initially created as a clone of Bug #1791661 +++

Description of problem:
Pcs should check entered ticket names are valid.

Valid ticket names:
* only alphanumeric characters, "-" and "/" are allowed
* max name length is 63 characters
* names must be unique (this check may already be present in pcs)

pcs commands:
* pcs booth ticket add
* pcs constraint ticket add


Version-Release number of selected component (if applicable):
pcs-0.10.4-3.el8


How reproducible:
always, easily


Steps to Reproduce:
1. pcs booth ticket add ms_ip_ticket
2. booth list


Actual results:
# pcs booth ticket add ms_ip_ticket 
# echo $?
0

# booth list                                               
Dec 10 16:03:21 virt-154 booth: [22096]: error: ticket name "ms_ip_ticket" invalid; only alphanumeric names.
Dec 10 16:03:21 virt-154 booth: [22096]: error:  in config file line 5
Dec 10 16:03:21 virt-154 booth: [22096]: error: cannot read config


Expected results:
Pcs exits with an error explaining why the entered ticket name is not valid.


Additional info:
reported upstream: https://github.com/ClusterLabs/pcs/issues/229

Comment 1 Tomas Jelinek 2022-02-10 16:21:34 UTC
*** Bug 2027769 has been marked as a duplicate of this bug. ***

Comment 2 Tomas Jelinek 2022-02-15 14:05:52 UTC
Upstream patch + tests: https://github.com/ClusterLabs/pcs/commit/77597efa43af290b4ddfcc3f28770e356d7f233b

For a test / reproducer, see comment 0.
Implemented checks in this patch:
* only alphanumeric characters and "-" are allowed
* max name length is 63 characters

Comment 4 Miroslav Lisik 2022-05-19 17:26:06 UTC
DevTestResults:

[root@r91-1 ~]# rpm -q pcs
pcs-0.11.2-1.el9.x86_64

[root@r91-1 ~]# rpm -qa booth*
booth-core-1.0-251.2.bfb2f92.git.el9.x86_64
booth-site-1.0-251.2.bfb2f92.git.el9.noarch
booth-1.0-251.2.bfb2f92.git.el9.x86_64
[root@r91-1 ~]# pcs booth setup sites 127.0.0.1 127.0.0.2 127.0.0.3
[root@r91-1 ~]# pcs booth config
authfile = /etc/booth/booth.key
site = 127.0.0.1
site = 127.0.0.2
site = 127.0.0.3

[root@r91-1 ~]# pcs booth ticket add ms_ip_ticket
Error: booth ticket name 'ms_ip_ticket' is not valid, use up to 63 alphanumeric characters or dash
Error: Errors have occurred, therefore pcs is unable to continue
[root@r91-1 ~]# echo $?
1
[root@r91-1 ~]# pcs booth ticket add "$(printf 'a%.0s' {1..64})"
Error: booth ticket name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is not valid, use up to 63 alphanumeric characters or dash
Error: Errors have occurred, therefore pcs is unable to continue
[root@r91-1 ~]# echo $?
1

[root@r91-1 ~]# pcs booth ticket add "a-b"
[root@r91-1 ~]# echo $?
0
[root@r91-1 ~]# pcs booth ticket add "$(printf 'b%.0s' {1..63})"
[root@r91-1 ~]# echo $?
0

[root@r91-1 ~]# pcs booth config
authfile = /etc/booth/booth.key
site = 127.0.0.1
site = 127.0.0.2
site = 127.0.0.3
ticket = "a-b"
ticket = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"

Comment 11 errata-xmlrpc 2022-11-15 09:48:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: pcs security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:7935


Note You need to log in before you can comment on or make changes to this bug.