Project

General

Profile

Bug #5671

Stack trace due to audit table field being too short

Added by Brad DeMorrow almost 5 years ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Audit Log
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

I began receiving the following trace while trying to update a parameter override.

ActiveRecord::StatementInvalid
PG::StringDataRightTruncation: ERROR: value too long for type character varying(255) : INSERT INTO "audits" ("action", "associated_id", "associated_name", "associated_type", "auditable_id", "auditable_name", "auditable_type", "audited_changes", "comment", "created_at", "remote_address", "user_id", "user_type", "username", "version") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) RETURNING "id"
app/models/concerns/host_common.rb:46:in `block in lookup_values_attributes='
app/models/concerns/host_common.rb:39:in `each_value'
app/models/concerns/host_common.rb:39:in `lookup_values_attributes='
app/controllers/hostgroups_controller.rb:64:in `update'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

The parameter I'm updating contained usernames and their sha512 hashes.


Related issues

Related to Foreman - Bug #1902: Smart Parameters aren't audit loggedClosed2012-10-17
Has duplicate Foreman - Bug #5721: Updating host group parameter in 1.5.0 give value too long for type character varying(255)Duplicate2014-05-14
Has duplicate Foreman - Bug #5762: Multiple matchers on smart variableDuplicate2014-05-16
Has duplicate Foreman - Bug #5807: PGError: "value too long for type character varying(255)" for INSERT INTO "audits" when overriding "smart variable" in hostgroup with >255 characters value.Duplicate2014-05-20
Has duplicate Foreman - Bug #6087: input into audit goes wrong Duplicate2014-06-06
Has duplicate Foreman - Bug #6280: crash adding a smart variable matcherDuplicate2014-06-18

Associated revisions

Revision 9158ff3c (diff)
Added by Dominic Cleal almost 5 years ago

fixes #5671 - LookupValue name should be matcher, value is too long

Revision 72bea991 (diff)
Added by Dominic Cleal almost 5 years ago

fixes #5671 - LookupValue name should be matcher, value is too long

(cherry picked from commit 9158ff3ca56d39cc399a5aa35dd04c3b3d78ff1a)

History

#1 Updated by Brad DeMorrow almost 5 years ago


sudo -u foreman psql -c '\d audits'
                                        Table "public.audits" 
     Column      |            Type             |                      Modifiers
-----------------+-----------------------------+-----------------------------------------------------
 id              | integer                     | not null default nextval('audits_id_seq'::regclass)
 auditable_id    | integer                     |
 auditable_type  | character varying(255)      |
 user_id         | integer                     |
 user_type       | character varying(255)      |
 username        | character varying(255)      |
 action          | character varying(255)      |
 audited_changes | text                        |
 version         | integer                     | default 0
 comment         | character varying(255)      |
 associated_id   | integer                     |
 associated_type | character varying(255)      |
 created_at      | timestamp without time zone |
 remote_address  | character varying(255)      |
 auditable_name  | character varying(255)      |
 associated_name | character varying(255)      |
Indexes:
    "audits_pkey" PRIMARY KEY, btree (id)
    "associated_index" btree (associated_id, associated_type)
    "auditable_index" btree (auditable_id, auditable_type)
    "auditable_parent_index" btree (associated_id, associated_type)
    "index_audits_on_created_at" btree (created_at)
    "index_audits_on_id" btree (id)
    "user_index" btree (user_id, user_type)
Foreign-key constraints:
    "audits_user_id_fk" FOREIGN KEY (user_id) REFERENCES users(id)

#2 Updated by Dominic Cleal almost 5 years ago

  • Related to Bug #1902: Smart Parameters aren't audit logged added

#3 Updated by Dominic Cleal almost 5 years ago

  • Category set to Audit Log
  • Legacy Backlogs Release (now unused) set to 16

#4 Updated by Brad DeMorrow almost 5 years ago

After a little bit of digging, it looks like auditable_name is the culprit.

#5 Updated by Dominic Cleal almost 5 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Dominic Cleal
  • Target version set to 1.8.3

#6 Updated by Dominic Cleal almost 5 years ago

  • Has duplicate Bug #5721: Updating host group parameter in 1.5.0 give value too long for type character varying(255) added

#7 Updated by Dominic Cleal almost 5 years ago

  • Has duplicate Bug #5762: Multiple matchers on smart variable added

#8 Updated by Dmitri Dolguikh almost 5 years ago

  • Target version changed from 1.8.3 to 1.8.2

#9 Updated by Dominic Cleal almost 5 years ago

  • Has duplicate Bug #5807: PGError: "value too long for type character varying(255)" for INSERT INTO "audits" when overriding "smart variable" in hostgroup with >255 characters value. added

#10 Updated by Dominic Cleal almost 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#11 Updated by Dominic Cleal almost 5 years ago

  • Has duplicate Bug #6087: input into audit goes wrong added

#12 Updated by Bryan Kearney almost 5 years ago

  • Bugzilla link set to https://bugzilla.redhat.com/show_bug.cgi?id=1107701

#13 Updated by Dominic Cleal almost 5 years ago

  • Has duplicate Bug #6280: crash adding a smart variable matcher added

Also available in: Atom PDF