Android cert SAN frontend#44809
Conversation
- End-to-end implementation for `subject_alternative_name` in certificate templates. - Includes schema migration, variable expansion, frontend UI updates, GitOps support, and Android agent integration. - Limits SAN types to `DNS`, `EMAIL`, `UPN`, `IP`, and `URI`.
- Updated schema to use `TEXT` for `subject_alternative_name`, matching existing
Adds the optional subject_alternative_name field end to end on the server side: REST API request and response, persistence, GitOps apply and generate-gitops emit, per-host variable expansion, lightweight server-side validation, and Premium gating. The Android agent and frontend ship in separate PRs (per the OpenSpec migration plan). Changes: - Type changes on CertificateTemplate, CertificateRequestSpec, CertificateTemplateSpec and the response structs. - Migration adds a nullable TEXT column to certificate_templates, matching subject_name. schema.sql updated. - Datastore CRUD reads via COALESCE so absent SAN deserialises to ""; writes normalise whitespace-only input to NULL while preserving non-empty values verbatim for GitOps idempotency. - Service layer validates token shape, KEY allow-list (DNS, EMAIL, UPN, IP, URI), variable allow-list, and length cap (4096 bytes); rejects with BadRequestError. Premium check fires only on SAN-bearing payloads. - GetDeviceCertificateTemplate expands $FLEET_VAR_HOST_* in SAN with the same failure semantics as subject_name. - generate-gitops emits subject_alternative_name when non-empty; the fleetctl client propagates SAN through GitOps apply, including detecting SAN changes for re-creation. - Unit tests cover validation table, Premium gating, format failures, and variable allow-list. The generate-gitops compareDirs test now round-trips a SAN-bearing template. OpenSpec: openspec/changes/android-cert-san-attributes/
Verifies the end-to-end path that the Android Fleet agent will exercise: the fleetd certificate API expands $FLEET_VAR_HOST_END_USER_IDP_USERNAME inside both subject_name and subject_alternative_name when the host has an associated IdP account, and returns the rendered template ready for the agent to wrap in a CSR.
…ogic. - Added stricter validation for `subject_alternative_name`, including disallowing empty values, separator-only inputs, and malformed tokens. - Updated schema to enforce UTF-8 compliance for `subject_alternative_name` field. - Clarified Premium gating behavior for SAN-bearing templates. - Fixed propagation of challenges when setting cert status to "failed." - Aligned validation checks and migrations with spec updates.
# Conflicts: # server/service/integration_enterprise_test.go
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
/agentic_review |
Code Review by Qodo
1.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #44809 +/- ##
==========================================
+ Coverage 66.66% 66.70% +0.04%
==========================================
Files 2672 2673 +1
Lines 214700 215049 +349
Branches 9946 9800 -146
==========================================
+ Hits 143137 143458 +321
- Misses 58540 58563 +23
- Partials 13023 13028 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds frontend support for Android certificate template SANs in the Manage Controls certificates flow, aligning the UI with the backend/API support for subject_alternative_name.
Changes:
- Adds an optional SAN textarea to the Add certificate modal and sends SAN data in certificate create requests.
- Refactors modal validation so required-field errors appear inline after submit attempts and SAN-specific 422 errors render on the SAN field.
- Expands modal tests and marks the related OpenSpec frontend tasks complete.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
openspec/changes/android-cert-san-attributes/tasks.md |
Marks the frontend OpenSpec tasks as completed with implementation notes. |
frontend/services/entities/certificates.ts |
Extends certificate types and POST payload construction to include SAN. |
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertificateModal/helpers.ts |
Adds SAN validation plus required-field messages and submit-attempt-aware validation behavior. |
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertificateModal/AddCertificateModal.tsx |
Adds the SAN field, SAN server-error handling, and the always-enabled submit pattern. |
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertificateModal/AddCertificateModal.tests.tsx |
Adds SAN and validation-focused Jest coverage for the modal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
WalkthroughThis PR adds Subject Alternative Name (SAN) field support to the AddCertificateModal component for Android certificate management. Changes include adding a SAN input field with client-side and server-side validation, extending form data interfaces to include the SAN property, implementing validation gating with an attemptedSubmit flag, handling SAN-specific server errors, and comprehensive test coverage for new functionality including placeholder presence, validation errors, length limits, and full submission flows. Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
# Conflicts: # server/datastore/mysql/schema.sql # server/service/certificates.go # server/service/client.go # server/service/integration_enterprise_test.go
Related issue: Resolves #41472
Checklist for submitter
SELECT *is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.Testing
Summary by CodeRabbit
New Features
Tests