Commit graph

162 commits

Author SHA1 Message Date
Tomas Kopecek
ba2e1e520b basic security checks with bandit
Fixes: https://pagure.io/koji/issue/3042
2021-10-20 15:20:14 +02:00
Tomas Kopecek
73399e517c kojivmd: py3 compatibility issues
Fixes: https://pagure.io/koji/issue/3059
2021-09-30 12:39:23 +02:00
Yu Ming Zhu
0489ad7187 kojivmd: change opts allowed_scms_by_* to allowed_scms_use_*
fixes: #3049
2021-09-29 09:19:36 +02:00
Yu Ming Zhu
a3f19e0f12 more reasonable parameter name, and more doc strs 2021-08-16 17:55:26 +00:00
Yu Ming Zhu
47c4b5d70b kojid: extend SCM.assert_allowed with hub policy
This is a simple extention of `SCM.assert_allowed`

- `assert_allowed_by_policy` will set the default "use_common" to False which is different to the old behavior
- `channel`, `user_id`, `scratch` are passed in the `policy_data` with scminfo right now.

This is a prototype for this change, and there are some other solutions could be implemented too

- Use a scmpolicy plugin as `postSCMCheckout` callback, the pro is that we can do more checks after the source is initialized on builder, meanwhile, the con is that the source will be downloaded even it is denied by policy. It might be a potential risk?
- Do the scm check in hub's `make_task`, this looks straightforward, but may lack some builder's information

fixes: #2757
2021-08-16 17:55:26 +00:00
Yu Ming Zhu
edd2dbadc5 fix flake8 2021-08-13 18:46:03 +00:00
Tomas Kopecek
06528a5650 use decode for py3 bytes/strings
Fixes: https://pagure.io/koji/issue/2976
2021-08-11 12:41:58 +02:00
Tomas Kopecek
0cfb2c0280 py3 Popen text mode fix 2021-08-11 12:41:58 +02:00
Tomas Kopecek
13f4023bf5 flake8 fixes 2021-02-16 14:43:49 +01:00
Tomas Kopecek
c6e69b4f8b backport py27 compatible file open with encoding
client and builder needs to run on py27 which doesn't support
open(encoding='utf-8')

Related: https://pagure.io/koji/issue/2641
2021-02-16 14:13:03 +01:00
Tomas Kopecek
96ae0ecef5 explicit encoding for text file operations
Fixes: https://pagure.io/koji/issue/2641
2021-01-26 13:36:25 +01:00
Tomas Kopecek
883f34cde4 kojivmd: fix typo
Fixes: https://pagure.io/koji/issue/2625
2021-01-06 17:02:35 +01:00
lrossett
1c787a323f flake8 fixes 2020-12-14 13:26:00 +01:00
Tomas Kopecek
0f56d39487 remove deprecated --ca option
Fixes: https://pagure.io/koji/issue/2192
2020-11-23 11:03:38 +01:00
Tomas Kopecek
5a4efd6d07 fix merge problems 2020-10-06 15:10:22 +02:00
Tomas Kopecek
0c833c1236 remove sysv from Makefiles 2020-10-06 15:00:23 +02:00
Tomas Kopecek
48434f4393 vm in py3 2020-10-06 15:00:23 +02:00
Tomas Kopecek
732be23bb5 vm: revert to RawConfigParser
Fixes: https://pagure.io/koji/issue/2277
2020-08-26 09:27:29 +02:00
Tomas Kopecek
f06a8c0bca fix flake8 errors 2020-08-25 13:05:02 +02:00
Tomas Kopecek
f8419e3626 remove deprecated krbV support
Fixes: https://pagure.io/koji/issue/1991
2020-07-24 15:08:47 -04:00
Tomas Kopecek
bb0ea0d6d5 vm: clone mac address via xml
Fixes: https://pagure.io/koji/issue/2289
2020-06-24 14:43:17 +02:00
Yuming Zhu
65f5b6489b fix param name for uploadFile 2020-06-24 14:42:01 +02:00
Tomas Kopecek
50bcb6f3bc replace md5 with sha256 2020-06-24 14:42:01 +02:00
Yu Ming Zhu
a893e8bf2b a wrapper ignoring FIPS for hashlib.md5 2020-06-24 14:42:00 +02:00
Tomas Kopecek
64a0033150 fix additional flake8 problems 2020-05-13 09:56:36 +02:00
Tomas Kopecek
0132313f92 replace logging.warn with warning
call is deprected in python 3.7

