Skip to content

fix(react): add .cer and .crt certificate extension support to SAMLP provider - #435

Open
rax7389 wants to merge 6 commits into
mainfrom
fix/samlp-file-upload-crt
Open

fix(react): add .cer and .crt certificate extension support to SAMLP provider#435
rax7389 wants to merge 6 commits into
mainfrom
fix/samlp-file-upload-crt

Conversation

@rax7389

@rax7389 rax7389 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Add support for .cer and .crt certificate file extensions to the SAMLP SSO provider configuration form, aligning it with PingFederate provider and the API specification.

Why

The SAMLP provider form only accepted .pem files for signing certificates, while:

  • The API spec documents support for "PEM or CER" encoded certificates
  • PingFederate provider already accepts .pem, .cer, and .crt files
  • Users with certificates from Windows systems commonly have .cer files

This inconsistency caused confusion and required users to manually rename their certificate files.

What

  • Created shared ALLOWED_CERT_EXTENSIONS constant (['.pem', '.cer', '.crt']) in a new constants file
  • Updated SAMLP form to use the shared constant instead of hardcoded .pem
  • Refactored PingFederate form to use the same shared constant

Packages

  • packages/core
  • packages/react
  • examples

References

  • API spec confirms certificate fields accept "PEM or CER" encoded content
  • .cer and .crt are functionally equivalent certificate extensions (naming convention differs between Windows/Linux)

Testing

  • This change adds unit test coverage
  • Tested for both SPA and RWA flows, all example apps working
  • All existing and new tests complete without errors

Checklist

  • Breaking change
  • Requires docs update
  • Backward compatible

Contributing

Summary by CodeRabbit

  • Bug Fixes
    • Certificate uploads now consistently accept supported .pem, .cer, and .crt file types across SSO configuration forms.
    • Updated file selection validation to allow all approved certificate extensions.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@rax7389, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: efba00cc-5692-4f59-807e-17a3fe3cb3bb

📥 Commits

Reviewing files that changed from the base of the PR and between 6ffb7e4 and 867d7e4.

📒 Files selected for processing (7)
  • packages/core/src/schemas/my-organization/idp-management/sso-provider/__tests__/sso-provider-create-schema.test.ts
  • packages/core/src/schemas/my-organization/idp-management/sso-provider/sso-provider-create-schema-types.ts
  • packages/core/src/schemas/my-organization/idp-management/sso-provider/sso-provider-create-schema.ts
  • packages/core/src/services/my-organization/idp-management/sso-provider/__tests__/sso-provider-mappers.test.ts
  • packages/core/src/services/my-organization/idp-management/sso-provider/sso-provider-mappers.ts
  • packages/react/src/components/auth0/my-organization/shared/idp-management/sso-provider-create/provider-configure/ping-federate-sso-configure-form.tsx
  • packages/react/src/components/auth0/my-organization/shared/idp-management/sso-provider-create/provider-configure/samlp-sso-configure-form.tsx
📝 Walkthrough

Walkthrough

Changes

Certificate extension centralization

Layer / File(s) Summary
Shared certificate extension constant
packages/react/src/lib/constants/my-organization/idp-management/idp-management-constants.ts
Exports the read-only .pem, .cer, and .crt certificate extension list.
SSO form integration
packages/react/src/components/auth0/my-organization/shared/idp-management/sso-provider-create/provider-configure/*-sso-configure-form.tsx
Uses the shared extension list in Ping Federate and SAML certificate upload configuration, replacing local or hard-coded values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: refactor

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding .cer and .crt certificate extension support for the SAMLP provider.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/samlp-file-upload-crt

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
packages/react/src/lib/constants/my-organization/idp-management/idp-management-constants.ts (1)

7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid the unnecessary type assertion.

Line 7 uses as const, but the repository guidelines prohibit type assertions when alternatives exist. Use Object.freeze(...) or an explicit readonly type instead. As per coding guidelines, avoid type assertions (as) unless there is no other option.

Proposed fix
-export const ALLOWED_CERT_EXTENSIONS = ['.pem', '.cer', '.crt'] as const;
+export const ALLOWED_CERT_EXTENSIONS = Object.freeze(['.pem', '.cer', '.crt']);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/react/src/lib/constants/my-organization/idp-management/idp-management-constants.ts`
at line 7, Update the ALLOWED_CERT_EXTENSIONS constant to remove the unnecessary
as const assertion, using Object.freeze or an explicit readonly type while
preserving the existing immutable tuple values.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@packages/react/src/lib/constants/my-organization/idp-management/idp-management-constants.ts`:
- Line 7: Update the ALLOWED_CERT_EXTENSIONS constant to remove the unnecessary
as const assertion, using Object.freeze or an explicit readonly type while
preserving the existing immutable tuple values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: efe42b5e-4031-4cea-9f11-bf32744f8368

📥 Commits

Reviewing files that changed from the base of the PR and between d8e1c0b and 6ffb7e4.

📒 Files selected for processing (3)
  • packages/react/src/components/auth0/my-organization/shared/idp-management/sso-provider-create/provider-configure/ping-federate-sso-configure-form.tsx
  • packages/react/src/components/auth0/my-organization/shared/idp-management/sso-provider-create/provider-configure/samlp-sso-configure-form.tsx
  • packages/react/src/lib/constants/my-organization/idp-management/idp-management-constants.ts

@codecov-commenter

codecov-commenter commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.19048% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.83%. Comparing base (49bd1ec) to head (867d7e4).

Files with missing lines Patch % Lines
...dp-management/sso-provider/sso-provider-mappers.ts 70.37% 8 Missing ⚠️
...te/provider-configure/samlp-sso-configure-form.tsx 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #435      +/-   ##
==========================================
- Coverage   90.86%   90.83%   -0.03%     
==========================================
  Files         239      240       +1     
  Lines       17620    17653      +33     
  Branches     2467     1991     -476     
==========================================
+ Hits        16010    16035      +25     
- Misses       1610     1618       +8     

☔ View full report in Codecov by Harness.
📢 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.

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.

2 participants