-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Secret Management API specification (OpenAPI 3.1) #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add 5 Secret CRUD endpoints (list, create, view, update, delete) - Add 3 Secret Sharing endpoints (list shares, grant, revoke) - Define Secret schema with encrypted fields (title, username, password, url, notes) - Define SecretShare schema with permission hierarchy (read/write/admin) - Document XOR constraint (user OR role, not both) - Add validation rules (field lengths, required fields, enums) - Add comprehensive error responses (400, 401, 403, 404, 422) - Support pagination for list endpoints - Require JWT Bearer authentication Implements OpenAPI spec for SecPal/api PRs #183, #185 (Phase 3) Part of: SecPal/api#173 (Secret Management System Epic) BREAKING CHANGE: none (new endpoints only) Signed-off-by: Holger Schmermbeck <holger@secpal.app>
π‘ Tip: Consider Using Draft PRsBenefits of opening PRs as drafts initially:
How to convert:
This is just a friendly reminder - feel free to continue as is! π |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a complete OpenAPI 3.1 specification for the Secret Management API, providing 8 new endpoints for CRUD operations and sharing functionality. The specification documents encrypted secret storage with fields for credentials, tags, versioning, and expiration, along with a permission-based sharing system supporting user and role-based access control.
Key additions include:
- 5 Secret CRUD endpoints with encrypted field support and versioning
- 3 Secret Sharing endpoints with XOR constraint (user OR role) and permission hierarchy (read/write/admin)
- Comprehensive validation rules, error responses, and detailed examples for all endpoints
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| docs/openapi.yaml | Adds Secret and SecretShare schemas with complete CRUD and sharing endpoint definitions, including authentication, pagination, validation rules, and error responses (400, 401, 403, 404, 422) |
| CHANGELOG.md | Documents the addition of Secret Management API specification with details on endpoints, schemas, validation rules, XOR constraints, and permission hierarchy |
- Fix CHANGELOG path params: {id}β{secret}, {shareId}β{share}
- Change terminology: (plaintext)β(decrypted) for consistency with SecretAttachment
- Clarify pagination policy: offset-based for most endpoints, cursor-based for large datasets
- Add 500 InternalServerError response to all 8 Secret endpoints (Checklist 3: Error Coverage)
Addresses all 4 Copilot review comments:
1. β
CHANGELOG path mismatch (comment #2532229630)
2. β
Missing 500 responses (comment #2532229636)
3. β
Terminology consistency (comment #2532229639)
4. β
Pagination policy clarity (comment #2532229643)
π Overview
Implements the complete OpenAPI 3.1 specification for Secret Management API (CRUD + Sharing), unblocking Frontend development for file upload integration and PWA features.
β¨ What This PR Does
Secret CRUD Endpoints (5 total)
GET /v1/secrets- List user's secrets with paginationPOST /v1/secrets- Create new secret with encrypted fieldsGET /v1/secrets/{id}- View secret detailsPATCH /v1/secrets/{id}- Update secret (version auto-incremented)DELETE /v1/secrets/{id}- Soft delete secretSecret Sharing Endpoints (3 total)
GET /v1/secrets/{id}/shares- List all shares for a secretPOST /v1/secrets/{id}/shares- Grant read/write/admin accessDELETE /v1/secrets/{id}/shares/{shareId}- Revoke accessπ Key Features Documented
Schemas
Secret: Encrypted fields (title, username, password, url, notes), tags, expiration, versioningSecretShare: User/role sharing with permission hierarchyPermission Hierarchy
XOR Constraint
Share with user OR role (not both):
Validation Rules
title: Required, max 255 charsusername,password,url,notes: Optional, with max lengthstags: Array of strings (max 50 chars each)expires_at: Must be future datepermission: Enum (read,write,admin)Error Responses
π¦ Files Changed
docs/openapi.yaml- Added 8 new endpoints + 2 schemas (~593 lines)CHANGELOG.md- Documented new API specificationβ Quality Gates
π― Unblocks
Frontend Issues (can now start):
Backend PRs (already merged, this documents them):
π Related
π« Breaking Changes
None - These are all new endpoints. Existing API endpoints unchanged.
π Checklist
Estimated Impact: Unblocks 3 Frontend issues + documents 2 merged Backend PRs
Spec Coverage: 8 endpoints, 2 schemas, 5 error types, permission hierarchy, XOR constraint