Skip to content

feat(pedm): add version check API and signature check API#1343

Merged
Richard Markiewicz (thenextman) merged 2 commits into
masterfrom
pedm-about-version-and-force-signing
May 16, 2025
Merged

feat(pedm): add version check API and signature check API#1343
Richard Markiewicz (thenextman) merged 2 commits into
masterfrom
pedm-about-version-and-force-signing

Conversation

@thenextman
Copy link
Copy Markdown
Member

Add a new policy option target_must_be_signed; this forces the target executable to have a valid auhenticode signature as per the policy.

Realistically, this should be a "rule" so I'm probably introducing some slight technical debt here but I believe it's a worthwhile feature and a low-hanging fruit we can squeeze in for the release.

Add the application (Agent) version to the "About" API endpoint. This is for future proofing: RDM needs a way to know what version of PEDM he's talking to, in case we add/remove/change APIs.

The implementation is in Win32 and I believe it to be correct, but it could use some close scrutiny.

I generated the OpenAPI in a. separate commit for easier reviewing.

@github-actions
Copy link
Copy Markdown

Let maintainers know that an action is required on their side

  • Add the label release-required Please cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module) when you request a maintainer to cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module)

  • Add the label release-blocker Follow-up is required before cutting a new release if a follow-up is required before cutting a new release

  • Add the label publish-required Please publish libraries (`Devolutions.Gateway.Utils`, OpenAPI clients, etc) when you request a maintainer to publish libraries (Devolutions.Gateway.Utils, OpenAPI clients, etc.)

  • Add the label publish-blocker Follow-up is required before publishing libraries if a follow-up is required before publishing libraries

@thenextman Richard Markiewicz (thenextman) requested a review from a team May 15, 2025 19:58
@thenextman Richard Markiewicz (thenextman) force-pushed the pedm-about-version-and-force-signing branch from 5877b6f to 08b7868 Compare May 15, 2025 19:59
Comment thread crates/win-api-wrappers/src/utils.rs Outdated
Copy link
Copy Markdown
Member

@CBenoit Benoît Cortier (CBenoit) left a comment

Choose a reason for hiding this comment

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

By the way, in the Gateway we use the CARGO_PKG_VERSION env variable that is available at compile time:

version: Some(env!("CARGO_PKG_VERSION")),

This is replaced by, e.g., "2025.1.5", at compile time. I think I prefer that, unless there is a reason to stick to the runtime extraction from the executable?

Approving now to smooth the process for you.

@thenextman Richard Markiewicz (thenextman) force-pushed the pedm-about-version-and-force-signing branch from 08b7868 to c51cd9c Compare May 16, 2025 12:45
@thenextman Richard Markiewicz (thenextman) force-pushed the pedm-about-version-and-force-signing branch from c51cd9c to e8dab4f Compare May 16, 2025 12:47
@thenextman
Copy link
Copy Markdown
Member Author

By the way, in the Gateway we use the CARGO_PKG_VERSION env variable that is available at compile time:

version: Some(env!("CARGO_PKG_VERSION")),

This is replaced by, e.g., "2025.1.5", at compile time. I think I prefer that, unless there is a reason to stick to the runtime extraction from the executable?

Approving now to smooth the process for you.

Yes, as I wrote on Slack because we are in a crate that gives use the crate version

I do understand the alternative approach of using the build.rs to properly embed the version number in the crate, as also proposed by Allan Zhang (@allan2). Honestly I'm not sure which way I prefer.

Part of this is my own background: coming from a C/C++/C# perspective, the proper way to do this is to query the main module version. i.e. In C# you'd do GetEntryAssembly or GetExecutingAssembly and obtain the version that way. I like the idea that if I want to get the Agent version from another crate, I can call an existing function without having to modify the build system. It does (of course) rely on the developer knowing of the existence of said function.

But I do understand it's probably more idiomatic in rust to use a CARGO variable.

For now, I leave this like it is; but I'm not opposed to someone changing that to the alternative approach.

@thenextman Richard Markiewicz (thenextman) merged commit 7900fe0 into master May 16, 2025
39 checks passed
@thenextman Richard Markiewicz (thenextman) deleted the pedm-about-version-and-force-signing branch May 16, 2025 13:08
@CBenoit
Copy link
Copy Markdown
Member

Part of this is my own background: coming from a C/C++/C# perspective, the proper way to do this is to query the main module version. i.e. In C# you'd do GetEntryAssembly or GetExecutingAssembly and obtain the version that way. I like the idea that if I want to get the Agent version from another crate, I can call an existing function without having to modify the build system. It does (of course) rely on the developer knowing of the existence of said function.

That’s a fair point. Anyway, now we have the function, we can use it 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants