Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue_template_settings needs a UNIQUE index on project_id #34

Open
martinvonwittich opened this issue Jul 19, 2022 · 1 comment
Open

Comments

@martinvonwittich
Copy link

Summary

I just noticed on our Redmine installation that the issue_template_settings table doesn't have a UNIQUE index on project_id. This index is necessary to ensure that it isn't possible to put multiple conflicting configurations for a single project into the table.

Description

redmine=# \d issue_template_settings
                                     Tabelle »public.issue_template_settings«
      Spalte       |   Typ   | Sortierfolge | NULL erlaubt? |                     Vorgabewert                     
-------------------+---------+--------------+---------------+-----------------------------------------------------
 id                | integer |              | not null      | nextval('issue_template_settings_id_seq'::regclass)
 project_id        | integer |              |               | 
 help_message      | text    |              |               | 
 enabled           | boolean |              |               | 
 should_replaced   | boolean |              |               | false
 inherit_templates | boolean |              | not null      | false
Indexe:
    "issue_template_settings_pkey" PRIMARY KEY, btree (id)

There is no UNIQUE index on project_id. This means that I could easily put multiple conflicting configurations for a single project into the table:

redmine=# INSERT INTO issue_template_settings (project_id, inherit_templates) VALUES (511, 't');
INSERT 0 1
redmine=# INSERT INTO issue_template_settings (project_id, inherit_templates) VALUES (511, 'f');
INSERT 0 1
redmine=# SELECT * FROM issue_template_settings WHERE project_id = 511;
 id  | project_id | help_message | enabled | should_replaced | inherit_templates 
-----+------------+--------------+---------+-----------------+-------------------
 479 |        511 |              |         | f               | f
 480 |        511 |              |         | f               | t
 481 |        511 |              |         | f               | f
(3 Zeilen)

Environment

  • Redmine version 4.2.3.stable

  • Installed plugins:

    redmine_agile 1.6.2
    redmine_checklists 3.1.16
    redmine_contacts 4.3.2
    redmine_custom_css 0.1.7
    redmine_custom_js 0.1.1
    redmine_issue_templates 1.1.0
    redmine_local_avatars 1.0.5.2.0
    redmine_mermaid_macro 1.0.0
    redmine_revision_branches 0.3.2
    redmineup_tags 2.0.8

  • Ruby version 2.7.4-p191 (2021-07-07) [x86_64-linux-gnu]

  • OS Platform Debian Linux 11.4

  • Database PostgreSQL 13.7-0+deb11u1

  • Rails Env production

@github-actions
Copy link

Thank you for contributing to Redmine Issue Templates plugin!' first issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant