1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00

430 Commits

Author SHA1 Message Date
OpenShift Cherrypick Robot
54cbf8d616 [redhat-3.14] quota: only create notification if one doesn't already exist (PROJQUAY-8857) (#4237)
* quota: only create notification if one doesn't already exist

* adding tests

---------

Co-authored-by: bcaton <bcaton@redhat.com>
2025-09-02 10:41:12 -04:00
OpenShift Cherrypick Robot
a542483538 [redhat-3.14] db: enable WAL mode and other PRAGMA stmts for SQLite to avoid db locking during concurrent writes (PROJQUAY-8758) (#4208)
* ADD PRAGMA statements for SQLITE to avoid database locking

* Fix formating

---------

Co-authored-by: harishsurf <hgovinda@redhat.com>
2025-08-26 10:33:14 -04:00
OpenShift Cherrypick Robot
ca378de84c [redhat-3.14] ldap: Get federated login identifier and use that when checking user privileges in FederatedUserManager (PROJQUAY-8879) (PROJQUAY-5880) (#4182)
ldap: Get federated login identifier and use that when checking user privileges in FederatedUserManager (PROJQUAY-8879) (PROJQUAY-5880)

Co-authored-by: Elliot Gustafsson <elliot.gustafsson@fortnox.se>
Co-authored-by: Brandon Caton <bcaton@redhat.com>
2025-08-08 13:57:52 -04:00
Brandon Caton
7b2e13cc37 federationuser(ldap): avoid doing LDAP lookups for Robot accounts (PROJQUAY-5137) (#4147)
* federationuser(ldap): avoid doing LDAP lookups for Robot accounts (PROJQUAY-5137) (#2505)

BREAKING CHANGE: LDAP lookup of robot accounts in the UI for granting permission has been dropped in context of permissions granting. This impacts Users from LDAP if they have not logged in to Quay already (pre provisioning) as a Federation User will only be available after logging in or being part of a Team.

* adding get_username

---------

Co-authored-by: Michaela Lang <94735640+michaelalang@users.noreply.github.com>
2025-07-25 11:15:42 -04:00
OpenShift Cherrypick Robot
ba447a31ce [redhat-3.14] proxycache: include hidden manifests when querying for child manifests on tag creation (PROJQUAY-8536) (#4102)
* proxycache: include hidden manifests when querying for child manifests on tag creation (PROJQUAY-8536)

* Fix mocked call

---------

Co-authored-by: Kenny Lee Sin Cheong <kenny.lee28@gmail.com>
Co-authored-by: Brandon Caton <bcaton@redhat.com>
2025-07-02 15:14:42 -04:00
Brandon Caton
4e2e0fd6f6 deps: updating python protobuf (PROJQUAY-9081) (#4096) (#4100)
updating python protobuf version. cherrypick of #4096
2025-07-02 14:08:27 -04:00
OpenShift Cherrypick Robot
551d7c994a [redhat-3.14] ci: fixing app type import (PROJQUAY-8991) (#4034)
ci: fixing app type import

Co-authored-by: bcaton <bcaton@redhat.com>
2025-06-10 15:20:49 -04:00
OpenShift Cherrypick Robot
48cbcfb02e [redhat-3.14] proxycache(permissions): CVE-2025-4374 (PROJQUAY-8892) (#3944)
fixing CVE-2025-4374 by extending the create_repository method to understand if we are requesting a proxy_cache repository added unittests for create_repository when proxy_cache.

Co-authored-by: Michaela Lang <milang@redhat.com>
2025-05-22 09:57:40 -04:00
OpenShift Cherrypick Robot
01febf54db [redhat-3.14] Reverting PROJQUAY-8536 (#3837)
* Revert "bug: Adding allow hidden flag while looking up for manifests (PROJQUAY-8536) (#3722)"

This reverts commit f0c153fab5.

* Revert "proxy: moving manifest check to after upstream manifest fetch (PROJQUAY-8536) (#3814)"

This reverts commit 944edd064b.

---------

Co-authored-by: bcaton <bcaton@redhat.com>
2025-04-29 14:33:45 -04:00
OpenShift Cherrypick Robot
bee4118541 [redhat-3.14] logging: fix unreferenced variable from logging (PROJQUAY-8136) (#3820)
logging: fix unreferenced variable from logging (PROJQUAY-8136)

Co-authored-by: Kenny Lee Sin Cheong <kenny.lee28@gmail.com>
2025-04-28 09:59:40 -04:00
OpenShift Cherrypick Robot
ce7df18173 [redhat-3.14] proxy: moving manifest check to after upstream manifest fetch (PROJQUAY-8536) (#3816)
moving manifest check to after upstream manifest fetch

Co-authored-by: bcaton <bcaton@redhat.com>
2025-04-24 15:07:39 -04:00
OpenShift Cherrypick Robot
b544aeb8bd [redhat-3.14] bug: Adding allow hidden flag while looking up for manifests (PROJQUAY-8536) (#3806)
* Adding allow hidden flag while looking up for manifests

* added test to validate allow_hidden tag

* minor addition to fix failing test

* testing

* fixed test

---------

Co-authored-by: shudeshp <shudeshp@redhat.com>
Co-authored-by: Brandon Caton <bcaton@redhat.com>
2025-04-23 11:03:53 -04:00
OpenShift Cherrypick Robot
4eb62af354 [redhat-3.14] gc: garbage collect manifests not targetted by any tags when deleting repository (PROJQUAY-8136) (#3804)
* gc: garbage collect manifests not targetted by any tags when deleting repository (PROJQUAY-8136)

* test untagged manifest removal

---------

Co-authored-by: Kenny Lee Sin Cheong <kenny.lee28@gmail.com>
2025-04-22 18:18:45 +00:00
Shubhra Deshpande
b48e1b47ad chore: added test for proxy cache (PROJQUAY-8440) (#3610)
* adding unit test for proxy cache

---------

Co-authored-by: shudeshp <shudeshp@redhat.com>
2025-02-03 19:20:08 +00:00
Kenny Lee Sin Cheong
b674c7cfc4 gc: Allow setting a deleted repo name's suffix (PROJQUAY-8408) (#3563)
Allows adding a suffix to uuid repo names to collect metrics
2025-01-13 14:21:47 -05:00
Marcus Kok
8d835a9a94 worker: include orgs in reconciler runs (PROJQUAY-8431) (#3560)
Adds an include_orgs param to the active users query used by the reconciler and sets it to true for reconciler runs

Reconciler is not including orgs as a candidate for creating corresponding RH entitlements. As a result it misses users with stripe billing that are considered orgs.
2025-01-10 13:05:22 -05:00
Sunandadadi
70a0edef5b teamsync: peewee integrity error check on teamsync (PROJQUAY-7747) (#3550)
This issue should fix PROJQUAY-7747 and PROJQUAY-8130. Adding IntegrityError to the try except block to skip adding existing user to team.
2025-01-09 15:40:01 -05:00
Marcus Kok
f69716b867 marketplace: splittable sku for MW02702 (PROJQUAY-8151) (#3389)
* marketplace: splittable sku for MW02702 (PROJQUAY-8151)
* Alembic migration to drop unique constraint on the orgrhsubscriptions
  table
* Can split sub quantities of MW02702 across multiple orgs
* Can specify quantity for the MW02702 SKU across orgs on react UI
* Update angular UI to allow user to specify quantities for MW02702
2025-01-09 09:37:09 -05:00
Kenny Lee Sin Cheong
6c10313eea gc: allow setting the repositorygc queueitems' availability (PROJQUAY-8408) (#3551) 2025-01-07 15:05:17 -05:00
Marcus Kok
de9f42c2cc chore: Revert "cve: upgrade elasticsearch and elasticsearch-dsl to 8.13.0 (PROJQUAY-6962)" (PROJQUAY-6962) (#3449)
Revert "cve: upgrade elasticsearch and elasticsearch-dsl to 8.13.0 (PROJQUAY-…"

This reverts commit fb95c90574.
2024-12-04 13:06:13 -05:00
Marcus Kok
fb95c90574 cve: upgrade elasticsearch and elasticsearch-dsl to 8.13.0 (PROJQUAY-6962) (#3418)
* upgrade elasticsearch and elasticsearch-dsl to 8.13.0
* update tests and elasticsearch logs to handle new major version
* pinning elasticsearch-transport according to check requirements.txt test
2024-12-02 09:50:42 -05:00
Syed Ahmed
f7f4fbcbde oci: fix nested index parsing (PROJQUAY-8272) (#3427)
image index can refer to another index when parsing. We currently
assume only a manifest can be referenced from an index. This fixes
the parse logic
2024-11-26 19:24:16 +00:00
Ivan Bazulic
1b27dd3c01 auth: Implement is_restricted_user for federated auth systems (PROJQUAY-8208) (#3400)
* auth: Implement is_restricted_user for OIDC and allow super users to create content regardless of set restriction (PROJQUAY-8208)
Currently, if OIDC is set as an authentication mechanism and restricted users is set, Quay will return a `501 Not Implemented` on invocation. Now, Quay will properly check the restricted user whitelist for federated users.
Additionally, if user restriction is in place and super user's username was **not** explicitly whitelisted, super users would not be able to create new content inside the registry. Now, the username is explicitly checked in the UI to allow super users to create both organizations and repos regardless of restricted users whitelist.

* Add tests

* Add tests for usermanager
2024-11-25 14:47:03 -05:00
Brandon Caton
ce11c87a8e config: adding builder db host param (PROJQUAY-8184) (#3371)
adding builder db host param
2024-10-31 10:00:49 -04:00
Sunandadadi
296b5f35c3 notifications: fetch autoprune tags with multiple policies for image expiry notification (PROJQUAY-8117) (#3340)
* notifications: fetch autoprune tags with multiple policies for image expiry notification(PROJQUAY-8117)

* don't fetch notifications if tags expiry is greater than notification days + add tests
2024-10-18 16:17:07 -04:00
Sunandadadi
409d464cca autoprune: order policies by method before execution (PROJQUAY-8104) (#3334) 2024-10-16 14:35:16 -04:00
Brandon Caton
92d1a31ace api: allowing superuser to read catalog endpoint (PROJQUAY-8023) (#3310)
Allows for the full access and global readonly superuser to read all repositories from the /v2/_catalog endpoint.
2024-10-16 09:44:01 -04:00
Sunandadadi
d39a6f06c3 autoprune: fix tags returned by autoprune worker (PROJQUAY-8070) (#3314)
* autoprune: fix tags returned by autoprune worker (PROJQUAY-8070)

* fixing tests

* moving limit and offset to db_regex_search

* adding test cases
2024-10-11 12:10:59 -04:00
Ivan Bazulic
77bc70a637 logs: Audit export logs requests (PROJQUAY-7679) (#3146)
* logs: Audit export logs requests (PROJQUAY-7679))
We add the ability to audit export logs requests that were previously not tracked.

* Add UI elements to properly render new audit log

* Truncate date/time column on exterme zooms

* Add initdb.py entries

* Fix migration and add test db data

* Add test database and fix migration paths

* Changed logging mechanism to grab raised exceptions

* Fix improper import

* Add date/time timestamp to saved metadata

* Change message on export logs screen in UI

* Changed message in old UI as well

* Change log description in new UI too

* Simplify call logic and add additonal information to logged errors
2024-10-03 13:07:22 -04:00
Sunandadadi
d28d2b00f8 gc: fix fk constraint violation tag delete (PROJQUAY-8006) (#3271)
* gc: fix fk constraint violation tag delete (PROJQUAY-8006)

* revert fix and call delete tag notifications

* add test
2024-10-02 09:07:24 -04:00
Syed Ahmed
e9161cb3ae robots: Add robot federation for keyless auth (PROJQUAY-7803) (#3207)
robots: Add robot federation for keyless auth (PROJQUAY-7652)

adds the ability to configure federated auth for robots by
using external OIDC providers. Each robot can be configured
to have multiple external OIDC providers as the source for
authentication.
2024-09-24 11:32:38 -04:00
Sunandadadi
f327551ccc autoprune: support multiple organization and repository policies (PROJQUAY-7695) (#3209)
* autoprune: support multiple organization policies (PROJQUAY-7695)

* ui to support multiple org policies

* backend to support multiple repository autoprune policies

* ui: multiple repository policies

* fixing tests

* adding tests
2024-09-20 09:18:09 -04:00
Brandon Caton
27d7c149b9 db: adding immutable column to tag table (PROJQUAY-7777) (#3195)
Adding immutable column to tag table
2024-09-19 10:02:20 -04:00
Ivan Bazulic
84249a153b health: Add statement timeout to health check (PROJQUAY-7950) (#3228)
* health: Add statement timeout to health check (PROJQUAY-7950)
Currently, our query to check team roles (part of the db health check) does not time out after a certain period but runs indefinitely. This causes worker timeouts after 30 seconds, which ends up in worker being killed by the master gunicorn process.
We limit the maximum execution time of the query to 5000 ms so that proper exception is raised if that timeout is reached.

PostgreSQL logs:

~~~
2024-09-16 09:38:56.431 EDT [115775] testuser@quayclone2 LOG:  duration: 0.011 ms  statement: BEGIN
2024-09-16 09:38:56.431 EDT [115775] testuser@quayclone2 LOG:  duration: 0.034 ms  statement: SET statement_timeout=5000
2024-09-16 09:38:56.431 EDT [115775] testuser@quayclone2 LOG:  duration: 0.010 ms  statement: COMMIT
2024-09-16 09:38:56.432 EDT [115775] testuser@quayclone2 LOG:  duration: 0.004 ms  statement: BEGIN
2024-09-16 09:38:56.432 EDT [115775] testuser@quayclone2 LOG:  duration: 0.300 ms  statement: SELECT "t1"."id", "t1"."name" FROM "teamrole" AS "t1" LIMIT 1
2024-09-16 09:38:56.433 EDT [115775] testuser@quayclone2 LOG:  duration: 0.010 ms  statement: COMMIT
2024-09-16 09:38:56.433 EDT [115775] testuser@quayclone2 LOG:  duration: 0.005 ms  statement: BEGIN
2024-09-16 09:38:56.433 EDT [115775] testuser@quayclone2 LOG:  duration: 0.012 ms  statement: SET statement_timeout=0
2024-09-16 09:38:56.433 EDT [115775] testuser@quayclone2 LOG:  duration: 0.006 ms  statement: COMMIT
~~~

Quay logs:

~~~
gunicorn-web stdout | 2024-09-16 13:38:56,412 [287] [DEBUG] [peewee.pool] Created new connection 127610088683136.
gunicorn-web stdout | 2024-09-16 13:38:56,417 [287] [DEBUG] [data.model.health] Validating database connection.
gunicorn-web stdout | 2024-09-16 13:38:56,418 [287] [INFO] [data.database] Connection pooling disabled for postgresql
gunicorn-web stdout | 2024-09-16 13:38:56,431 [287] [DEBUG] [peewee] ('SET statement_timeout=%s', (5000,))
gunicorn-web stdout | 2024-09-16 13:38:56,431 [287] [DEBUG] [data.model.health] Checking for existence of team roles, timeout 5000 ms.
gunicorn-web stdout | 2024-09-16 13:38:56,432 [287] [DEBUG] [peewee] ('SELECT "t1"."id", "t1"."name" FROM "teamrole" AS "t1" LIMIT %s', [1])
gunicorn-web stdout | 2024-09-16 13:38:56,433 [287] [DEBUG] [peewee] ('SET statement_timeout=0', None)
gunicorn-web stdout | 2024-09-16 13:38:56,434 [287] [DEBUG] [app] Ending request: urn:request:d039265b-414e-4d03-b29f-3e481286bf0f (/health/instance)...
~~~

* Fix generator function
2024-09-17 09:05:11 -04:00
Brandon Caton
6da65c5003 api: adding tag_pattern to autoprune API (PROJQUAY-7668) (#3188)
Allows users to specify a regex tag pattern when creating namespace/repository autoprune policies via the new UI. Users will have the option to prune tags that only match the tag pattern or exclude tags that match the tag pattern.
2024-09-13 09:48:51 -04:00
Sunandadadi
0ad0da6f04 secscan: Move secscan worker queries to read-only replica (PROJQUAY-7682) (#3151)
* secscan: Move secscan worker queries to read-only replica (PROJQUAY-7682)

* fix formatting
2024-08-20 12:10:37 -04:00
Syed Ahmed
bb054bfefa storage: prevent registry worker crash for large layers (PROJQUAY-7603) (#3123)
during manifest push, we generate a map of blobs which
are part of the manifest layers. This is done using a
UNION query which can overload the worker if the
number of layers is too large. Instead, run each
query individually to prevent the crash
2024-08-09 11:32:33 -04:00
nmaloof
4899ebd6c7 api: allow refining search with an organization (PROJQUAY-7244) (#2901)
This allows a more refined search than just the repo name. When two
organizations contain the same name repo, e.g: org1/python and
org2/python, you can now search via org1/python to get the specific
result instead of both.
2024-08-09 11:19:55 -04:00
Ivan Bazulic
62e42f8f54 storage: Disable pushes on registry (PROJQUAY-6870) (#2755)
* storage: Disable pushes on registry (PROJQUAY-6870)

The current read-only option for Quay is not sometimes feasible, since it requires an insert of the service key and other manual config changes. For instance, if you want to just recalculate quota on the registry, but would like to allow all registry operations (including UI) without the possibility of pushes until recalculation is done, setting the whole registry `read-only` cannot be done since it makes the database read only as well.

This PR introduces a new flag called `DISABLE_PUSHES` which allows all registry operations to continue (changing tags, repo editing, robot account creation/deletion, user creation etc.) but will disable pushes of new images to the registry (i.e. backend storage will not change). If a registry already contains the image and a new tag is simply being added, that operation should succeed.

The following message would appear in the logs:

~~~
gunicorn-registry stdout | 2024-03-13 20:19:49,414 [369] [DEBUG] [endpoints.v2] sending response: b'{"errors":[{"code":"METHOD NOT ALLOWED","detail":{},"message":"Pushes to the registry are currently disabled. Please contact the administrator for more information."}]}\n'
gunicorn-registry stdout | 2024-03-13 20:19:49,414 [369] [INFO] [gunicorn.access] 172.17.0.1 - - [13/Mar/2024:20:19:49 +0000] "PUT /v2/ibazulic/mariadb/manifests/sha256:c4694ba424e0259694a5117bbb510d67340051f0bdb7f9fa8033941a2d66e53e HTTP/1.1" 405 169 "-" "skopeo/1.9.3"
nginx stdout | 172.17.0.1 (-) - - [13/Mar/2024:20:19:49 +0000] "PUT /v2/ibazulic/mariadb/manifests/sha256:c4694ba424e0259694a5117bbb510d67340051f0bdb7f9fa8033941a2d66e53e HTTP/1.1" 405 169 "-" "skopeo/1.9.3" (0.002 3813 0.002)
~~~

The flag defaults to `False` (pushes enabled), unless set otherwise.

* Removed constraint on storage replication when pushes are disabled

* Rebase

* Fix isort sorting

* Fix isort sorting #2

* Removed constraint on storage replication when pushes are disabled

* Rebase

* Remove constraint on storage replication worker

* Fix linting on config.py
2024-08-07 15:40:10 -04:00
Daniel Messer
9d37de42fe Revert "audit: fix auto-prune audit logging (PROJQUAY-7423)" (#3065)
Revert "audit: fix auto-prune audit logging (PROJQUAY-7423) (#3056)"

This reverts commit 6318be721d.
2024-07-22 16:35:48 +02:00
Daniel Messer
6318be721d audit: fix auto-prune audit logging (PROJQUAY-7423) (#3056)
* use logs_model
---------

Signed-off-by: dmesser <dmesser@redhat.com>
2024-07-22 15:36:13 +02:00
Sunandadadi
6dbfdf05c5 events: fix notification methods for image expiry events (PROJQUAY-7487) (#3054) 2024-07-19 18:55:48 +00:00
Brandon Caton
4c15712a82 db: fixing alembic migration (PROJQUAY-7493) (#3044)
fixing alembic migration
2024-07-17 15:02:53 -04:00
sayalibhavsar
bf03190f46 mirror: increase char length in repo mirror config for externalregistrypassword (PROJQUAY-7430) (#3028)
* increase char length in RepoMirrorConfig for external_registry_password

* increase char length in RepoMirrorConfig for external_registry_password

* increase char length in Repo Mirror Config for external_registry_password

* increase char length in Repo Mirror Config for external_registry_password1
2024-07-17 23:07:55 +05:30
Kenny Lee Sin Cheong
32890207da registry: index manifest artifact type for filtering (PROJQUAY-7471) (#3035)
Previous assumption made use of the config media type only, which is not the case
if a manifest's artifact type is explicitly set. i.e the config's media type and
artifact type are different, and the artifact type take precedence for filtering.
2024-07-16 22:33:38 +00:00
Brandon Caton
916aff690c oauth: logging assign oauth action to audit logs (PROJQUAY-7431) (#3033)
logging assign oauth action to audit logs
2024-07-16 14:24:17 -04:00
Sunandadadi
261f62a598 autoprune: autoprune model changes for image expiry events (PROJQUAY-7076) (#2985)
* database: adding subject_backfilled index to manifest table (PROJQUAY-7360) (#2963)

adding subject_backfilled index to manifest table

* Rebasing with main

* updating cypress data

* Rebasing with latest

* Forcing an empty commit.

* minor fixes

* Autoprune model changes

* fixing failing tests

* format fix

---------

Co-authored-by: Brandon Caton <bcaton@redhat.com>
2024-06-27 17:34:33 -04:00
Sunandadadi
6688bcca09 backend: implement basic functionality (PROJQUAY-7076) (#2984)
* database: adding subject_backfilled index to manifest table (PROJQUAY-7360) (#2963)

adding subject_backfilled index to manifest table

* Rebasing with main

* updating cypress data

* fixing conflicts and rebasing with latest code

* adding tests

* Forcing an empty commit.

* Forcing an empty commit.

* skip_locked test fix

* adding tests

* minor fixes

---------

Co-authored-by: Brandon Caton <bcaton@redhat.com>
2024-06-27 16:48:39 -04:00
Brandon Caton
70b03cadc3 db: add postgresql_concurrently to subject backfill (PROJQUAY-7393) (#2979)
Adding postgresql_concurrently to subject backfill
2024-06-27 09:10:46 -04:00
Brandon Caton
7ef664a646 autoprune: Registry level autopruning (PROJQUAY-7392) (#2950)
Allows for adding a default autopruning policy that will be applied to all namespaces.
2024-06-26 16:43:31 -04:00