#3318 Hub, plugins and tools inputs validation
Merged by tkopecek. Opened by jcupova.
jcupova/koji secure-aplication  into  master

Download 3318.patch

Currently, hub and plugins inputs should be checked. I will continue with utils now. When it will be done, I add it to the this PR.

@tkopecek because hub and plugins should be done, can you start with review, please? There are many changes...

rebased onto 57a469f4cb51349478db18eea028a38d3cf0d046

@tkopecek utils check included.

General comments:
- conversions value = int(value) are ok without converting them to ParameterError. I think it just complicates the code without getting real value.
- Rest of except Exception is not best here. All of them should just catch ValueError.

rebased onto 2f7bfcc84137a8991bac0606828b9ce39e08bbda

rebased onto 702e8a669389977fa20f400ad3f1936afdeb32cf

rebased onto 79ae5289c9e746dbef25e050cffc8b42b253d46e

rebased onto 68711f83c031299b41817649173d3a045888800c

rebased onto a79b638a48135261c519790695dec2c6f26a5842

strict=True

It is not needed here - QueryProcessor will escape the value.

Just convert to int. Another query is not necessary here.

just convert to int

Most lookup_packages are not needed. They get converted via libpq.

Note, that each lookup is another query which is strictly not necessary. So, convert to correct type only if it is used in other place than query (in query it is converted automatically).

%r is not the same as f'{info}' (compare fr'{info}')

if event is not int (None, 'auto')

if not kwargs.get('extra') it is combined with next test

convert_value can have none_allowed option which could get rid of those if a is not None: convert_value.

rebased onto 17ca73e293f93484668675488eea15f0e8b1642c

rebased onto c82d9fd434ae6cadf57cb1203f017835f2393857

@tkopecek everything should be fixed and I added none_allowed in convert_value and check_value_type also.

str vs int

not needed (slow, handled on psql level)

not needed - handled by psql as existing foreign key.

dtto - it is bool on db level

All variants are handled by following code (directly and in eventCondition)

bool in db

It will simply fail when iterating over non-dict later. It is ok to drop these.

int in db

Doesn't make sense here - buildinfo is "fake" to get correct release.

Would fail in get_maven_archive.

float > 0 in db

non-API calls don't need these checks. Only user-facing ones.

Not true (epoch is int), but it can be dropped completely as it is internal method.

rebased onto 271dbabf64ad7af85d33942b7a97563c372bd330

rebased onto ce31e758b84d799197f7d6b73cfcddd753d4fb44

@tkopecek all should be fixed. I went through all changes and remove some next validations.

1 new commit added

  • additional fixes

2 new commits added

  • additional fixes
  • Hub, plugins and tools inputs validation

1 new commit added

  • test

-> get_build_target

3 new commits added

  • test
  • additional fixes
  • Hub, plugins and tools inputs validation

@tkopecek good catch, fixed

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

Because this is more bigger PR and it causes merge conflicts with other testing-ready PRs, I drop testing-ready tag from this PR now.

Metadata Update from @jcupova:
- Pull-request untagged with: testing-ready

rebased onto 9bfefe782ef0b3cb7a0f8383f9387fb5ca6c92d8

Commit 0f1df403 fixes this pull-request

Pull-Request has been merged by tkopecek

Metadata Update from @jcupova:
- Pull-request tagged with: testing-ready

Metadata