Skip to content

validating certificate template subjectname fleet vars - #36377

Merged
ksykulev merged 7 commits into
mainfrom
36289-subjectname-validation
Dec 2, 2025
Merged

validating certificate template subjectname fleet vars#36377
ksykulev merged 7 commits into
mainfrom
36289-subjectname-validation

Conversation

@ksykulev

@ksykulev ksykulev commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

Related issue: Resolves #36289

Testing

  • Added/updated automated tests
  • QA'd all new/changed functionality manually

@codecov

codecov Bot commented Nov 26, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.10256% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.00%. Comparing base (300c263) to head (0b0cd03).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
server/service/certificate_templates.go 77.77% 3 Missing and 3 partials ⚠️
server/service/client.go 0.00% 3 Missing and 1 partial ⚠️
server/datastore/mysql/teams.go 50.00% 1 Missing and 1 partial ⚠️
server/service/certificates.go 50.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #36377    +/-   ##
========================================
  Coverage   65.99%   66.00%            
========================================
  Files        2136     2134     -2     
  Lines      182057   181875   -182     
  Branches     7594     7540    -54     
========================================
- Hits       120155   120041   -114     
+ Misses      50913    50840    -73     
- Partials    10989    10994     +5     
Flag Coverage Δ
backend 67.58% <64.10%> (-0.01%) ⬇️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread server/service/certificate_templates.go Outdated

func validateCertificateTemplateFleetVariables(subjectName string) error {
// reject any variable that doesn't use the FLEET_VAR_ prefix.
re := regexp.MustCompile(`\$(?:\{)?([A-Za-z_][A-Za-z0-9_]*)\}?`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something here, but isn't a similar pattern matching logic already implemented into variables.Find(...)? Why is this required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I did not realize variables.Find already did this! Great! thank you.

juan-fdz-hawa
juan-fdz-hawa previously approved these changes Dec 1, 2025

@juan-fdz-hawa juan-fdz-hawa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed tests seem not to be related to the PR

@ksykulev
ksykulev merged commit f049496 into main Dec 2, 2025
45 checks passed
@ksykulev
ksykulev deleted the 36289-subjectname-validation branch December 2, 2025 01:10
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.

android certificate gitops: validate FLEET_VAR_*

2 participants