1
0
mirror of https://github.com/quay/quay.git synced 2026-01-29 08:42:15 +03:00
Commit Graph

249 Commits

Author SHA1 Message Date
OpenShift Cherrypick Robot
96bc0decf7 chore: remove deprecated appr code (PROJQUAY-4992) (#1746)
Co-authored-by: Kenny Lee Sin Cheong <kenny.lee28@gmail.com>
2023-02-20 15:30:53 +01:00
Oleg Bulatov
50997dadc5 Cherry-pick fix for IS NULL check (#1745)
Partial cherry-pick of https://github.com/quay/quay/pull/1389
2023-02-07 18:32:11 +01:00
OpenShift Cherrypick Robot
128f125576 secscan: Generate key to reduce vulnerabilities (PROJQUAY-4562) (#1576)
Currently Quay is displaying the Clair response with no
interpretation meaning when Clair reports on vulns per repo
they appear to be duplicated (RHEL based images with multiple
repos and packages existing in more than one). The correct way
to fix this is via an interpretation layer in Quay, this change
is a stop-gap to improve readability for the user.

Signed-off-by: crozzy <joseph.crosland@gmail.com>

Signed-off-by: crozzy <joseph.crosland@gmail.com>
Co-authored-by: crozzy <joseph.crosland@gmail.com>
2022-10-19 10:39:02 -04:00
Dave O'Connor
29f32ae720 Revert mistaken cherry-pick (#1519) 2022-09-07 09:20:49 -04:00
OpenShift Cherrypick Robot
1f5f047517 [redhat-3.7] bug: Increase column size in logentry3 table (PROJQUAY-4305) (#1512)
* bug: Increase column size in logentry3 table (PROJQUAY-4305) We increase the size of `metadata_json` column in `logentry3` table from `TEXT` to `MEDIUMTEXT` on MySQL deployments to prevent the UI from erroring out when reading and decoding the audit log. This only touches MySQL, PostgreSQL is unaffected.

* bug: Increase column size in logentry3 table (PROJQUAY-4305) Fix formatting.

* Removed an extra leftover debug

Co-authored-by: Ivan Bazulic <ibazulic@redhat.com>
2022-08-31 15:39:54 -04:00
OpenShift Cherrypick Robot
7a10c7b6af healthcheck: Use db_kwargs in health check (PROJQUAY-4222) (#1511)
- The database health check is currently not using the db_kwargs and not using ssl settings
- This is causing health check failures for MySQL behind SSL

Co-authored-by: Jonathan King <jonathankingfc@gmail.com>
2022-08-31 15:05:26 -04:00
OpenShift Cherrypick Robot
b7f3434a38 registry: correctly bump tag expiration when tag changes upstream (#1484)
fixes PROJQUAY-3976

Co-authored-by: Flavian Missi <fmissi@redhat.com>
2022-08-16 16:03:44 -04:00
OpenShift Cherrypick Robot
f3910e3c50 Proxy cache: respect CREATE_PRIVATE_REPO_ON_PUSH flag (PROJQUAY-3743) (#1470)
Signed-off-by: harishsurf <hgovinda@redhat.com>

Co-authored-by: harishsurf <hgovinda@redhat.com>
2022-08-08 10:47:10 -04:00
OpenShift Cherrypick Robot
eb20c96103 mirroring: fix mirror claims for multiple processes (PROJQUAY-3982) (#1453)
Previous logic for claiming mirror ("locking") relied on the value
returned from updating the database row. Since this was always being
updated with a new expiration time, it would always succeed, even when
another process had already claimed the same mirror.

Co-authored-by: Kenny Lee Sin Cheong <kenny.lee28@gmail.com>
2022-07-21 11:47:12 -04:00
OpenShift Cherrypick Robot
af28e832d8 quota: Fix calculating org size (PROJQUAY-3889) (#1393)
Fixing database call which will now match on manifest vs repository to correctly calculate org size.

Co-authored-by: bcaton <bcaton@redhat.com>
2022-06-16 14:31:38 -04:00
OpenShift Cherrypick Robot
058b9d34ce quota: Fix join on caching repo size (PROJQUAY-3889) (#1381)
Method for calculating size of repo joined on repo id instead of manifest id. This causes deleted manifests to be counted. Change updates call to join on manifest id.

Co-authored-by: bcaton <bcaton@redhat.com>
2022-06-14 13:11:10 -04:00
Flavian Missi
6090bd05a7 fix: enable non-admins to cache images via pull-thru (PROJQUAY-3806) (#1366) (#1379)
introduces a check of the OrganizationMemberPermission for pulls
against a proxy org.

if the proxy cache feature is disabled, or the org is not a proxy org
the check is not performed and Quay will behave normally.

this check does not mean pulls will work transparently though -
non-admin users need to be added to a team in the proxy org with the
member role, and default read and write permissions need to be given to
that team so that non-admin users can pull and update the cache for
images they do not own (the user who first pulls an image ends up
owning the repository since that is when the repo gets created).
2022-06-14 08:10:40 -04:00
OpenShift Cherrypick Robot
0cafea97d8 [redhat-3.7] Quota: Add Cache To Tag Delete (PROJQUAY-3828) (#1347)
* Add Cache To Tag Delete

* cache using tags included

* fix formatting

Co-authored-by: Keith Westphal <kwestpha@redhat.com>
2022-05-27 13:19:26 -04:00
OpenShift Cherrypick Robot
a7ffd5c7ec pull-thru: bump expiration of all parent manifest lists on pull (PROJQUAY-3818) (#1343)
the previous code relied on manifests always having a single manifest
list as their parents, which is false.

fixes https://issues.redhat.com/browse/PROJQUAY-3818

Co-authored-by: Flavian Missi <fmissi@redhat.com>
2022-05-25 16:07:41 +02:00
OpenShift Cherrypick Robot
88d0549ffe [redhat-3.7] Quota Management: Adding default quota check for image push (PROJQUAY-3789) (#1319)
* Quota Management: Adding default quota check for image push (PROJQUAY-3789)

* Removing redundant if else check

* Fixing formatting

* Setting default quota bytes to 0

Co-authored-by: Sunandadadi <sunanda.3094@gmail.com>
2022-05-11 15:21:42 -04:00
OpenShift Cherrypick Robot
2e2fefe5e5 PROJQUAY-3750: support registries that do not return a digest header (#1313)
Co-authored-by: Flavian Missi <fmissi@redhat.com>
2022-05-10 11:59:03 -04:00
OpenShift Cherrypick Robot
477ccd82f5 quota: address possible integrity exception if computing size concurrently (PROJQUAY-3752) (#1308)
Co-authored-by: Kenny Lee Sin Cheong <kenny.lee28@gmail.com>
2022-05-09 17:36:59 -04:00
Kenny Lee Sin Cheong
3acc55b96c secscan: split the recent manifest chunk of work into multiple batch (PROJQUAY-3501) (#1300)
Split the work of indexing the recent manifests iterator into multiple
batches. This can reduce how often duplicate work happens when
allowing multiple workers to work on the same chunk of the table.
2022-05-04 11:02:56 -04:00
Kenny Lee Sin Cheong
c2ceda5a26 chore: various small changes to fix exceptions, remove unused code (#1295) 2022-04-29 15:11:15 -04:00
Sunandadadi
1e65bff9fc Quota: Raising exception when entered quota size is too big (PROJQUAY-3702) (#1290)
* Quota: Raising exception when entered quota size is too big (PROJQUAY-3702)

* fixing formatting

* Updated error message
2022-04-27 15:28:36 -04:00
Kenny Lee Sin Cheong
3739c1fc21 notification: fix user ref when creating notification for quota (PROJQUAY-3711) (#1288) 2022-04-27 14:49:53 -04:00
Kenny Lee Sin Cheong
9ac30007f9 secscan: cleanup secscan interface (PROJQUAY-3501) (#1284) 2022-04-25 14:24:08 -04:00
Kenny Lee Sin Cheong
ed77147b21 secscan: split indexing of recent manifest into separate background operation (PROJQUAY-3501) (#1281)
Index recent manifests in a separate background process, allowing the
main process to correctly select random slabs from the entire table
set and marking them completed in the allocator (rbtree). This avoids
the worker having to start iterating from the beginning of the table
whenever it is restarted.
2022-04-25 11:21:45 -04:00
Sunandadadi
eea7389a24 Quota: Show system default on UI when quota configuration for the org is not set (PROJQUAY-3518) (#1280)
* Quota: Show system default on UI when quota configuration for the org is not set (PROJQUAY-3518)

* Fixing formatting

* Added function to reduce redundancy and shortened warning message

* added missing parameter to function call

* Fixed organization quota consumption view

* Fixing formatting

* Checking for None before calling function
2022-04-22 16:34:04 -04:00
kwestpharedhat
79a3627a64 fix default system reject (#1277) 2022-04-21 14:07:43 -05:00
Kenny Lee Sin Cheong
035f582075 secscan: fix check for end of table (PROJQUAY-3501) (#1270)
Correctly check for the end of the manifest table, for when the worker
needs to start over. Also add missing token to lock key.
2022-04-20 13:15:21 -04:00
Kenny Lee Sin Cheong
7d0f318baa secscan: update the secscan model interface (PROJQUAY-3501) (#1254)
Add index_manifests as part of secscan interface. index_manifests is
a superset of perform_indexing, but also indexes a batch of recent manifests.
2022-04-19 13:39:51 -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
Sunandadadi
923fc72a28 Quota UI: Showing percent consumed if quota is configured on an organization (PROJQUAY-0000) (#1249)
* Tracking aws ip ranges.json

* Reverting change

* Quota UI: Showing percent consumed if quota is configured on an organization (PROJQUAY-0000)
2022-04-18 15:13:17 -04:00
Sunandadadi
3d6545b9da UI: Quota UI enhancements (PROJQUAY-0000) (#1242)
* Tracking aws ip ranges.json

* Reverting change

* Added default quota limit + added error display div + fixed indentation + minor restructuring of html

* Add check for non-negative or zero quota

* Added Limit percent check. numbers between 1-100 only acceptable

* Show warning note if no quota limit is set

* Show warning if no Reject type limit is selected

* Adding Remove button to delete quota configuration

* If Reject does not exist add default reject quota limit + css

* Throw error if more than one Reject Limit Type

* Throw error on identical limits

* Fixing showing default limits

* Added Organization view settings

* Show Remove btn only if quota exists

* Fixing Remove modal pop up

* Quota Reporting if quota is not set

* Fixing Removing Quota for org

* Fixing super user and org admin permissions

* fix to checking default quota

* Added super user perms check on put, delete endpoints

* Fixing formatting

* Fixing multiple rejects checks + returing empty list instead of None

* Using super user API calls + hiding policy div till quota is set

* Added require_scpe and show_if decorators for super user permissions

* fixing configured quota check after return type changed from None to list
2022-04-14 10:33:20 -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
f3a8b74daf mirror: increased registry user/pass max length (PROJQUAY-2712) (#945)
Increases the maximum length of external_registry_username and
external_registry_password fields from 2048 to 4096. Some registries,
e.g ECR, issue a token to be used as password, whose length is longer
than 2048 after being encrypted and base64 encoded. Since JWT's specs
do not specify a maximum length, we set the combined max length of
these fields to approximately 8K, the default header size on most
servers (including nginx), since these credentials will be passed in a
auth header during the auth flow.
2022-04-13 08:38:13 +02:00
Flavian Missi
a4ed986608 data: increase max len for proxy cache config credentials (#1241)
fixes PROJQUAY-3521
2022-04-12 16:04:01 +02:00
Flavian Missi
61f4bd4252 namespacequota: return 0 when namespace has no size yet (#1237)
for non-cache orgs, get_namespace_size will almost never be called for
an org with no manifests.
for cache orgs, get_namespace_size is garanteed to be called once when
the org doesn't have any manifests: a first pull from a cache org will
ensure that.

this change does not negatively affect callers, as no callers rely on
get_namespace_size to return None.

fixes PROJQUAY-3538
2022-04-12 08:02:25 +02:00
Kenny Lee Sin Cheong
a52b00263a secscan: fix database manifest allocator for securityworker (PROJQUAY-3501) (#1235)
Have the securityworker send an abort signal in the case where the
conditions for indexing a manifest are not met after running the
candidate query. This could be when:
- a manifest has a reference to a manifestsecuritystatus instance
- the manifestsecuritystatus reindex threshold is no longer
valid (because it was recently updated)

This signals that another worker overlapped, and allows the current
worker to move on to the next set.
2022-04-11 13:06:46 -04:00
Kenny Lee Sin Cheong
896a3aab3a api: update the quota api so that it's more consistent with the other apis endpoints (PROJQUAY-2936) (#1221)
* api: update the quota api so that it's more consistent with the other apis (PROJQUAY-2936)

- Uodate the quota api to be more consistent with the rest of the
endpoints
- Handles some uncaught exceptions, such as division by zero
- Update some of the quota data models used by the api to take object
  references instead of names to make it easier to use
- Update table model naming conventions
- swagger operationid multiple nicknames
- Added more test cases for api
- Remove unused functions
- Update the UI for better UX, based on the api changes made

* quota: fix ui input form value

* quota: join quota type query

* Remove unused functions
2022-04-07 14:11:55 -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
Flavian Missi
514bc6f1ba registry_proxy_model: count repository size when caching images (PROJQUAY-3464) (#1215)
also check if the org is within its quota limits before caching an image
from the upstream registry.
2022-03-31 16:38:13 +02:00
Sunandadadi
7524171ac8 Proxy Cache: Interface and UI for Proxy cache Configuration (PROJQUAY-3029) (#1204) 2022-03-31 10:48:59 +02:00
Flavian Missi
5987534718 endpoints/v2: handle generic proxy related errors (#1213)
also add upstream registry to proxy cache key. if a user changes their
mind about what registry to proxy, we shouldn't try to reuse the token.
2022-03-30 15:30:05 +02: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
f248d885aa proxy: don't store entire blob in memory when caching (#1200)
also uses blob uploader to upload the blob to storage.

PROJQUAY-3459
2022-03-28 18:27:07 +02: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
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
4295a8f660 secscan: scan recent manifests in addition to regular backfill (PROJQUAY-3287) (#1169)
Adds a new iterator for exclusively scanning
recent manifests
2022-03-04 12:23:42 -05:00
Syed Mushtaq Ahmed
6a8567f830 secscan: log manifest ID when indexing (PROJQUAY-3287) (#1166)
for debugging quay.io clair issues
2022-03-03 15:47:58 -05:00
Kenny Lee Sin Cheong
033c1aafa1 ui: display manifest list manifest sizes (PROJQUAY-3196) (#1115)
Display individual manifest size in manifest list view.
Also fixes a non-cluster Redis cache bug.

TODO: This requires making extra individiual requests to get the
children manifests. They should probably be cached.
2022-03-01 16:07:28 -05:00
Syed Mushtaq Ahmed
7162be3791 secscan: make batch_size configurable (PROJQUAY-3287) (#1156)
For larger databases like quay.io the default batch
size is too high to complete the job in a resonable
time. Make the batch_size configurable so we can
adjust how many scans can be in-flight for a worker
2022-02-28 14:51:28 -05:00
Kenny Lee Sin Cheong
c5608d9765 database: retry connections on stale MySQL connections (PROJQUAY-3303) (#1148)
An InterfaceError is raised by PyMySQL after a connection has
been idle for longer than the MySQL database's interactive_timeout
setting. This can happen on some workers without work to be done for a
long time. This causes Peewee to be unable to reuse its stale
connection. Instead, the peewee connection needs to be closed, and a
new session opened with MySQL.
2022-02-25 14:22:46 -05:00