Bug 1397056 - API/UI: err 414 on manipulating entities with long name
Summary: API/UI: err 414 on manipulating entities with long name
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: Daniel Lobato Garcia
QA Contact: Roman Plevka
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-21 14:06 UTC by Roman Plevka
Modified: 2019-08-12 16:01 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:51:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 17850 0 Normal Closed API/UI: err 414 on manipulating entities with long name 2020-09-14 22:35:35 UTC

Description Roman Plevka 2016-11-21 14:06:44 UTC
Description of problem:
since string length restrictions no longer apply, satellite allows users to create entities of HUGE length. Such entities are not able to be manipulated later on (editing, deleting), due to the fact, that the names of the entities are being used as the GET parameter of the requests. Such requests return 414 (request URI too long).

Version-Release number of selected component (if applicable):
6.3 snap6

How reproducible:
always

Steps to Reproduce:
1. navigate to e.g. Host -> Architectures -> New architecture
2. generate a really huge string (e.g. 10000 chars) (might vary)
3. create a new architecture with generated string as a name.
4. navigate to architectures.
5. try to click (to edit) the new arch or try to delete it

Actual results:
414 - request uri too long

Expected results:
it either works (the id is used in URI instead of a name) or the size restriction should be reintroduced.

Comment 3 Marek Hulan 2016-11-23 16:01:33 UTC
Few observation when I looked at it.

Validations are based on constrained configured in database. For some reason on 6.3 I can see that constraint is missing on architectures table (and probably elsewhere too)

\d+ architectures
name       | character varying           | not null                                                      | extended |              | 

on my setup I can see

\d+ architectures
name       | character varying(255)      | not null implicit NULL::character varying                   | extended |              | 

I have no idea why though.

Comment 4 Daniel Lobato Garcia 2016-12-27 08:03:02 UTC
Created redmine issue http://projects.theforeman.org/issues/17850 from this bug

Comment 5 Daniel Lobato Garcia 2016-12-27 08:37:07 UTC
Fix submitted upstream¸ https://github.com/theforeman/foreman/pull/4134 we removed the limit constraints on architectures and usergroups by mistake, by using change_column. Other tables in our db should be fine, I checked for modifications to the :name field and this is all I got

-- change_column(:domains, :fullname, :string, {:limit=>254})
-- change_column(:media, :name, :string, {:null=>false, :default=>"", :limit=>255})
-- change_column(:architectures, :name, :string, {:default=>"x86_64", :null=>false, :limit=>255})
-- change_column(:auth_sources, :name, :string, {:null=>false, :default=>"", :limit=>255})
-- change_column(:auth_sources, :attr_firstname, :string, {:limit=>255})
-- change_column(:auth_sources, :attr_lastname, :string, {:limit=>255})
-- change_column(:domains, :fullname, :string, {:limit=>255})
-- change_column(:features, :name, :string, {:limit=>255})
-- change_column(:models, :name, :string, {:null=>false, :limit=>255})
-- change_column(:operatingsystems, :name, :string, {:limit=>255})
-- change_column(:operatingsystems, :release_name, :string, {:limit=>255})
-- change_column(:ptables, :name, :string, {:null=>false, :limit=>255})
-- change_column(:roles, :name, :string, {:limit=>255})
-- change_column(:architectures, :name, :string, {:default=>nil})
-- change_column(:audits, :auditable_name, :text)
-- change_column(:usergroups, :name, :string, {:null=>false})
-- change_column_null(:operatingsystems, :name, false)
-- change_column(:templates, :job_name, :string, {:default=>"Miscellaneous", :limit=>255})
-- change_column(:discovery_rules, :name, :string, {:limit=>255})
-- change_column(:discovery_rules, :hostname, :string, {:limit=>255})

Comment 6 Bryan Kearney 2017-01-02 13:08:14 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17850 has been resolved.

Comment 7 Roman Plevka 2017-08-30 12:56:35 UTC
VERIFIED
on snap #13
the length restriction is set back to 255 chars:

# hammer architecture create --name='x..p'
Could not create the architecture:
  Name is too long (maximum is 255 characters)
You have new mail in /var/spool/mail/root

Comment 8 Satellite Program 2018-02-21 16:51:07 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, 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-2018:0336


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