Skip to content

Add support for new registry/org and registry/user endpoints#117

Open
jgamblin wants to merge 2 commits intoRedHatProductSecurity:masterfrom
jgamblin:add-registry-endpoints
Open

Add support for new registry/org and registry/user endpoints#117
jgamblin wants to merge 2 commits intoRedHatProductSecurity:masterfrom
jgamblin:add-registry-endpoints

Conversation

@jgamblin
Copy link
Copy Markdown

Summary

This PR implements support for the new CVE Services User Registry endpoints (/registry/org/ and /registry/user/) while maintaining full backward compatibility with the legacy endpoints (/org/ and /user/).

Changes

API Implementation

  • Added use_legacy_endpoints parameter to CveApi.__init__() to control endpoint selection
  • Implemented helper methods:
    • _org_path() - Builds organization endpoint paths (registry or legacy)
    • _user_path() - Builds user endpoint paths (registry or legacy)
  • Updated all org/user methods to use new registry endpoints by default:
    • quota()
    • show_user()
    • reset_api_key()
    • create_user()
    • update_user()
    • list_users()
    • show_org()

CLI Support

  • Added --legacy flag to CLI for easy switching to legacy endpoints
  • Updated Config class to handle the legacy flag and pass it to CveApi

Backward Compatibility

  • All existing code continues to work without changes (registry endpoints used by default)
  • Users can opt-in to legacy endpoints using the --legacy flag
  • Both endpoint modes fully tested and validated

Testing

  • Added TestRegistryEndpoints class with 12 comprehensive tests
  • Tests verify correct endpoint selection for both registry and legacy modes
  • All endpoints tested:
    • Organization quota
    • User CRUD operations
    • User API key reset
    • Organization info
  • All 49 tests pass (37 existing + 12 new)

Usage

Using new registry endpoints (default):

cve -u username -o org -a api_key org
cve -u username -o org -a api_key user show jane@example.com

Using legacy endpoints:

cve -u username -o org -a api_key --legacy org
cve -u username -o org -a api_key --legacy user show jane@example.com

Programmatic usage:

# Using new registry endpoints
cve_api = CveApi(username="user", org="org", api_key="key")

# Using legacy endpoints
cve_api = CveApi(username="user", org="org", api_key="key", use_legacy_endpoints=True)

Resolves

Closes #112 - Add new registry/user and registry/org CVE Services endpoints

- Download and integrate CVE Schema 5.2.0 bundled schema file
- Extract container-specific schemas for ADP, CNA published, and CNA rejected
- Update README compatibility statement to note 5.2.0 support
- All existing tests pass with new schema
- Add use_legacy_endpoints parameter to CveApi class
- Implement helper methods (_org_path, _user_path) to build correct endpoint paths
- Update quota(), show_user(), reset_api_key(), create_user(), update_user(), list_users(), and show_org() methods to use new registry endpoints by default
- Maintain full backward compatibility with legacy org/user endpoints via --legacy flag
- Add --legacy flag to CLI for easy switching to legacy endpoints
- Add 12 comprehensive tests covering both registry and legacy endpoint modes
- All 49 tests pass successfully
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new regsitry/user and registry/org CVE Services endpoints

1 participant