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

364 Commits

Author SHA1 Message Date
Antonio Carlos Royo
7732a98b8a [redhat-3.11] deps: update pbkdf2 to version 3.1.3 (PROJQUAY-9092) (#4115)
* update pbkdf2 to version 3.1.3

* updating registry proxy tests

---------

Co-authored-by: Antonio Carlos Royo <aroyo@aroyo-thinkpadp1gen7.rmtco.csb>
2025-07-07 15:06:28 -03:00
Brandon Caton
1561d881da ci: fixing app type import (PROJQUAY-8991) (#4037)
ci: fixing app type import (PROJQUAY-8991) (#4021)

ci: fixing app type import
2025-06-11 09:09:26 -04:00
OpenShift Cherrypick Robot
a40d72ddc8 [redhat-3.11] proxycache(permissions): CVE-2025-4374 (PROJQUAY-8892) (#3962)
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-27 15:06:51 -04:00
OpenShift Cherrypick Robot
7d94ff015e [redhat-3.11] chore: Update alembic migration script to support sqlite db (PROJQUAY-7314) (#2947)
* Add sqlite db support on quay start up

Signed-off-by: harishsurf <hgovinda@redhat.com>

* Add batchmode to migration scripts to support sqlite db

* Add sqlite db to config-tool validator + alembic migration

* Fix migration script to prevent db row locking

Added commit statement to ensure previous transaction is
completed before the next one within the same table

* Clean up unused sqlite volume

* Apply black formatting to migration scripts

* Address review comments

* Ensure py39-unit test runs the alembic migration on Sqlite

* Add static type checking for alembic config file name

* alembic remove commit and invalidate during migration

When disconnecting from db, alembic tries to rollback
causing PendingRollbackError

* Bump go version in config-tool Dockerfile

* Explicitly commit transaction to prevent db table locking

* Clean up + remove debug statements

* Undo database secret key change

* Add TEST_DATABASE_URI to py39-unit to run unit test with sqlite db

* Drop index before dropping column to prevent sqlite error

* Add test coverage + address last set of reviews

---------

Signed-off-by: harishsurf <hgovinda@redhat.com>
Co-authored-by: harishsurf <hgovinda@redhat.com>
2024-06-13 10:49:41 -04:00
OpenShift Cherrypick Robot
e035b73b19 [redhat-3.11] teamsync: run team sync worker for teams synced via ldap or keystone (PROJQUAY-6762) (#2852)
* teamsync: run team sync worker for teams synced via ldap or keystone (PROJQUAY-6762)

* fix comment

* adding test

* isort fix

---------

Co-authored-by: Sunandadadi <sunanda.3094@gmail.com>
2024-04-29 16:19:35 -04:00
OpenShift Cherrypick Robot
025945c043 [redhat-3.11] oidc: ask for group object id for azure oauth login (PROJQUAY-6917) (#2837)
* oidc: ask for group object id for azure oauth login (PROJQUAY-6917)

* fixing tests

* adding tests

---------

Co-authored-by: Sunandadadi <sunanda.3094@gmail.com>
Co-authored-by: Sunandadadi <Sunandadadi@users.noreply.github.com>
2024-04-26 15:12:35 +00:00
Brandon Caton
01e3bcce7b cherrypick: merging f24176 from master (PROJQUAY-7033) (#2801)
cherry-picking commit f241767005 from master
2024-04-19 10:13:27 -04:00
OpenShift Cherrypick Robot
d6d495d2eb [redhat-3.11] oidc: allows users to login via cli (PROJQUAY-6873) (#2771)
* oidc: allows users to login via cli (PROJQUAY-6873)

* fixing tests

* update reading username + adding tests

---------

Co-authored-by: Sunandadadi <sunanda.3094@gmail.com>
2024-03-19 09:39:01 -04:00
OpenShift Cherrypick Robot
d084d6b882 [redhat-3.11] autoprune: add alembic script to remove unique constraint on index (PROJQUAY-6782) (#2732)
autoprune: add alembic script to remove unique constraint on index (PROJQUAY-6782)

Make "repositoryautoprunepolicy_namespace_id" index not unique to avoid
duplicate key violation error

Signed-off-by: harishsurf <hgovinda@redhat.com>
Co-authored-by: harishsurf <hgovinda@redhat.com>
2024-03-12 17:37:21 +00:00
OpenShift Cherrypick Robot
be53ca4c75 [redhat-3.11] oidc: use federated login service to sync quay teams (PROJQUAY-6741) (#2726) 2024-03-05 23:29:04 -05:00
Kenny Lee Sin Cheong
be4edd02a3 cache: add caching for manifest requests (PROJQUAY-6482) (#2522) 2024-03-04 16:56:56 -05:00
Sunandadadi
3446d5630b oidc: display error msg when signing in via username password (PROJQUAY-6740) (#2714)
* oidc: display error msg when signing in via username password (PROJQUAY-6740)

* added test + typo fix
2024-03-01 13:14:27 -05:00
Sunandadadi
74fd23d7d3 backend: Syncing teams with OIDC group (PROJQUAY-6290) (#2693) 2024-02-27 16:53:51 -05:00
Harish Govindarajulu
98811f5397 feat: Add auto-prune policy at repository level (PROJQUAY-6354) (#2691)
* feat: Add support for auto pruning at repository level (PROJQUAY-6354)

* Add repositoryautoprunepolicy table to alembic migration script

* Add repository auto-prune policy endpoints

* Add UI for repository auto-pruning policies

* case: apply repo auto-prune policy when no namespace policy given

* case: both namespace and repo pruning policy are given

* Add tests for repository autoprune endpoint

* Add cypress test for repository auto-prune

* Add repo auto-prune policy clean-up for repository deletion

* Add repository auto pruning tables to quay db snapshot for cypress tests

* Address review comments

* Add more tests + fix CI + reformat files

* Address review comments #2

---------

Signed-off-by: harishsurf <hgovinda@redhat.com>
2024-02-27 15:02:57 +05:30
Brandon Caton
29258ae0c7 quota: removing repo size from quota verification (PROJQUAY-6637) (#2704)
removing repo size from upload image size during quota verification
2024-02-26 14:42:36 -05:00
Sunandadadi
4cb0a57488 ui: ui and initial scaffolding for OIDC auth (PROJQUAY-6298) (#2646)
* added base class for OIDC auth + UI

* adding read-only teams page + display sync config + option to remove team sync

* setting page in read only mode fix

* ui tests

* adding validation for group name input

* fixes based on review + fixing test suite

* add backend tests for externalOIDC

* minor fixes
2024-02-20 11:58:10 -05:00
Marcus Kok
2ab7dc29f4 marketplace: add support for quantity from subscriptions api (PROJQUAY-6551) (#2633)
* Adds handling for when a subscription returned from the subscription watch api has a quantity greater than 1. Number of private repos should be correctly calculated using the quantity.

* Updates ui so that subscriptions can only be added to an org as a group, i.e. a subscription with quantity = 2 cannot be split across organizations.
2024-01-29 15:21:30 -05:00
Oleg Bulatov
6d5e6293e3 chore: use oci_model directly without proxy object (#2618) 2024-01-26 15:27:27 +01:00
Oleg Bulatov
a8381d45d3 fix: pull-through should tolerate missing tag (PROJQUAY-4849) (#2598)
* fix: add a test for the bug (PROJQUAY-4849)

* fix: pull-through should tolerate missing tag (PROJQUAY-4849)
2024-01-18 15:54:49 +01:00
Sunandadadi
88168d0878 chore: adding debug logging for repository_lookup cache key(PROJQUAY-6472) (#2610)
log: adding debug logging for repository_lookup cache key(PROJQUAY-6472)
2024-01-16 13:25:23 -05:00
Daniel Messer
e8ff33e728 logs: add failure logging for login, push, pull and delete events (PROJQUAY-5411) (#1903)
* add login failure logging

Signed-off-by: dmesser <dmesser@redhat.com>

* move failure logging into credential validation

Signed-off-by: dmesser <dmesser@redhat.com>

* more precise tracking of affected users

Signed-off-by: dmesser <dmesser@redhat.com>

* fix indent

Signed-off-by: dmesser <dmesser@redhat.com>

* differentiate robots with wrong credentials

Signed-off-by: dmesser <dmesser@redhat.com>

* don't audit failures by default

Signed-off-by: dmesser <dmesser@redhat.com>

* discrete failure tracking for logins, push, pulls and deletes

Signed-off-by: dmesser <dmesser@redhat.com>

* refine log metadata

Signed-off-by: dmesser <dmesser@redhat.com>

* login failure log visualization

Signed-off-by: dmesser <dmesser@redhat.com>

* properly use data model

Signed-off-by: dmesser <dmesser@redhat.com>

* fix unit test bug

Signed-off-by: dmesser <dmesser@redhat.com>

* track non-existing repos differently

Signed-off-by: dmesser <dmesser@redhat.com>

* log view visualization of failed pushes and pulls

Signed-off-by: dmesser <dmesser@redhat.com>

* ensure all tests are conducted with failure logging

Signed-off-by: dmesser <dmesser@redhat.com>

* additional unicode protection

Signed-off-by: dmesser <dmesser@redhat.com>

* python black formatting

Signed-off-by: dmesser <dmesser@redhat.com>

* add cypress test data

Signed-off-by: dmesser <dmesser@redhat.com>

* add safety checks for ascii conversion attempts

Signed-off-by: dmesser <dmesser@redhat.com>

* adjusting unit test with correct error message

Signed-off-by: dmesser <dmesser@redhat.com>

* update to alembic head

Signed-off-by: dmesser <dmesser@redhat.com>

* add standard oauth token metadata in audit

Signed-off-by: dmesser <dmesser@redhat.com>

* update alembic head

Signed-off-by: dmesser <dmesser@redhat.com>

* correct field name

Signed-off-by: dmesser <dmesser@redhat.com>

* formatting

Signed-off-by: dmesser <dmesser@redhat.com>

* bump alembic head

Signed-off-by: dmesser <dmesser@redhat.com>

* refactor auth logging imports

Signed-off-by: dmesser <dmesser@redhat.com>

* bump alembic head

Signed-off-by: dmesser <dmesser@redhat.com>

* formatting

Signed-off-by: dmesser <dmesser@redhat.com>

* restore module

Signed-off-by: dmesser <dmesser@redhat.com>

* pre-commit fixes

Signed-off-by: dmesser <dmesser@redhat.com>

* adding missing default

Signed-off-by: dmesser <dmesser@redhat.com>

* bump alembic head

Signed-off-by: dmesser <dmesser@redhat.com>

* update test data

Signed-off-by: dmesser <dmesser@redhat.com>

* refactoring to save db calls

Signed-off-by: dmesser <dmesser@redhat.com>

* fix unit tests

Signed-off-by: dmesser <dmesser@redhat.com>

* handle unicode conversion errors on email look up

Signed-off-by: dmesser <dmesser@redhat.com>

* bump alembic head

Signed-off-by: dmesser <dmesser@redhat.com>

* proper debug logging and conditional db calls

Signed-off-by: dmesser <dmesser@redhat.com>

* omit wildcard import

Signed-off-by: dmesser <dmesser@redhat.com>

* re-add import

Signed-off-by: dmesser <dmesser@redhat.com>

---------

Signed-off-by: dmesser <dmesser@redhat.com>
2024-01-16 16:46:20 +01:00
Sunandadadi
a7737722fc cache: adding caching on look_up repository (PROJQUAY-6472) (#2521)
* adding caching on look_up repository

* fixing query count in tests

* fixing tests

* isort fix
2024-01-16 09:58:56 -05:00
Marcus Kok
2a4ac09306 billing: marketplace UI (PROJQUAY-6551) (#2595)
* billing: marketplace UI

adds UI in billing section for managing user and org-bound skus

add more unit tests for org binding

changed endpoint for bulk attaching skus to orgs
2024-01-11 11:48:38 -05:00
Marcus Kok
1c893baba5 marketplace: update reconciliationworker to use webCustomerId instead of ebsAccountNumber (PROJQUAY-233) (#2582)
* update reconciliationworker to use webCustomerId instead of
ebsAccountNumber

* fix reconciler where it was incorrectly using the ebsAccountNumber to
  create subscriptions
* add job to reconciler so that it reconciles different ids between the
  database and the user api
* separate skus to be used by billing and skus to be used by reconciler
2024-01-05 16:15:37 -05:00
Marcus Kok
79723f1ce3 marketplace: add exception handling for reconciler (PROJQUAY-233) (#2560)
* add exception handling for reconciler
2023-12-15 12:32:44 -05:00
Michaela Lang
0dfa72d036 user(robots): disallow robot login and create 2nd (PROJQUAY-5968) (#2483)
* Fixed typo, added ROBOTS_WHITELIST as without the ROBOTS_DISALLOW does not make sense

* added ROBOTS_WHITELIST default to config.py
2023-12-05 17:31:08 +01:00
Brandon Caton
236e2fe4fd autoprune: adding audit logs to namespace autoprune policy API (PROJQUAY-6229) (#2431)
Add's audit logs to the CRUD endpoints for both user and organization namespace auto-prune policies.
2023-12-04 13:51:52 -05:00
Sunandadadi
6fc77823da Revert "api: add caching for get_repository method (PROJQUAY-6472)" (#2517)
Revert "api: add caching for get_repository method (PROJQUAY-6472) (#2515)"

This reverts commit 9c89e843f3.
2023-12-01 09:07:19 -05:00
Sunandadadi
9c89e843f3 api: add caching for get_repository method (PROJQUAY-6472) (#2515)
* api: add caching for get_repository method (PROJQUAY-6472)

* fixing formatting

* using pickle to serialize and deserialize objects

* adding model_cache parameter to lookup_repository func for interface and registry_proxy_model

* adding test

* formatting fix
2023-11-30 12:46:28 -05:00
Brandon Caton
7e7dfc919e autoprune: validating input to autoprune policy (PROJQUAY-6230) (#2430)
Validating correct input on auto-prune policy creation.
2023-10-24 08:38:25 -04:00
Brandon Caton
30efa2af76 autoprune: preventing prune of mirror or readonly repos (PROJQUAY-6235) (#2425)
Prevent prune of mirror or readonly repositories even if a auto-prune policy is configured.
2023-10-23 09:31:17 -04:00
Michaela Lang
4719f46c2c federationuser(ldap): adding keepalive settings for LDAP connections (PROJQUAY-5137) (#1975)
* - added env option to select if we want to follow LDAP referrals
- added check on LDAP if the result is a list, it is an LDAP referral

* - change to config.yaml parameter option for enabling/disabling LDAP
  referral lookups
- removed the per/method parameter and moved the referral into the Base
  class

- verified behavior with changing the config.yaml option
  `LDAP_FOLLOW_REFERRALS`

    ```
    $ grep LDAP_FOLLOW_REFERRALS config.yaml
    LDAP_FOLLOW_REFERRALS: 0

    $ ./update_bundle
    secret "quay-config-secret" deleted
    secret/quay-config-secret created
    deployment.apps/quay restarted

    $ oc -n quay logs -f deploy/quay | grep referrals
    gunicorn-web stdout | 2023-05-25 09:41:36,524 [74] [DEBUG] [data.users] LDAPUsers return referrals value 0
    gunicorn-secscan stdout | 2023-05-25 09:41:38,093 [73] [DEBUG] [data.users] LDAPUsers return referrals value 0
    gunicorn-registry stdout | 2023-05-25 09:41:38,410 [72] [DEBUG] [data.users] LDAPUsers return referrals value 0

    $ sed -i -e " s#LDAP_FOLLOW_REFERRALS: 0#LDAP_FOLLOW_REFERRALS: 1#; " config.yaml
    $ grep LDAP_FOLLOW_REFERRALS config.yaml
    LDAP_FOLLOW_REFERRALS: 1

    $ ./update_bundle
    secret "quay-config-secret" deleted
    secret/quay-config-secret created
    deployment.apps/quay restarted

    $ oc -n quay logs -f deploy/quay  | grep referrals
    gunicorn-secscan stdout | 2023-05-25 09:42:22,466 [72] [DEBUG] [data.users] LDAPUsers return referrals value 1
    gunicorn-web stdout | 2023-05-25 09:42:22,496 [73] [DEBUG] [data.users] LDAPUsers return referrals value 1
    gunicorn-registry stdout | 2023-05-25 09:42:23,658 [71] [DEBUG] [data.users] LDAPUsers return referrals value 1
    ```

* reformatted LDAPConnectionBulder call according to PEP

* fixed the formatting change according to pip black

* BREAKING CHANGE: LDAP lookup of robot accounts in the UI for granting
                 permission has been dropped. This impacts Users from LDAP
                 if they have not logged in already (pre provisioning).

the functions:

* _ldap_single_user_search
* _ldap_user_search

have been updated to provide `context` for dropping the LDAP query. As
the functions are used during login as well as during setting
permissions it is mandatory to be able to distinguish the context.

the functions:

* get_nonrobot_user
* find_user_by_email

from the module `data.model.user` have been utilized to identify, if the
user should be looked up in LDAP or not.

* Adding keepalive setting for LDAP connection in complex network
scenarios.

* removed PROJQUAY-5137 (part one) to simplify merging and rollback
-> Revert "BREAKING CHANGE: LDAP lookup of robot accounts in the UI for granting"

This reverts commit 8765093d73.

* fixed black
2023-10-17 17:36:24 +02:00
Brandon Caton
e8a6552cd0 autoprune: updating task status to running (PROJQUAY-6213) (#2413)
updating task status to running
2023-10-17 10:13:05 -04:00
Brandon Caton
fa8aaa328f autoprune: background worker (PROJQUAY-6095) (#2402)
Implementation of the background worker for namespace auto-pruning.

Co-authored-by: Sunanda Dadi <Sunandadadi@users.noreply.github.com>
2023-10-16 16:45:20 -04:00
Marcus Kok
dd96025ff5 user: Support custom LDAP memberOf attribute (PROJQUAY-5928) (#2406)
* user: Support custom LDAP memberOf attribute (PROJQUAY-3235)
* rebase of [PR 1120](https://github.com/quay/quay/pull/1120)

---------

Co-authored-by: Marius Bakke <marius.bakke@usit.uio.no>
2023-10-16 09:33:30 -04:00
Brandon Caton
22c4bbfee5 autoprune: add auto-prune policy endpoints (PROJQUAY-6096) (#2393)
Add's the endpoints to create, update, delete, get, and list organization and user auto-prune policies.
2023-10-10 16:38:46 -04:00
Brandon Caton
0e496b46a5 autoprune: add initial setup for the autoprune feature (PROJQUAY-6094) (#2277)
Adds the auto-prune worker, database models, and feature flag.
2023-10-05 13:37:36 -04:00
Brandon Caton
2a672551fc quota: prevent tag creation on rejected manifest (PROJQUAY-3906) (#2247)
Currently if a new manifest is created that re-uses blobs already existing in the registry but not within the namespace it's possible for that manifest to be blocked if the newly referenced blobs exceed the quota limit. The issue being that the rejection only happens after the manifest has been created and tagged. This change blocks the manifest upload before the creation of the tag and prevents that tag from appearing in the UI and being pullable.

If the manifest upload get's rejected before the tag has been created for a new manifest, a temporary tag is created outside the time machine window so it is immediately available for GC.
2023-10-03 10:30:27 -04:00
Oleg Bulatov
5dbdd37838 chore: add tests for blobupload (#2216) 2023-10-02 11:39:43 -04:00
Brandon Caton
9a9355e5f2 quota: adding indexes to the quota size tables (PROJQUAY-6048) (#2268)
Adding indexes to the quotanamespacesize and quotarepositorysize tables.
2023-10-02 09:09:35 -04:00
Oleg Bulatov
84fa795ae7 chore: fix isort config and remove isort: skip_file (#2196)
* chore: pass config to isort as it doesn't always detect it

* chore: mark package "test" as local, not stdlib

* chore: remove "isort: skip_file"

* chore: fix app in test_load_security_information

* chore: fix app in test_notification

* chore: fix app in test_index_report
2023-09-21 11:46:03 -04:00
Syed Ahmed
54fcfd14f9 secscan: Cache clair vuln reports (PROJQUAY-6057) (#2245)
uses modelcache to for caching clair security report responses
2023-09-20 20:33:41 +00:00
Michaela Lang
67028af9e2 user(robots): disallow robot login and create (PROJQUAY-5968) (#2155)
* add Postgresql client certificate authentication option

* user(robots): disallow robot login and create PROJQUAY-5968

Add a config flag `ROBOTS_DISALLOW` to turn off Robot login and creation
in Quay for all accounts.

with the Flag set existing Robots cannot login anymore
```
$ podman login -u milang+test2 -p W7B...HQA quay.example.com
Error: logging into "quay.example.com": invalid username/password
```

This behavior will be reported in the logs accordingly
```
gunicorn-registry stdout | 2023-08-24 19:08:01,907 [253] [WARNING] [auth.credentials] Failed to validate credentials for robot milang+test2: Robot account has been disabled. Please contact your administrator.
```

as well as in the UI when creating a Robot Account which will display
the `Robot account has been disabled. Please contact your
administrator.` message.

* Revert "add Postgresql client certificate authentication option"
  need to branch for PR (stupid me)

This reverts commit f8f54eead2.

* fixed error message to proper english and added schema definition for the option
2023-09-20 13:07:41 +02:00
Kenny Lee Sin Cheong
72f7c64ed6 chore: update werkzeug and related package versions (PROJQUAY-5098) (#1982)
* chore: update werkzeug and related package versions (PROJQUAY-5098)

Path converter related change reference: https://github.com/pallets/werkzeug/issues/2506

* Update query count
2023-09-12 11:51:09 -04:00
Marcus Kok
e44783fe19 billing: Assign SKU to org (PROJQUAY-5363) (#1989)
* add migration for orgrhskus table

* add endpoints for managing and listing skus bound to an org

* create checks in billing flow to look for org-bound skus

* refactor RH marketplace api objects to be more usable in tests

* update cypress test db data and exclude it from pre-commit hook formatting
2023-08-25 14:52:54 -04:00
Kenny Lee Sin Cheong
5f63b3a7bb chore: drop deprecated tables and remove unused code (PROJQUAY-522) (#2089)
* chore: drop deprecated tables and remove unused code

* isort imports

* migration: check for table existence before drop
2023-08-25 12:17:24 -04:00
Joseph Crosland
93086fa588 secscan: update error from secscan delete (PROJQUAY-0000) (#2077)
Currently the error message doesn't align with the operation.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
2023-08-09 13:18:58 +02:00
Sunandadadi
a095e1f938 api: Adding ignore timezone flag when parsing datetime (PROJQUAY-5360) (#2027)
* api: Removing parsing of datetime (PROJQUAY-5360)

* added ignoretz flag to date util parser

* added removed extra line
2023-07-31 16:39:53 -04:00
Oleg Bulatov
7a487644e1 chore: use isinstance to check instance type (#2068) 2023-07-31 15:15:25 +00:00
Hank Donnay
50224e2dd1 secscan_model: attempt urldecoding fixed_in_version (PROJQUAY-5886) (#2060)
In Clair 4.7, an API field documented to have version information in no
particular format may URL encode it. This change attempts to decode and
read a known field that contains the "fixed" version. If that fails, the
value will be passed through, as it is now.

Signed-off-by: Hank Donnay <hdonnay@redhat.com>
2023-07-26 10:03:35 -05:00