Skip to content

feat: DMS: add certificate Issuance Profile support#276

Merged
haritzsaiz merged 6 commits intomainfrom
feat/dms-issuance-profile
Jul 2, 2025
Merged

feat: DMS: add certificate Issuance Profile support#276
haritzsaiz merged 6 commits intomainfrom
feat/dms-issuance-profile

Conversation

@jgalipienzo
Copy link
Contributor

@jgalipienzo jgalipienzo commented Jun 27, 2025

This PR introduces support for configurable issuance profiles on a per-DMS basis, providing greater flexibility and control over device certificate management.

Closes #274

New functionality:

  • Added a new IssuanceProfile field to the DMS settings struct.
  • Updated the DMS create/update logic to check if the supplied issuance's profile validity doesn't exceed enrollment CA's limits.
  • Updated the enroll and reenroll logic to use the IssuanceProfile from the DMS configuration, defaulting to the enrollment CA's issuance profile when not provided at the DMS.

This feature enables fine-grained control over certificate issuance policies for each DMS.

@codecov
Copy link

codecov bot commented Jun 27, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 45.81%. Comparing base (7c4cb0e) to head (5be2ab6).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
backend/pkg/controllers/dmsmanager.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
- Coverage   45.82%   45.81%   -0.01%     
==========================================
  Files         128      128              
  Lines        8570     8569       -1     
==========================================
- Hits         3927     3926       -1     
  Misses       4307     4307              
  Partials      336      336              
Flag Coverage Δ
backend 59.11% <50.00%> (-0.01%) ⬇️
connector-awsiot 4.91% <ø> (ø)
core 61.97% <ø> (ø)
monolithic 0.00% <ø> (ø)
sdk 0.00% <ø> (ø)
shared-http 7.07% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jgalipienzo jgalipienzo changed the title feat: DMS: use Issuance Profile from DMS during enroll and reenroll feat: DMS: add Issuance Profile support to DMS Jun 27, 2025
@jgalipienzo jgalipienzo added the enhancement New feature or request label Jun 27, 2025
@jgalipienzo jgalipienzo marked this pull request as ready for review June 27, 2025 14:35
@jgalipienzo jgalipienzo force-pushed the feat/dms-issuance-profile branch from a85a413 to 42aec29 Compare June 27, 2025 14:36
@jgalipienzo jgalipienzo requested a review from jjrodrig June 27, 2025 15:02
@jgalipienzo jgalipienzo marked this pull request as draft June 27, 2025 16:07
@jgalipienzo jgalipienzo removed the request for review from jjrodrig June 27, 2025 16:07
@jgalipienzo jgalipienzo force-pushed the feat/dms-issuance-profile branch from 7f62113 to 5be2ab6 Compare June 30, 2025 16:12
@sonarqubecloud
Copy link

@jgalipienzo jgalipienzo changed the title feat: DMS: add Issuance Profile support to DMS feat: DMS: add certificate Issuance Profile support Jun 30, 2025
@jgalipienzo jgalipienzo marked this pull request as ready for review June 30, 2025 16:28
@jgalipienzo jgalipienzo requested a review from jjrodrig June 30, 2025 16:28
@jjrodrig jjrodrig requested a review from Copilot July 1, 2025 06:01
Copy link
Contributor

Copilot AI left a 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 configurable certificate issuance profiles to the DMS, enhancing control over device certificate management.

  • Introduces a new IssuanceProfile field in DMS settings with associated validation and default assignment logic.
  • Updates create, update, enroll, and reenroll operations to validate the issuance profile against the enrollment CA’s certificate.
  • Adds new error definitions and test cases to capture invalid issuance profile scenarios.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
core/pkg/models/dms.go Added a new IssuanceProfile field to the DMS settings struct
core/pkg/errs/dms.go Added new error ErrDMSIssuanceProfile for issuance profile validation failures
backend/pkg/x509engines/x509engine.go Updated error message wording for certificate expiration checks
backend/pkg/services/dmsmanager.go Integrated issuance profile validation and default assignment in DMS operations
backend/pkg/controllers/dmsmanager.go Adjusted HTTP error responses to use consistent JSON formatting
backend/pkg/assemblers/dms-manager_test.go Added tests covering invalid issuance profile scenarios
Comments suppressed due to low confidence (1)