Fixes: https://pagure.io/koji/issue/2135
2020-04-22 13:47:15 +02:00
Yuming Zhu
cf34706f04 use Exception instead of BaseException for bare expection 2020-03-03 21:38:22 +08:00
Yuming Zhu
2a2c5cb729 flake8: apply W rules (prefering W503) 2020-03-03 21:38:22 +08:00
Yuming Zhu
c5db34a8e1 flake8: apply E501 with max-line-length=99 2020-03-03 21:38:22 +08:00
Yuming Zhu
f1ba6cefd7 flake8: apply all rest E7 rules 2020-03-03 21:38:22 +08:00
Yuming Zhu
6dd77e0fa4 flake8: apply E502 rule 2020-03-03 21:38:22 +08:00
Yuming Zhu
0f727a2ab4 flake8: apply E3 rules 2020-03-03 21:38:22 +08:00
Yuming Zhu
05340b146b flake8: apply E2 rules except E266 2020-03-03 21:38:21 +08:00
Yuming Zhu
ce1f9928af flake8: apply E1 rules 2020-03-03 21:38:21 +08:00
Yu Ming Zhu
49504073b1 refine import style 2020-03-03 21:35:08 +08:00
Yuming Zhu
97cfaa4fcf flake8: follow E265 rule 2020-03-03 21:35:08 +08:00
Yuming Zhu
642508ccf6 flake8: follow all F rules 2020-03-03 21:35:08 +08:00
Tomas Kopecek
638f6cc6f2 replace xmlrpc_client exception with requests
It is broken in startup function for kojid and kojivmd from the
introduction of requests.

Fixes: https://pagure.io/koji/issue/1914
2020-02-21 12:40:42 +01:00
Tomas Kopecek
0e5042832d split admin_emails option in koji.add_mail_logger
If there are multiple e-mailes separated by comma of space, they should
be split for correct usage of smtplib.sendmail.

Fixes: https://pagure.io/koji/issue/1240
2019-12-19 10:31:58 +01:00
Yu Ming Zhu
5b83c682e4 remove unused imports 2019-12-12 11:00:58 +00:00
Yu Ming Zhu
77bc43c07a sort imports in vm 2019-12-12 11:00:56 +00:00
Mike Bonnet
be31305f52 include CHECKSUM_TYPES in kojikamid.py, and use it when validating checksums of downloaded files
The Koji data model has been updated to support multiple checksum types. These are listed in the
CHECKSUM_TYPES enum in koji/__init__.py, but are not available in kojikamid.py. This change
copies the Enum class and the CHECKSUM_TYPES enum into kojikamid at build time, and uses it when
validating the checksums of downloaded files.
2019-11-27 16:42:24 +01:00
Mike Bonnet
4cd37132dd kojikamid.py: use urllib from six.moves
kojikamid has the SCM class from daemon.py inserted into it at build time. This class
has been converted to use urllib from six.moves (for Python 3 compatibility), rather
than using urlparse. Update the import in kojikamid.py to be compatible with this change.
2019-11-27 16:42:24 +01:00
Mike Bonnet
3d7a6af560 fix argument type in format string
Argument is a string, not a float.
2019-11-27 16:42:24 +01:00
Tomas Kopecek
98b83eff69 fix downloads w/o content-length
Fixes: https://pagure.io/koji/issue/982
2019-11-25 14:51:08 +01:00
Yu Ming Zhu
135ac0d6ae clean python compiled binaries for non *.py code
fixes: #1698
2019-10-31 13:20:53 +01:00
Yu Ming Zhu
4c1928f377 extract read_config_files util for config parsing 2019-10-15 09:14:16 +02:00
Tomas Kopecek
46f85c9b86 verifyChecksum fails for non-output files
PR #967 introduced another error. Before verifyChecksum was used only
from kojikamid and it made sense, that it failed on other files. Now it
is used also for build requires, etc. As it makes no harm (read-only),
we can extend this check for other paths.

Fixes: https://pagure.io/koji/issue/1669
2019-10-15 09:10:10 +02:00
Yu Ming Zhu
2034695e88 add an option to set server realm for all clients 2019-10-10 16:37:56 +02:00
Tomas Kopecek
63648170df Fix typo preventing vm builds
Bug introduced in PR #967 prevents vm builds to work. There is an
additional option to method verifyChecksum.

Fixes: https://pagure.io/koji/issue/1665
2019-10-09 09:15:14 +02:00