simplesamlphp / simplesamlphp/saml2

Cannot use the library with SimpleSAML

Open
#178 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
306
Forks
138
PR merge metrics
No merged PRs in 30d

Description

When trying to generate a SAMLRequest object from an incoming string, the library crashes.

The following is from the Message constructor: https://github.com/simplesamlphp/saml2/blob/master/src/SAML2/Message.php#L143

    protected function __construct(string $tagName, DOMElement $xml = null)
    {
        $this->tagName = $tagName;
        $this->id = Utils::getContainer()->generateId();

The container is part of the compat layer with SimpleSAML. The generateId method uses the Random library from SimpleSAML

use SimpleSAML\Utils\HTTP;
use SimpleSAML\Utils\Random;
use SimpleSAML\Utils\System;
use SimpleSAML\Utils\XML;

    /**
     * {@inheritdoc}
     * @return string
     */
    public function generateId() : string
    {
        /** @psalm-suppress UndefinedClass */
        return Random::generateID();
    }

It's even marked as supressed in Psalm.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/SAML2/Message.php around the Message constructor and trace Utils::getContainer()->generateId() through the SimpleSAML compatibility layer. Reproduce construction of a SAMLRequest from an incoming string and inspect the SimpleSAML Random dependency and Psalm suppression. Done means the library no longer crashes during this construction path.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.