1
0
mirror of https://github.com/quay/quay.git synced 2026-01-27 18:42:52 +03:00
Commit Graph

138 Commits

Author SHA1 Message Date
Kenny Lee Sin Cheong
5471d3cbcb secscan: deprecate support for Clair V2 (PROJQUAY-2837) (#951)
Removes read support for Clair V2, along with the need to package
jwtproxy with Quay.

TODO: Drop deprecate image api + image table, remove image data model.
2022-05-31 10:15:54 -04:00
Kenny Lee Sin Cheong
776dbd90d5 secscan: update https proxy scheme (#1340)
Update the https proxy scheme from "https" to "http". The scheme was
ignored prior to urllib3 1.26, which is why it was working.

https://github.com/psf/requests/issues/5943#issuecomment-926615360
https://github.com/quay/quay/pull/1250/files#diff-4d7c51b1efe9043e44439a949dfd92e5827321b34082903477fd04876edb7552R131
2022-05-24 18:45:05 -04:00
Jonathan King
3140a62e01 Revert "Revert "quayio: Add export compliance service to Red Hat SSO (PROJQUAY-2056) (#1239)" (#1273)" (#1289)
This reverts commit 8324586e4c.
2022-04-27 13:16:53 -07:00
Kenny Lee Sin Cheong
8324586e4c Revert "quayio: Add export compliance service to Red Hat SSO (PROJQUAY-2056) (#1239)" (#1273)
This reverts commit 247fec3b05.
2022-04-20 15:30:54 -04:00
Kenny Lee Sin Cheong
d719dfadc5 secscan: optimize deduplicating manifests for indexing in securityworker (PROJQUAY-3501) (#1247)
Acquire lock on recent manifests batch to prevent multiple workers
from working on the same set.
2022-04-19 11:34:53 -04:00
Karthikeyan Singaravelan
7384fabf5a Import ABC from collections.abc for Python 3.10 compatibility (#1193) 2022-04-19 11:24:48 -04:00
Jonathan King
247fec3b05 quayio: Add export compliance service to Red Hat SSO (PROJQUAY-2056) (#1239)
- Add FEATURE_EXPORT_COMPLIANCE to config schema
- Add call to export compliance service during OAuth workflow when feature is enabled
2022-04-18 12:45:29 -04:00
Brandon Caton
d2e758dad5 mirror: Get all tags during rollback (PROJQUAY-3146) (#1244)
During a rollback the mirror worker checks for new tags that were created in the repository in the time that the mirror operation has been running. If it encounters older tags that have been updated it will attempt to create a new tag that will point to the previous manifest. Currently for large lists of tags this will fail since we only retrieve the 100 latest tags. The mirror worker will never reach the tags that have been updated and will never recreate them, leading to the behavior of deleting tags during a rollback.
2022-04-14 09:11:48 -04:00
Kenny Lee Sin Cheong
53aaa5493b secscan: add indexer service request duration metric (PROJQUAY-3501) (#1243)
Add histogram for request duration on indexer service. Add random
batch to manifest iterator to reduce duplicate work while manifests
are being backfilled.
2022-04-13 10:04:43 -04:00
Kenny Lee Sin Cheong
dd1eab5238 Revert "secscan: add a global lock on security worker runs (PROJQUAY-3501) (#1226)" (#1232)
This reverts commit 9d89b6fa47.
2022-04-06 11:27:06 -04:00
Kenny Lee Sin Cheong
9d89b6fa47 secscan: add a global lock on security worker runs (PROJQUAY-3501) (#1226)
Add a global lock on security worker iterations, based on the value of
the current pagination token. This is to avoid multilple worker
processes possibly doing work on the same set of manifests.
2022-04-05 13:26:06 -04:00
Brandon Caton
ef91c57c23 format: Updating black to resolve click dependency issue (PROJQUAY-3487) (#1209)
Currently the CI breaks due to a dependency of black, `click`, breaking with it's latest release with `ImportError: cannot import name '_unicodefun' from 'click'`. Since black does not pin it's version of click it pulls in the latest version containing the breaking change and fails the CI check. This updates black with the patch. [See the original issue here.](https://github.com/psf/black/issues/2964) The rest of the changes are format updates introduced with the latest version of black.
2022-03-29 15:34:57 -04:00
Flavian Missi
fe4d66b030 feat: pull-thru proxy cache (#1053)
introduces the possibility to pull images from external registries
through Quay, storing them locally for faster subsequent pulls.

Closes PROJQUAY-3030 and PROJQUAY-3033
2022-03-23 17:20:00 +01:00
Oleg Bulatov
a13f4cf624 Use final image for development (#1060) 2022-03-16 14:15:42 +01:00
Syed Mushtaq Ahmed
5a1fa17a79 invoice: update invoice template to fix layout (PROJQUAY-3267) (#1182)
Update the invoice template to render correct size
2022-03-11 14:15:33 -05:00
Syed Mushtaq Ahmed
8da53e9720 billing: use BytesIO when rendering invoice (PROJQUAY-3267) (#1174)
Migrating to py3 broke invoices. xhtml2pdf returns `bytes` instead of `str`
2022-03-09 14:35:51 -05:00
kwestpharedhat
15fa20a115 QuotaManagement: Reporting (PROJQUAY-2936) (#1048)
* initial commit

* fixing some bugs

* create quota management

Fix json request json type

Creation of quota is working

All quota crud operations

crud for quota limits

repository size reporting

adding registry model

error levels

namespacequota

remove holdover from user file

finalizing refactor to namespace over organization

finalization of functionality

fixing formatting to match with black style

missed some files in formatting

fixing access to attribute

add single test to verify its working

fix some bugs and add defensive catching

bug fixes and code resiliency

Bug fixes and making quota limits detect properly where necessary

remove transitive delete and other bug fixes

fix formatting and trasnitive deletion issues

fix repositorysize does not exist error

fix not nul constraint and add security tests

fix security tests and bug

more security test fixes

reorder security tests

put docker file back and adjust security testing

security tests reduced

Missed changes for status 200

missed additional 201 responses getting 200

security bypass for now

Another tweak to security testing

forgot 1 endpoint

bug fix for parsing dictionary

remove unnecessary check at blob head

add initdb for quota

Incorrect syntax repair

mysql only supports decimal

adding quota specific notifications

optimization

add permission checks

adjust security and add configuration parameter

fix security test for new security levels

Fix logic errors and improve caching

fix logic issue and error reporting

adjust things according to PR comments

fix refactor left overs

miscapitilazation

missed refactor location

refactor code to remove quota limit groupings

fix refactor errors

remove transitive deletion

fix transitive deletes

Transitive deletion work

Transitive deletion work

refactor registry model and remove it

place api behind feature flag

patch feature enabledment for tests

patch feature enabledment for tests

testing to see if the config is the problem

remove patch

fix new org bug

fixing notifications

mismatched parameters

fix org not exists

fixed paramter mismatch

fix nonetype access

fix nonetype access

new tables created user deletion issues

new tables created user deletion issues

parameter mismatch

fix transitive delete

fix model access error

record does not exist missing catch

fix quota deletion to always delete limits

quotalimits deletion on quota deletion

mistake

fix quota limits deletion

patch tests and disable feature

typo

switch to toggle feature

add feature patch to top of file

change testconfigpy

* change permissions

* adjust permissions

* change config access

* fix formatting

* gether feature information differently

* duplicate function name

* fix config name

* type conversion

* config adjustments

* incorrect keyword

* Update security api tests

* duplicate naming

* fix config schema

* revert files and fix error

* QuotaManagement: UI (PROJQUAY-2936) (#1)

* [WIP]: Quota Reporting on Quay UI

* Integrating quota reporting UI with backend

* Humanizing bytes on UI

* Quota Reporting UI on repo table view

* Taking pull and updating code

* Adding quota management view

* Added support for CRUD operations for org quota

* create quota management

Fix json request json type

Creation of quota is working

All quota crud operations

crud for quota limits

repository size reporting

adding registry model

error levels

namespacequota

remove holdover from user file

finalizing refactor to namespace over organization

finalization of functionality

fixing formatting to match with black style

missed some files in formatting

fixing access to attribute

add single test to verify its working

fix some bugs and add defensive catching

bug fixes and code resiliency

Bug fixes and making quota limits detect properly where necessary

remove transitive delete and other bug fixes

fix formatting and trasnitive deletion issues

fix repositorysize does not exist error

fix not nul constraint and add security tests

fix security tests and bug

more security test fixes

reorder security tests

put docker file back and adjust security testing

security tests reduced

Missed changes for status 200

missed additional 201 responses getting 200

security bypass for now

Another tweak to security testing

forgot 1 endpoint

bug fix for parsing dictionary

remove unnecessary check at blob head

add initdb for quota

Incorrect syntax repair

mysql only supports decimal

adding quota specific notifications

optimization

add permission checks

adjust security and add configuration parameter

fix security test for new security levels

Fix logic errors and improve caching

fix logic issue and error reporting

adjust things according to PR comments

fix refactor left overs

miscapitilazation

missed refactor location

refactor code to remove quota limit groupings

fix refactor errors

remove transitive deletion

fix transitive deletes

Transitive deletion work

Transitive deletion work

refactor registry model and remove it

place api behind feature flag

patch feature enabledment for tests

patch feature enabledment for tests

testing to see if the config is the problem

remove patch

fix new org bug

fixing notifications

mismatched parameters

fix org not exists

fixed paramter mismatch

fix nonetype access

fix nonetype access

new tables created user deletion issues

new tables created user deletion issues

parameter mismatch

fix transitive delete

fix model access error

record does not exist missing catch

fix quota deletion to always delete limits

quotalimits deletion on quota deletion

mistake

fix quota limits deletion

patch tests and disable feature

typo

switch to toggle feature

add feature patch to top of file

change testconfigpy

* Removing quota and state conf from repo-list and user-view

* Removing quota and state conf form app list page

* Removing quota conf from repo-list.html

* minor fixes

* Added Quota Repoting and configuring quota from UI

* Making quota configuration component reusable + added support to read bytes via KB, MB, etc + Added reporting for total org consumption + Added org consumption for super user panel + Added quota configurable support on super user panel

* Adding older quota management component

* Removing not reusable quota management component

* Adding % consumption for repo quotas

* Adding % consumption for organization level quota

* Adding check to verify request.args

* Removing todo

* Adding default 0 to quota

* Formatting with black

* Fixing params for tests

* Formatting test file

Co-authored-by: Keith Westphal <kwestpha@redhat.com>

* remove migration

* add migration back

* repair formatting

* QuotaManagement: Moving the logic for bytes conversion to human friendly units to the frontend  (PROJQUAY-2936) (#3)

* Moving the logic for bytes conversion to human friendly units to the frontend

* Reading updates from quota_limit_id

* Formatting using black

* remote unused function

* Adding quota configuring on super user panel (#4)

* Converting quota bytes to human friendly format (#5)

* PR refactors

* invalid reference

* bad return value

* fix bad reference

* bad reference

* fix tests

* Quota Config: UI improvements (#6)

* Quota UI Improvements

* Rendering table for quota limit config

* Removing proxy cache files

* Disabling quota config for org view

* Removing redundant get

* Fixing PR requests

* repair formatting

Co-authored-by: Sunandadadi <Sunandadadi@users.noreply.github.com>
2022-03-08 12:02:03 -06:00
Syed Mushtaq Ahmed
2b2e795b9c secscan: Log start and end index of block in clair (PROJQUAY-3287) (#1165)
This is useful for debugging which block is being processed
2022-03-03 12:52:12 -05:00
Ivan Bazulic
a3ad25c48a chore: Remove unneeded flags fromt he config schema (#1152)
The flag `CREATE_REPOSITORY_ON_PUSH_PUBLIC` is not referenced anywhere in the code. This PR removes it along with its entry in the schema.
2022-02-28 11:05:10 -05:00
Brandon Caton
58b0657255 Revert "schema1: Permit signed schema1 manifests during conversion (PROJQUAY-PROJQUAY-3285) (#1146)" (#1150)
This reverts commit b5bd74bf05.
2022-02-25 16:31:23 -05:00
Brandon Caton
b5bd74bf05 schema1: Permit signed schema1 manifests during conversion (PROJQUAY-PROJQUAY-3285) (#1146)
Currently if an image with an OCI manifest is requested and the client does not support Docker Schema 2 or OCI manifests it will default to returning an unsigned Docker V2 Schema 1 manifest. Older clients who send a application/vnd.docker.distribution.manifest.v1+prettyjws media type header expect a signed Docker V2 Schema 1 manifest and break when an unsigned manifest is recieved. This change defaults to returning a signed manifest for OCI images if the application/vnd.docker.distribution.manifest.v1+prettyjws is present before falling back to an unsigned manifest.
2022-02-25 13:15:31 -05:00
Flavian Missi
42d1cdb4a1 util: update aws-ip-ranges.json (#1143) 2022-02-24 15:49:21 +01:00
Flavian Missi
9ee1c58059 util/ipresolver: manually add aws-ip-ranges.json (#1065)
the Github workflow responsible for keeping this file up-to-date is
currently failing to push to our master branch due to branch protection.
see
https://github.com/githubocto/flat/discussions/66#discussioncomment-1991251
for details.
2022-02-07 14:31:17 +01:00
Brandon Caton
0d3ecb132e imagemirror: Add unsigned registries mirror option (PROJQUAY-3106) (#1085)
Currently when attempting to mirror a registry containing unsigned images the mirror will fail due to not finding the source signature. This is caused by the updated version of Skopeo blocking unsigned images by default. This allows users to specify the ability to pull unsigned images per-repository. The Skopeo version is also now pinned.
2022-02-04 13:10:19 -05:00
Kenny Lee Sin Cheong
b9557d1486 ipresolver: update country mmdb (PROJQUAY-3031) (#1049) 2022-01-07 13:44:59 -05:00
Brandon Caton
f35f3f137c blobuploadcleanupworker: Add BLOBUPLOAD_DELETION_DATE_THRESHOLD (PROJQUAY-2915) (#1022)
Added BLOBUPLOAD_DELETION_DATE_THRESHOLD option to configure TTL on orphaned blobs.
2021-12-07 11:00:53 -05:00
Kenny Lee Sin Cheong
2ffc12b3eb chore: cleanup remaining artifacts remaining related to aci signing (PROJQUAY-2792) (#968)
Removes deprecated artifacts from code and files for ACI.
2021-11-19 13:49:28 -05:00
Brandon Caton
22282dae09 blobuploadcleanupworker: Add cleanup for orphaned blobs (PROJQUAY-2313) (#967)
Currently blobs leftover in the uploads directory during cancelled uploads do not get cleaned up since they are no longer tracked. This change cleans up the uploads storage directory directly.
2021-11-17 15:55:33 -05:00
Dave O'Connor
e94e14e8f0 Resolves issues with booting quay container (#953) 2021-10-28 15:27:21 -04:00
mosen
fca67e7729 feat: mypy type annotations (PROJQUAY-740) (#455)
* Add dev dependencies mypy and typing

* Add makefile target `types-test`, not yet included in `test` target.

* Generate stubs for imported modules to avoid mypy complaining about missing types.

* Remove generated stubs as there are way too many and they cause tons of mess in the repo. Switched to ignoring untyped modules for now, to concentrate on Quay-only type checking.

* mypy config changed to ignore missing imports

* ignore property decorator as it is not supported by mypy

* mypy annotations for many configuration variables

* re-generate mypy_stubs directory as its necessary in some classes for base classes to prevent mypy errors

* util/registry/queuefile referred to non existent definition of Empty class in multiprocessing.queues

* ignore type checking for things like monkey patching and exported/re-imported objects that 
mypy does not allow.

* Adjust mypy config to warn us about unreachable return paths and useless expressions.

* Add the __annotations__ property to INTERNAL_ONLY_PROPERTIES so that it is not part of the config schema testing

* Remove redundant dependencies `typing` and `typing-extensions` which are NOOP after Python 3.5

* Remove mypy-extensions which only provides a TypedDict implementation but has not been updated since 2019.

* updated mypy to 0.910 which requires all types packages to be installed manually.

* exclude local-dev from type checking until core team can suggest an outcome for __init__.py duplicate packages

* re-add typing dependency which will be needed until Python 3.9

* ignore .mypy_cache

* add mypy stub for features module to replace inline definitions

* import annotations eager evaluation in billing.py as it was required to reference a class declared later in the module.

* remove the type definition of V1ProtocolSteps/V2ProtocolSteps to make tox happy
2021-10-25 09:56:26 +02:00
Sunandadadi
20aef6a589 Quay.io UI: Fetching severity from cvss score and removing visibility… (#887)
* Quay.io UI: Fetching severity from cvss score and removing visibility of unknown metrics (PROJQUAY-2541)

If vulnerability's severity is missing mapping severity from cvss score if present. Removed visibility if severity or distribition is Unknow

* Quay.io UI: Fetching severity from cvss score and removing visibility of unknown metrics (PROJQUAY-2541)

Fixing Typo
2021-10-17 20:51:16 -04:00
Jonathan King
a29f3e0eea defaults: Update defaults in config and schema (PROJQUAY-2425) (#923)
- Update defaults in config.pu
2021-10-12 14:47:40 -07:00
Sorin Sbarnea
044fec5e51 Document irc channels move to libera.chat (#802) 2021-10-01 10:06:34 -04:00
Jonathan King
653630579f fips: enforce smtp tls (PROJQUAY-1804) (#782) (#782)
Patch CRAM-MD5 function to allow usage under FIPS but enfore TLS
2021-08-03 10:12:17 -04:00
Kenny Lee Sin Cheong
b0adc9667c registry: add support for extended repository names (PROJQUAY-1535) (#814)
Allows forward slashes to be used in repository names according to
https://docs.docker.com/docker-hub/repos/.

NOTE: This change simply allows the use of "/" in repository
names needed for certain Openshift use cases. This does not implement
any new permission model for nested paths. i.e A repository with a
nested path is treated as a single repository under a _single_
namespace.
2021-07-28 12:27:33 -04:00
Kenny Lee Sin Cheong
64bc11fe46 oci: allow oci artifact registration (PROJQUAY-1032) (#803)
Allow registration of custom oci artifact types in Quay's configuration.
2021-07-26 09:52:33 -04:00
thomasmckay
6470248be1 api: /v1/user/initialize to create first user (PROJQUAY-1926) (#771)
Add an unauthenticated API endpoint to create the initial user in the database. Usage is primarily intended for deployment automation.
2021-07-23 12:03:47 -04:00
Kenny Lee Sin Cheong
65ec47ab4b secscan: handle remote layer url when sending request to Clair (PROJQUAY-2269) (#841)
Handle the case where a layer might be remote (not hosted in Quay's
storage) and add the remote blob url instead of the storage's download
url.
2021-07-21 13:14:31 -04:00
Ivan Bazulic
6977730185 utility: Fixes backfillreplication script to use manifest blobs (PROJQUAY-2218) (#826)
Fixes an issue where the backfill replication script was using the `image` table and not the `manfiestblob` table which is being used since Quay 3.4.x exclusively.
JIRA: https://issues.redhat.com/browse/PROJQUAY-2218
2021-07-09 10:53:46 -04:00
Kenny Lee Sin Cheong
a839a78eb5 chore: allows Quay to run for account recoveries (PROJQUAY-970) (#793)
Adds ACCOUNT_RECOVERY_MODE to allow Quay to run with some core
features disabled. When this is set, the instance should only be used
in order by existing users who hasn't linked their account to an
external login service, after database authentication has been
disabled.
2021-07-07 12:45:24 -04:00
thomasmckay
95ec9478fc mirror: Do not store signatures on repo mirroring (PROJQUAY-2167) (#816)
Newer versions of skopeo attempt to store signatures locally. This change prevents copying signatures during repo mirroring.
2021-07-07 12:21:18 -04:00
kalle (jag)
cfd4e8c46b util: fix matching multiples in jsontemplate.py (PROJQUAY-0000) (#800)
Matching multiples caused exceptions to be raised. This made it so
webhook notification POST bodies could not template things like the
image tags as `${tags[*]}`. This was caused by a typo in the jsonpath_rw
match field that was used.

Signed-off-by: Kalle Jillheden <kalle.jillheden@iver.se>
2021-06-08 14:16:08 -04:00
thomasmckay
6ba0e88128 organization: config to allow organization creation on push (PROJQUAY-928) (#799)
Config CREATE_ORGANIZATION_ON_PUSH that will create an organization if it doesn't yet exist when image is pushed. Defaults to False.
2021-06-07 08:27:55 -04:00
thomasmckay
a1b7e4b519 repository: config to allow public repo create (PROJQUAY-1929) (#772)
New config CREATE_PRIVATE_REPO_ON_PUSH to control global default for new repositories created via push. Defaults to True, meaning the repo will be created with "private" visibility. If set to False, new repos created by push will be created with "public" visibility.
2021-05-26 09:44:16 -04:00
Kenny Lee Sin Cheong
4ad5a458c2 chore: remove uploading filtering from imagestorage queries (PROJQUAY-1914) (#764)
The "uploading" column is an artifact from depending on writing to the
Image table (see BlobUpload table instead). As of 3.4, Quay no longer
writes to that table, and is only needed until quayio moves away from
Clair v2, after which work to remove "glue" code and fully deprecate
the Image table (amongst other tables) can start.

This is done as a separate commit from the actual migration so that it
can be cherrypicked.
2021-04-21 13:53:28 -04:00
Kenny Lee Sin Cheong
efa0692e5a gc: increment quay_gc_repos_purged for NamespaceGCWorker (PROJQUAY-1802) (#749)
Since NamespaceGCWorker does a superset of RepositoryGCWorker's
operations, make sure that quay_gc_repos_purged is incremented if
either workers deletes a repository.
2021-04-15 16:09:58 -04:00
Kenny Lee Sin Cheong
c12654bf46 lock: allows global lock to be used from main app (PROJQUAY-788) (#745)
GlobalLock had a dependency on app, which would cause a circular
dependency if imported from the main app. Workaround this by requiring
to pass the configuration to the GlobalLock instead (this is done by a
classmethod, due to the use of Redlock's factory). This means before
the use of GlobalLock, "configure" will need to be called once, per process.
2021-04-14 14:44:33 -04:00
Kenny Lee Sin Cheong
778afaf36b lock: reuse redis client when creating locks (PROJQUAY-1872) (#741)
By default, Redlock creates a new client per instance. Using the
provided factory allows Redlock to reuse a single connection per
instance and avoid running out of connections. e.g When a worker tries
to get a lock, it should not open new connections every time.

Increase sleep duration between queue polls on
WorkerSleepException. This will give more time before retrying after
failing to acquire a lock.
2021-04-14 11:39:56 -04:00
Kenny Lee Sin Cheong
f774e4c6b6 gc: add metrics for deleted resources (#711)
Add counters for the number of resources deleted by the gc worker, the
repository gc worker and the namespace gc worker.
2021-04-09 14:32:37 -04:00
Kenny Lee Sin Cheong
3b94cda751 gc: fix GlobalLock ttl unit and increase gc workers lock timeout (#712)
Correctly converts the given ttl from seconds to milliseconds when
passed to Redis (redlock uses 'px', not 'ex'). Also increase the lock
timeout of gc workers to 1 day.

Some iteration, for repos with large numbers of tags (1000s), will
take more than 15 minutes to complete. This change will prevent multiple
workers GCing the same repo, and one possibly preempting
another. GlobalLock's ttl will make the lock available again when
expired, but will not actually stop execution of the current GC
iteration until the GlobalLock context is done. Having a 1 day timeout
should be enough.

NOTE: The correct solution would have GlobalLock should either renew
the lock until the caller is done, or signal that it is no longer
valid to the caller.
2021-04-06 14:05:11 -04:00