Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: a developer friendly, secure API #238

Open
lukaszmakuch opened this issue Dec 30, 2021 · 4 comments
Open

Suggestion: a developer friendly, secure API #238

lukaszmakuch opened this issue Dec 30, 2021 · 4 comments

Comments

@lukaszmakuch
Copy link

Hi! 👋

I'd like to thank everyone who has ever worked on this library, as it has helped me build things I wouldn't have built otherwise.

After years of using it, I understood XML Signatures better and I noticed some issues which I believe could be avoided if the API was simpler.

I'd like to propose adding a high-level API that makes our apps harder to hack. Here's how it'd look:

$node = getTheOnlySignedNodeOrNull($xml, $publicKey);

and

$nodesArray = getSignedNodes($xml, $publicKey);

You can read the rationale behind it in this blog post - Your XML security library is sabotaging your work. Here's what you can do about it. It's evident verifying signatures poses a real challenge. An example is described in a post titled Are XML Signatures secure?.

The current, low-level API doesn't have to be removed, so everything can be backward-compatible.

The new, safer API can be built on top of the existing one.

Should we help developers deliver secure solutions?

@tvdijen
Copy link
Contributor

tvdijen commented Dec 30, 2021

Hi @lukaszmakuch ! I don't mean to hijack this topic to self-promote here, but I've been working on something like this for a while and I'm curious to know what you think about this library. The signature-part is done, the encryption-part is a WIP. It's API is made so it has zero-to-no room for mis-use.

@DemiMarie
Copy link

Hi @lukaszmakuch ! I don't mean to hijack this topic to self-promote here, but I've been working on something like this for a while and I'm curious to know what you think about this library. The signature-part is done, the encryption-part is a WIP. It's API is made so it has zero-to-no room for mis-use.

(Disclaimer: not a PHP developer.)

It appears that the library you linked to requires some custom trait implementations. If I were implementing XML-DSIG, the API I would provide is basically the high-level API @lukaszmakuch mentioned, with whatever restrictions make sense for a given use-case.

@tvdijen
Copy link
Contributor

tvdijen commented May 20, 2022

@DemiMarie This is not true. What trait implementations are you referring to? Have you read the README?
I don't see how things can get more high level than feeding the library with a key, an algorithm and the XML that has to be signed..

@DemiMarie
Copy link

@DemiMarie This is not true. What trait implementations are you referring to? Have you read the README? I don't see how things can get more high level than feeding the library with a key, an algorithm and the XML that has to be signed..

I did read the README, but I think the getId() method combined with the lack of an example that took only strings as input confused me. As I said, I am not a PHP developer, though I know the basic syntax of the language.

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

No branches or pull requests

3 participants