core/pkg/errs/dms.go:8

  • [nitpick] Standardize the error message wording for issuance profile validation so that it matches the log messages produced in the validation function; this will help reduce ambiguity when troubleshooting.
	ErrDMSIssuanceProfile error = errors.New("DMS certificate expiration exceeds that of the enrollment CA")

@lamassuiot lamassuiot deleted a comment from Copilot AI Jul 1, 2025
@haritzsaiz haritzsaiz merged commit 75da76a into main Jul 2, 2025
37 checks passed
@haritzsaiz haritzsaiz deleted the feat/dms-issuance-profile branch July 2, 2025 08:32
haritzsaiz pushed a commit that referenced this pull request Jul 15, 2025
* feat: use Issuance Profile definition from DMS during enroll and reenroll

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add/update tests to cover the new configuration

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: provide enrollment CA's IssuanceProfile as default

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add test for default issuance profile

Signed-off-by: Jon Galipienzo <[email protected]>

* test: fix tests

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: validate issuance profile on create/update

Signed-off-by: Jon Galipienzo <[email protected]>

---------

Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz <haritzsaiz>
haritzsaiz pushed a commit that referenced this pull request Jul 15, 2025
* feat: use Issuance Profile definition from DMS during enroll and reenroll

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add/update tests to cover the new configuration

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: provide enrollment CA's IssuanceProfile as default

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add test for default issuance profile

Signed-off-by: Jon Galipienzo <[email protected]>

* test: fix tests

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: validate issuance profile on create/update

Signed-off-by: Jon Galipienzo <[email protected]>

