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

184 Commits

Author SHA1 Message Date
jbpratt
73d2e2f444 feat(endpoints): add immutability policy API endpoints (PROJQUAY-10160) (#4934)
Add REST API for managing immutability policies at organization and
repository levels. Integrate policy evaluation into tag creation.

Signed-off-by: Brady Pratt <bpratt@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-01-22 15:30:09 +00:00
Marcus Kok
f3f15f3f6d api: Add architecture_filter to mirror configuration API (PROJQUAY-10259) (#4922)
Extend the mirror configuration API to accept and return architecture_filter
settings, allowing users to configure which architectures should be mirrored
from multi-architecture images via the REST API.

Changes:
- Add architecture_filter to API schema and GET response
- Handle architecture_filter in POST (create) and PUT (update) methods
- Validate architecture values against allowed set (amd64, arm64, ppc64le, s390x)
- Add comprehensive API tests for the new field

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 09:28:29 -05:00
Shaon H
92b6f4729a feat(mirror): organization-level mirror config CRUD APIs (PROJQUAY-1266) (#4923)
* mirror: Add FEATURE_ORG_MIRROR feature flag (PROJQUAY-1266)

Add organization-level repository mirroring feature flag to enable
the new org mirroring functionality. Feature is disabled by default.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* mirror: Add GET endpoint for org mirror config (PROJQUAY-1266)

Implements the GET /v1/organization/<org>/mirror endpoint to retrieve
organization-level mirror configuration. Includes business logic layer
with get_org_mirror_config() and comprehensive unit tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* mirror: Add POST endpoint for org mirror config (PROJQUAY-1266)

Add create endpoint for organization-level mirror configuration:
- POST /v1/organization/<orgname>/mirror creates new config
- Validates robot account ownership and credentials
- Returns 201 on success, 409 if config already exists

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* mirror: Add DELETE endpoint for org mirror config (PROJQUAY-1266)

Add delete endpoint for organization-level mirror configuration:
- DELETE /v1/organization/<orgname>/mirror removes config
- Also deletes all associated discovered repositories
- Returns 204 on success, 404 if config doesn't exist

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* mirror: Add PUT endpoint for org mirror config (PROJQUAY-1266)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix test failure

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 16:01:15 -08:00
jbpratt
c3aaa87c47 fix(organization): optimize get_organization_member_set to accept IDs directly (PROJQUAY-900) (#4918)
Eliminate N+1 lazy-load queries by accepting user IDs instead of User objects.

## Problem

When checking organization membership for permissions, the old code triggered
a lazy-load query for EACH permission just to extract the user ID:

```python
# Old caller pattern - triggers N lazy-loads!
users_filter = {perm.user for perm in repo_perms}
org_members = get_organization_member_set(org, users_filter=users_filter)
```

For an endpoint returning 50 permissions, this caused 50 extra SELECT queries.

## Solution

Accept user IDs directly via `user_ids_filter` parameter:

```python
# New pattern - no lazy-loads!
user_ids_filter = {perm.user_id for perm in repo_perms}
org_members = get_organization_member_set(org, user_ids_filter=user_ids_filter)
```

The `user_id` foreign key field is already populated on the model - accessing
it doesn't require a database query.

## Changes

- Renamed `users_filter` → `user_ids_filter` parameter
- Accept set of integer IDs instead of User objects
- Updated 6 call sites in permission_models_pre_oci.py and prototype.py
- Added comprehensive test coverage

## Performance Impact

For get_repo_permissions_by_user with 50 permissions:
- Before: 50 lazy-load queries
- After: 0 queries

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Brady Pratt <bpratt@redhat.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 14:17:08 -06:00
Marcus Kok
074c88af13 api: Add sparse manifest capability detection endpoint (PROJQUAY-10258) (#4870)
Add new endpoint for clients to query registry sparse manifest support:

- GET /api/v1/registry/capabilities returns JSON with sparse_manifests
  capability info (supported, required_architectures, optional allowed)
- V2 base endpoint now includes X-Sparse-Manifest-Support and
  X-Required-Architectures headers for OCI compliance
- Endpoint accessible without authentication for client discovery

This enables oc-mirror and skopeo to detect sparse manifest support
before attempting filtered multi-architecture mirroring.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 15:21:18 -05:00
jbpratt
a49ccd6333 feat(endpoints): add tag immutability API layer (PROJQUAY-10159) (#4839)
Expose tag immutability through the existing tag REST API endpoint.
This adds:
- immutable field to PUT /api/v1/repository/{repo}/tag/{tag}
- TagImmutable 409 exception for blocked operations
- immutable field in tag list responses
- Exception handling for DELETE and PUT on immutable tags

Write permission required to lock, admin required to unlock.

Signed-off-by: Brady Pratt <bpratt@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-01-16 11:09:14 -05:00
Ryan Wallace
a06cc6fa43 chore: update all black versions to 24.4.2 and run make black (#4754)
* chore(pre-commit): match black version with requirements-dev

* run `make black` against repo

* ci: switch to black 24.4.2

* fix: py312

* fix: flake8 errors

* fix: flake8 conflicts

* chore: add git blame ignore revs file
2025-12-19 11:29:53 -06:00
Harish Govindarajulu
5a0d7efecd fix(ui): add label to show global readonly superuser in organizations list (PROJQUAY-9970) (#4717)
This commit adds a cyan "Global Readonly Superuser" label to identify
global readonly superusers in the Organizations list, making it easier
for administrators to distinguish them from regular superusers.

Backend change: Updated User.to_dict() to include global_readonly_super_user
property in the /api/v1/superuser/users/ API response.

Frontend changes: Propagated the property through the data flow and added
label rendering with cyan color to visually distinguish from regular
superusers (blue).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-11 14:44:28 -06:00
jbpratt
ced2c6ffa8 feat(endpoints,web): add audit logs for quota configuration (PROJQUAY-9859) (#4692)
Adds audit logging for all quota management operations:
- org_create_quota, org_change_quota, org_delete_quota
- org_create_quota_limit, org_change_quota_limit, org_delete_quota_limit

Backend changes:
- Add LogEntryKind types in initdb.py
- Add log_action calls in namespacequota.py endpoints
- Add Alembic migration for new log kinds
- Add unit tests for audit logging

Frontend changes:
- Add log descriptions in UseLogDescriptions.tsx
- Add Cypress e2e test for quota log display

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-09 09:44:10 -06:00
Kenny Lee Sin Cheong
5cbdf7ba3c metrics: add support for flask request buckets (PROJQUAY-9853) (#4638)
* metrics: add support for flask request buckets

* Add config flag to schema

* Remove unused function

* Add type annotation for config flag
2025-12-04 10:47:23 -05:00
jbpratt
20dd65a04d fix(api): return manifest pull stats for digest-only pulls (PROJQUAY-9877) (#4668)
When images are pulled by digest only (not by tag), the API endpoint
was returning 0 for manifest_pull_count because it ignored manifest_stats
when tag_stats was None.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-03 08:07:30 -06:00
Dave O'Connor
90803ded95 fix(quota): block quota write operations without SUPERUSERS_FULL_ACCESS (PROJQUAY-9833) (#4617)
When FEATURE_SUPERUSERS_FULL_ACCESS=false, regular superusers could
create/update/delete quotas for other users' organizations (returning 201/200),
but couldn't view them (returning 403). This was a security bug - both read
and write operations should require FULL_ACCESS permission to access other
organizations' quotas.

Root cause: Organization quota write endpoints used SuperUserPermission().can()
instead of allow_if_superuser_with_full_access(), allowing any superuser to
modify other orgs' quotas regardless of the FULL_ACCESS setting.

Changes:
- endpoints/api/namespacequota.py: Replace SuperUserPermission().can() with
  allow_if_superuser_with_full_access() in all quota write operations:
  * OrganizationQuotaList.post() - create quota
  * OrganizationQuota.put() - update quota
  * OrganizationQuota.delete() - delete quota
  * OrganizationQuotaLimitList.post() - create quota limit
  * OrganizationQuotaLimit.put() - update quota limit
  * OrganizationQuotaLimit.delete() - delete quota limit

- endpoints/api/test/test_superuser_full_access.py: Add comprehensive tests
  for quota operations with and without FULL_ACCESS enabled (6 new tests)

Note: Superuser panel endpoints (/v1/superuser/users/<namespace>/quota)
were intentionally NOT changed - these are admin panel functions that should
work with basic superuser permission, consistent with other panel operations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-24 17:13:44 +00:00
Harish Govindarajulu
129ca2ae29 fix(ui): Enable organization/user visibility for read-only superusers (PROJQUAY-6882) (#4545)
* fix(ui): Enable organization/user visibility for read-only superusers (PROJQUAY-6882)

Users listed under GLOBAL_READONLY_SUPER_USERS can now see all
organizations and users in the UI, matching regular superuser visibility
with read-only restrictions on actions.

- Update UseCurrentUser to include global_readonly_super_user in isSuperUser check
- Add Cypress tests for read-only superuser visibility and action restrictions
- Settings column actions correctly hidden via existing canModify permission

* fix(ui): Add global_readonly_super_user field to API responses (PROJQUAY-6882)

- Add global_readonly_super_user field to user API response in endpoints/api/user.py
- Allow read-only superusers to view organization teams in endpoints/api/organization.py
- Allow read-only superusers to view robot permissions in endpoints/api/robot.py

* fix(ui): Prevent read-only superusers from deleting orgs/users

Security fix: Read-only superusers should not be able to delete
orgs or users they don't own, even though they can view them.

* Fix inline import + incorrect assert + add codecov tests

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-20 01:31:59 -06:00
Dave O'Connor
07a44e9716 fix: allow global readonly superusers to access quota limit endpoints (PROJQUAY-9804) (#4567)
This fixes an issue where global readonly superusers were blocked from
accessing organization quota limit endpoints when FEATURE_SUPERUSERS_FULL_ACCESS
was set to false.

Fixed endpoints in endpoints/api/namespacequota.py:
- OrganizationQuotaLimitList.get() - List quota limits
- OrganizationQuotaLimit.get() - Get individual quota limit

Both endpoints now use the consistent permission pattern:
  permission.can() OR
  allow_if_global_readonly_superuser() OR
  allow_if_superuser_with_full_access()

Added comprehensive tests in test_global_readonly_superuser.py:
- test_global_readonly_superuser_can_access_quota_limit_list
- test_global_readonly_superuser_can_access_individual_quota_limit
- test_regular_superuser_cannot_access_quota_limits_without_full_access

Test implementation uses autouse fixture to ensure FEATURE_SUPERUSERS_FULL_ACCESS
is disabled for all tests in the class, following the pattern from
TestOrganizationLogsAccessWithoutFullAccess.

Tests verify:
1. Global readonly superusers CAN access quota limits for auditing,
   regardless of FEATURE_SUPERUSERS_FULL_ACCESS setting
2. Regular superusers are still blocked when FEATURE_SUPERUSERS_FULL_ACCESS
   is false (correct security behavior)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-19 13:25:59 -05:00
Dave O'Connor
fbfd20b2bc fix: allow global readonly superusers to access all organization data without FULL_ACCESS (PROJQUAY-9798) (#4549)
* fix: allow global readonly superusers to access all organization data without FULL_ACCESS (PROJQUAY-9798)

This is a comprehensive fix for multiple endpoints where global readonly superusers
were incorrectly blocked from accessing organization data when
FEATURE_SUPERUSERS_FULL_ACCESS was set to false.

Fixed endpoints in endpoints/api/logs.py:
- OrgLogs.get() - Organization audit logs
- OrgAggregateLogs.get() - Aggregated organization logs
- ExportOrgLogs.post() - Export organization logs

Fixed endpoints in endpoints/api/team.py:
- TeamMemberList.get() - Team member list
- TeamPermissions.get() - Team repository permissions

Fixed endpoints in endpoints/api/organization.py:
- OrganizationMemberList.get() - Organization member list
- OrganizationMember.get() - Individual member details
- OrganizationApplications.get() - OAuth application list
- OrganizationApplication.get() - Individual application details

Fixed endpoints in endpoints/api/prototype.py:
- PermissionPrototypeList.get() - Default permission prototypes

All endpoints now use consistent permission logic:
  permission.can() OR
  allow_if_global_readonly_superuser() OR
  allow_if_superuser_with_full_access()

Added comprehensive tests verifying:
1. Global readonly superusers CAN access all data for auditing, regardless
   of FEATURE_SUPERUSERS_FULL_ACCESS setting
2. Regular superusers are still blocked when FEATURE_SUPERUSERS_FULL_ACCESS
   is false (correct behavior)

* fix(test): ensure owners team exists for testorglogs org in test setup

Addresses review feedback from PR #4549 comment #2539202868.

The test was attempting to access the 'owners' team in 'testorglogs'
org, but the fixture only created the organization without creating
any teams. This could cause the test to receive a 404 (team not found)
instead of 403 (permission denied), making it pass for the wrong reason.

Also simplified the test logic to only expect 403 since the team now
exists in the fixtures, ensuring the test validates permission blocking
rather than missing resources.
2025-11-18 14:57:04 -05:00
Dave O'Connor
2beba31c08 fix: allow global readonly superusers to access org logs without FULL_ACCESS (PROJQUAY-9790) (#4535)
This fixes a bug where global readonly superusers were incorrectly blocked
from accessing organization logs when FEATURE_SUPERUSERS_FULL_ACCESS was
set to false.

Changes:
- Updated OrgLogs.get() to allow global readonly superusers
- Updated OrgAggregateLogs.get() to allow global readonly superusers
- Updated ExportOrgLogs.post() to allow global readonly superusers
- Added comprehensive tests verifying the fix

The fix ensures that:
1. Global readonly superusers can ALWAYS access organization logs for
   auditing purposes, regardless of FEATURE_SUPERUSERS_FULL_ACCESS setting
2. Regular superusers are still blocked from accessing organization logs
   when FEATURE_SUPERUSERS_FULL_ACCESS is false (correct behavior)

All three endpoints now use consistent permission logic:
  permission.can() OR
  allow_if_global_readonly_superuser() OR
  allow_if_superuser_with_full_access()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-18 09:19:35 -05:00
Dave O'Connor
2511b45e89 fix(api): superuser panel access without SUPERUSERS_FULL_ACCESS (PROJQUAY-9693) (#4455)
fix(api): implement proper superuser permission model and fix access controls

Fixes multiple issues with superuser functionality and implements a comprehensive
permission model for FEATURE_SUPERUSERS_FULL_ACCESS:

**Permission Model:**
- Global Readonly Superusers (auditors): Always have read access to all content,
  independent of FEATURE_SUPERUSERS_FULL_ACCESS setting
- Regular Superusers: Can access /v1/superuser endpoints and their own content.
  Require FEATURE_SUPERUSERS_FULL_ACCESS=true for cross-namespace read access
- Full Access Superusers: Regular superusers with FULL_ACCESS enabled, can
  perform CRUD on content they don't own
- Write operations: Only allowed for full access superusers (global readonly
  superusers never get write access)

**Key Fixes:**
1. Fixed superuser panel endpoints returning 403 when FULL_ACCESS was disabled.
   Basic panel operations (user list, logs, org list, messages) now work with
   just FEATURE_SUPER_USERS enabled.

2. Updated decorators to properly differentiate between basic superuser
   operations and permission bypass operations.

3. Implemented license bypass: Superusers with FULL_ACCESS now bypass
   license/quota limits when creating or modifying private repositories.

4. Fixed 18 permission checks across 7 files to properly implement cross-namespace
   access controls for different superuser types.

**Changes:**
- endpoints/api/__init__.py: Fixed allow_if_superuser(), require_repo_permission, and decorators
- endpoints/api/superuser.py: Updated SuperUserAppTokens permission check
- endpoints/api/organization.py: Updated 4 GET endpoints to require FULL_ACCESS
- endpoints/api/namespacequota.py: Updated 2 GET endpoints to require FULL_ACCESS
- endpoints/api/team.py: Updated 2 GET endpoints to require FULL_ACCESS
- endpoints/api/prototype.py: Updated 1 GET endpoint to require FULL_ACCESS
- endpoints/api/policy.py: Updated auto-prune policy endpoints
- endpoints/api/robot.py: Updated robot endpoints
- endpoints/api/build.py: Updated repository build logs
- endpoints/api/repository.py: Added license bypass for superusers with FULL_ACCESS
- endpoints/api/repository_models_pre_oci.py: Updated repository visibility query
- endpoints/api/logs.py: Fixed log access to require FULL_ACCESS for permission bypass
- endpoints/api/test/test_superuser_full_access.py: Added comprehensive test suite
- endpoints/api/test/test_appspecifictoken.py: Updated test mocking and added 403 test
- test/test_api_usage.py: Updated test expectations for license bypass behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 09:38:11 -05:00
Shubhra Deshpande
240d6441ba feat: Add image pull statistics API endpoints and UI integration (PROJQUAY-7176) (#4382)
feat: Add image pull statistics API endpoints and UI integration

- Add new API endpoints for tag and manifest pull statistics
- Integrate pull metrics into web UI with new table columns
- Add FEATURE_IMAGE_PULL_STATS feature flag and PULL_METRICS_REDIS config
- Add pullstatsredisflushworker to supervisord configuration
- Add comprehensive test coverage for pull statistics functionality

Co-authored-by: shudeshp <shudeshp@redhat.com>
2025-10-27 15:19:52 -04:00
Dave O'Connor
d83e2c8647 feat(api v1): global readonly superuser support and app token visibility (PROJQUAY-8279) (#4276)
Implements global read-only superuser permissions for v1 endpoints, adjusts superuser write checks, and updates app token listing and detail endpoints; includes comprehensive tests.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-21 15:00:59 -04:00
Dave O'Connor
d3c0f10e16 test(oidc): add comprehensive PKCE test coverage (PROJQUAY-9281) (#4257)
test(oidc): add comprehensive PKCE test coverage with improved diagnostics (PROJQUAY-9281)

  Add extensive test suite for PKCE (Proof Key for Code Exchange) functionality
  across multiple layers of the application:

  Test Coverage:
  - Core PKCE utilities (code_verifier generation, S256 challenge computation)
  - OAuth base class integration with PKCE parameters
  - OIDC service with PKCE fixtures and authorization scenarios
  - Dedicated PKCE flow testing (S256/plain methods, public client support)
  - API endpoint integration for user PKCE operations
  - Login flow integration with session-based verifier storage

  Features Tested:
  - S256 and plain code challenge methods
  - Public client support (omitting client_secret)
  - Session-based code_verifier storage and retrieval
  - Error handling for missing/invalid verifiers
  - Integration with existing OIDC authorization flows
  - Descriptive assertion messages for CI diagnostics

  All tests include informative error messages with expected vs actual values
  to improve debugging in CI environments.

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

  Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:07:28 -04:00
Dave O'Connor
b9460aa334 feat(oidc): add PKCE (S256/plain) support with session-verifier flow (PROJQUAY-9281) (#4256)
Implement PKCE (Proof Key for Code Exchange) for OIDC authentication to enable
  support for public clients and improve OAuth security.

  Changes:
  - Add oauth/pkce.py with code_verifier generation and S256/plain challenge methods
  - Extend OAuthService to support extra auth/token params and public clients (no client_secret)
  - Implement PKCE in OIDCLoginService with code_verifier token exchange
  - Store PKCE verifier in session during auth initiation (endpoints/api/user.py)
  - Add get_pkce_code_verifier() helper with defensive type checking
    * Encapsulates pkce_enabled check and session data extraction
    * Uses isinstance(data, dict) for safe type validation
    * Centralizes logic across OAuth callbacks (callback, attach, cli)
  - Include example Keycloak PKCE config in local-dev/stack/config.yaml

  Security improvements:
  - PKCE method validation to fail fast on invalid configuration
  - Defensive session data validation in OAuth callbacks
  - Explicit Content-Type headers for form-encoded OAuth requests
  - Optimized non-verified JWT decode (skips unnecessary key fetching)
  - Exponential backoff for token exchange retries (0.5s, 1.0s, 2.0s)

  Configuration:
  - PKCE is opt-in via USE_PKCE config (default: disabled)
  - OIDC_SERVER must end with trailing slash
  - Use host.containers.internal with podman for local dev

  Co-authored-by: Claude <noreply@anthropic.com>
2025-10-01 16:42:25 -04:00
Daniel Messer
a13879f6b6 stripe: apply trial periods for user credit card subscriptions (PROJQUAY-9253) (#4172)
apply trial periods for user credit card subscriptions

Signed-off-by: dmesser <dmesser@redhat.com>
2025-08-18 15:07:36 +02:00
Kenny Lee Sin Cheong
2172c6bd46 api: add missing read permissions for readonly superuser (PROJQUAY-9156) (#4132)
* api: add missing read permissions for readonly superuser

* api: add missing read permissions for readonly superuser
2025-07-23 10:01:20 -04:00
Ivan Bazulic
9be679eb58 mirror: Add job timeout to mirror configurations (PROJQUAY-7249) (#3723)
* mirror: Add job timeout to mirror configurations (PROJQUAY-7249)
Previous global job timeout of 5 minutes was inadequate for big images. The timeout should now be configurable in much the same way as sync is. Minimum job length is 300 seconds/5 minutes.

The PR is still work in progress.

* Fix init db, remove reference to user data in logs

* Fix tests, change repo mirror configuration

* Fix tests, make mirroring cancellable through UI

* Add cancel mirror test, change HTML document to reflect mirror timeout

* Flake8 doesn't like when '==' is used with 'None'

* Fix mirror registry tests

* Add new cypress data to fix cypress tests

* Added ability to define upload chunk size to RADOS driver, small changes to repo mirror HTML page

* Fix database migration to follow HEAD

* Upload new database data for Cypress tests

* Make skopeo_timeout_interval mandatory on API calls

---------

Co-authored-by: Ivan Bazulic <ibazulic@redhat.com>
2025-06-12 19:09:51 +02:00
Syed Ahmed
d674ab54cb db: use iterator chain for _get_user_repo_permissions (PROJQUAY-8839) (#3822)
* db: use iterator chain for _get_user_repo_permissions (PROJQUAY-8839)

Unwrapping can cause increase in CPU. Use iterator chain to let
the caller unwrap
2025-04-29 11:44:31 -04:00
Michaela Lang
8332d99da4 endpoints(v1/superuser/config): adding a full config dump for compliance reasons (PROJQUAY-4559) (#3253)
* initial checkin for the superuser/config endpoint to show how its intended to return data

bug: fixing NaN value error for quota displayed on member org page (PROJQUAY-6465) (#3224)

bug: fixing NaN value error for quota displayed on member org page (PROJQUAY-6465)

fixed black formatting

fixed flake and black formatting

fixed isort formatting

test need to be updated for superuser endpoints. There is no explicit superuser token test so globalreadonlysuperuser shall succeed too

fixed double json encoding

changed naming to comply with other SuperUserClasses, added SuperUserPermission check as scope only isnt sufficient

fixed another black error

fixed response for devtable check

fixed response for devtable as that is a superuser

fixed black format :/

added allow_if_global_readonly_superuser to config endpoint

repush for checks

fixed app.logger to module specific logger ; added missed SCHEMA return

added unittest for checking superuser config dump API call (no clue if the unittests build up a full setup since we mock all kind of stuff in the other calls)

removed env PWD check as it seems to be unset in the github runners

added missing unittest step

added FeatureFlag for config dump

formatting

* removed wrong commit in the branch

* changed from route decorator to in method check and changed unittests to fail as the default config is to deny the request

* added one test for security_tests

* rebumped the security tests
2025-04-28 11:29:58 -05:00
Syed Ahmed
36a552058a db: optimize _get_user_repo_permissions to send to read replica (PROJQUAY-8839) (#3818)
* db: optimize _get_user_repo_permissions to send to read replica (PROJQUAY-8839)

it uses a union query which doesn't invoke the replica selection
logic. Make this into 2 seperate queries

* fix unit tests
2025-04-25 09:36:43 -04:00
Marcus Kok
6720be4b8c billing: stop modifying subscription list that is being iterated over (PROJQUAY-8712) (#3725)
Fixes bug where removing a MW02702 sub after all it's quantities have been bound causes the next item in the subscription list to be skipped over, resulting in a malformed api response for the marketplace endpoint.
2025-03-20 13:23:24 -04:00
Brandon Caton
888bf2eabb api: looking up layer by artifact type (PROJQUAY-8644) (#3701)
Fixes a bug where the annotation is required at the manifest level even if artifactType is present. The modelcard should only be indicated by the artifact type and layer annotation for oci artifacts.
2025-03-06 09:29:48 -05:00
Kenny Lee Sin Cheong
5f8ca041e7 ui: implement change to render modelcard stored in layers (PROJQUAY-8642) (#3692)
* ui: implement change to render modelcard stored in layers (PROJQUAY-8412)

When a manifest has certain annotations or artifactTypes, render the
applicable modelcard markdown in a new tags detail tab.

* removing untar when fetching model card

* removing extra api calls

* Add modelcar check tests

---------

Co-authored-by: bcaton <bcaton@redhat.com>
2025-03-05 19:14:22 +00:00
Ivan Bazulic
4c5b2d50c5 ui: Expand support for customized footer links (PROJQUAY-5648) (#3556)
* ui: Expand support for customized footer links (PROJQUAY-5648)
Previous iteration only allowed changes to the terms of service. With this push, all footer links should be customizable through the `FOOTER_LINKS` object. Example:

~~~
FOOTER_LINKS:
  TERMS_OF_SERVICE_URL: "some_url"
  PRIVACY_POLICY_URL: "some_url"
  SECURITY_URL: "some_url"
  ABOUT_URL: "some_url"
~~~

Missing entries will not be printed out in the UI.

* Fixes to parsing of config object

* Add type annotation
2025-02-07 10:07:55 -05:00
Michaela Lang
5fdb881b0e endpoints(repository): fixing repository return with starred repos to paged response (PROJQUAY-8450) (#3580)
When setting repositories in the Quay UI as starred, a 500 error occurs and renders the UI use-less due to starred queries are not paged.
2025-01-30 11:33:59 -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
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
Marcus Kok
d49db6ab14 api: override flask application function to catch error (PROJQUAY-8026) (#3344)
* override _should_use_fr_error_handler method, change behavior of error handler
2024-10-21 09:26:19 -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
Syed Ahmed
e71b50b992 ui: add entry for robot federation config (PROJQUAY-8050) (#3316)
* ui: add entry for robot federation config (PROJQUAY-8050)

adding entry for showing description in the UI for robot federation config changes
2024-10-15 11:25:36 -04:00
sayalibhavsar
f7560486d8 api: put /superuser/users/<username> will now show up in swagger (PROJQUAY-7579) (#3299)
remove internal-only decorator from PUT request
2024-10-04 20:57:36 +05:30
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
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
deshpandevlab
28d18428bd bug: fixing NaN value error for quota displayed on member org page (PROJQUAY-6465) (#3224)
bug: fixing NaN value error for quota displayed on member org page (PROJQUAY-6465)
2024-09-23 15:49:02 -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
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
Brandon Caton
9523fc1fe7 api: feature flagging global readonly superuser check (PROJQUAY-7550) (#3088)
feature flagging global readonly superuser check
2024-08-05 09:34:45 -04:00
Brandon Caton
ec64325edd api: adding global readonly user to list repo endpoint (PROJQUAY-7446) (#3072)
Adding global readonly user to list repo endpoint.
2024-07-25 11:18:34 -04:00
Brandon Caton
b78a746426 api: adding token to global readonly user list robots (PROJQUAY-7177) (#3073)
Adding robot token to response for global readonly superuser.
2024-07-25 10:06:15 -04:00
Brandon Caton
9dc83f26cc api: adding global readonly superuser to superuser endpoints (PROJQUAY-7449) (#3070)
Giving global readonly superuser permissions to superuser endpoints.
2024-07-24 11:27:57 -04:00
Brandon Caton
cad8326d4a api: adding permissions for global readonly superuser (PROJQUAY-7177) (#2993)
The global readonly superuser is missing read only permissions on certain GET api's. This adds those permissions.
2024-07-09 13:17:26 -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
e4f05583c1 oauth: allowing to assign token to user (PROJQUAY-7074) (#2869)
Allow organization administrators to assign Oauth token to another user.
2024-06-25 09:23:51 -04:00