Skip to content

Add FIDO2 Registration using P/Invoke#607

Open
johannesconsulting wants to merge 4 commits intopspete:devfrom
johannesconsulting:feature/register-pasfido2device
Open

Add FIDO2 Registration using P/Invoke#607
johannesconsulting wants to merge 4 commits intopspete:devfrom
johannesconsulting:feature/register-pasfido2device

Conversation

@johannesconsulting
Copy link
Copy Markdown
Contributor

Description

This was created with the help of AI

Added support for FIDO Registration. This would allow admins to automate the FIDO registration for users.
This is built on top of #606, so we are not using any third party DLL files.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that makes existing functionality work differently)
  • Documentation update (psPAS website or command help content)
  • Other (see description)

How Has This Been Tested?

  • Pester test(s) update required
  • Pester test(s) updated
  • Pester test(s) passing

Test Configuration:

  • PowerShell version: 7
  • CyberArk PAS version: 15.0
  • OS Version: Windows Server 2022

Checklist:

  • My code follows the style guidelines of this project
  • I have followed the contributing guidelines.
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new test failures or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have opened & linked a related issue
  • I have linked a related issue

- Implemented Invoke-FIDO2Authentication function for FIDO2 authentication flow.
- Added ConvertFrom-Base64UrlString function for Base64Url decoding.
- Created tests for New-PASSession and ConvertFrom-Base64UrlString.
- Updated documentation for New-PASSession to include new parameters.
- Added DSInternals.Win32.WebAuthn.dll and its license.
- Remove duplicated Base64Url encoding via a small helper scriptblock
- Consolidate LogonRequest passthrough params into a single hashtable
- Drop redundant try/catch wrappers that only re-prefix error messages
- Remove unused SuppressMessage attribute and obvious step-by-step comments
- Use ContainsKey() and tidy whitespace
…hn.dll

- Drop third-party DLL (and its license file); use the Windows built-in webauthn.dll via P/Invoke through Add-Type inline C#.
- Remove unused $Script:ModuleRoot from psPAS.psm1 (only needed for the DLL path lookup).
- Manually marshal client data / credential list / assertion structs, and free all allocations + WebAuthNFreeAssertion in a finally block.
- Use the credential ID actually returned by the authenticator (assertion.Credential.pbId) rather than �llowCredentials[0].Id.
Adds support for registering new FIDO2 devices via the CyberArk PAM-SH FIDO2 device management API.

Two parameter sets:

  Default     - Admin flow against /api/fido2/registrationOptions + /api/fido2/registration (optional -UserId)

  OwnDevice   - Self-service flow against /api/fido2/selfRegistrationOptions + /api/fido2/selfRegistration

Performs the WebAuthn MakeCredential ceremony locally via webauthn.dll using a self-contained P/Invoke wrapper (Invoke-FIDO2MakeCredential), mirroring the existing Invoke-FIDO2Authentication helper.

Requires Windows 10 1903+ for the WebAuthn ceremony and CyberArk 14.6+.
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.

1 participant