---------

Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz <haritzsaiz>
haritzsaiz added a commit that referenced this pull request Jul 15, 2025
…d with colons (#279)

* fix crl urls

Signed-off-by: Haritz <haritzsaiz>

* fix tests

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix SubjectKeyIDs

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix crl

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix import tests

Signed-off-by: Haritz <haritzsaiz>

* fix va role fetching

Signed-off-by: Haritz <haritzsaiz>

* chore: Bump dependencies (#278)

Signed-off-by: Juan Jose Rodriguez <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* feat: DMS: add certificate Issuance Profile support (#276)

* feat: use Issuance Profile definition from DMS during enroll and reenroll

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add/update tests to cover the new configuration

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: provide enrollment CA's IssuanceProfile as default

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add test for default issuance profile

Signed-off-by: Jon Galipienzo <[email protected]>

* test: fix tests

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: validate issuance profile on create/update

Signed-off-by: Jon Galipienzo <[email protected]>

---------

Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* feat: va: Remove get roles (#280)

Remove get roles

Signed-off-by: Haritz <haritzsaiz>
Co-authored-by: Haritz <haritzsaiz>
Signed-off-by: Haritz <haritzsaiz>

* chore: monolithic: add labels and standard ports in docker containers (#281)

add labels and standard ports

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

---------

Signed-off-by: Haritz <haritzsaiz>
Signed-off-by: haritz <[email protected]>
Signed-off-by: Juan Jose Rodriguez <[email protected]>
Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz S. Sierra <[email protected]>
Co-authored-by: Haritz <haritzsaiz>
Co-authored-by: Juanjo Rodriguez <[email protected]>
Co-authored-by: Jon Galipienzo <[email protected]>
haritzsaiz added a commit that referenced this pull request Sep 2, 2025
…d with colons (#279)

* fix crl urls

Signed-off-by: Haritz <haritzsaiz>

* fix tests

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix SubjectKeyIDs

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix crl

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix import tests

Signed-off-by: Haritz <haritzsaiz>

* fix va role fetching

Signed-off-by: Haritz <haritzsaiz>

* chore: Bump dependencies (#278)

Signed-off-by: Juan Jose Rodriguez <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* feat: DMS: add certificate Issuance Profile support (#276)

* feat: use Issuance Profile definition from DMS during enroll and reenroll

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add/update tests to cover the new configuration

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: provide enrollment CA's IssuanceProfile as default

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add test for default issuance profile

Signed-off-by: Jon Galipienzo <[email protected]>

* test: fix tests

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: validate issuance profile on create/update

Signed-off-by: Jon Galipienzo <[email protected]>

---------

Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* feat: va: Remove get roles (#280)

Remove get roles

Signed-off-by: Haritz <haritzsaiz>
Co-authored-by: Haritz <haritzsaiz>
Signed-off-by: Haritz <haritzsaiz>

* chore: monolithic: add labels and standard ports in docker containers (#281)

add labels and standard ports

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

---------

Signed-off-by: Haritz <haritzsaiz>
Signed-off-by: haritz <[email protected]>
Signed-off-by: Juan Jose Rodriguez <[email protected]>
Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz S. Sierra <[email protected]>
Co-authored-by: Haritz <haritzsaiz>
Co-authored-by: Juanjo Rodriguez <[email protected]>
Co-authored-by: Jon Galipienzo <[email protected]>
Signed-off-by: haritz <[email protected]>
haritzsaiz added a commit that referenced this pull request Sep 2, 2025
…d with colons (#279)

* fix crl urls

Signed-off-by: Haritz <haritzsaiz>

* fix tests

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix SubjectKeyIDs

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix crl

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix import tests

Signed-off-by: Haritz <haritzsaiz>

* fix va role fetching

Signed-off-by: Haritz <haritzsaiz>

* chore: Bump dependencies (#278)

Signed-off-by: Juan Jose Rodriguez <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* feat: DMS: add certificate Issuance Profile support (#276)

* feat: use Issuance Profile definition from DMS during enroll and reenroll

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add/update tests to cover the new configuration

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: provide enrollment CA's IssuanceProfile as default

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add test for default issuance profile

Signed-off-by: Jon Galipienzo <[email protected]>

* test: fix tests

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: validate issuance profile on create/update

Signed-off-by: Jon Galipienzo <[email protected]>

---------

Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* feat: va: Remove get roles (#280)

Remove get roles

Signed-off-by: Haritz <haritzsaiz>
Co-authored-by: Haritz <haritzsaiz>
Signed-off-by: Haritz <haritzsaiz>

* chore: monolithic: add labels and standard ports in docker containers (#281)

add labels and standard ports

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

---------

Signed-off-by: Haritz <haritzsaiz>
Signed-off-by: haritz <[email protected]>
Signed-off-by: Juan Jose Rodriguez <[email protected]>
Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz S. Sierra <[email protected]>
Co-authored-by: Haritz <haritzsaiz>
Co-authored-by: Juanjo Rodriguez <[email protected]>
Co-authored-by: Jon Galipienzo <[email protected]>
Signed-off-by: haritz <[email protected]>
haritzsaiz added a commit that referenced this pull request Sep 2, 2025
…d with colons (#279)

* fix crl urls

Signed-off-by: Haritz <haritzsaiz>

* fix tests

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix SubjectKeyIDs

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix crl

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* fix import tests

Signed-off-by: Haritz <haritzsaiz>

* fix va role fetching

Signed-off-by: Haritz <haritzsaiz>

* chore: Bump dependencies (#278)

Signed-off-by: Juan Jose Rodriguez <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* feat: DMS: add certificate Issuance Profile support (#276)

* feat: use Issuance Profile definition from DMS during enroll and reenroll

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add/update tests to cover the new configuration

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: provide enrollment CA's IssuanceProfile as default

Signed-off-by: Jon Galipienzo <[email protected]>

* test: add test for default issuance profile

Signed-off-by: Jon Galipienzo <[email protected]>

* test: fix tests

Signed-off-by: Jon Galipienzo <[email protected]>

* feat: validate issuance profile on create/update

Signed-off-by: Jon Galipienzo <[email protected]>

---------

Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

* feat: va: Remove get roles (#280)

Remove get roles

Signed-off-by: Haritz <haritzsaiz>
Co-authored-by: Haritz <haritzsaiz>
Signed-off-by: Haritz <haritzsaiz>

* chore: monolithic: add labels and standard ports in docker containers (#281)

add labels and standard ports

Signed-off-by: haritz <[email protected]>
Signed-off-by: Haritz <haritzsaiz>

---------

Signed-off-by: Haritz <haritzsaiz>
Signed-off-by: haritz <[email protected]>
Signed-off-by: Juan Jose Rodriguez <[email protected]>
Signed-off-by: Jon Galipienzo <[email protected]>
Signed-off-by: Haritz S. Sierra <[email protected]>
Co-authored-by: Haritz <haritzsaiz>
Co-authored-by: Juanjo Rodriguez <[email protected]>
Co-authored-by: Jon Galipienzo <[email protected]>
Signed-off-by: haritz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Issuance Profile definition from DMS during enroll and reenroll

4 participants