simplesamlphp /
saml2
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace SimpleSAML\SAML2\Compat; |
||
| 6 | |||
| 7 | use Psr\Clock\ClockInterface; |
||
| 8 | use Psr\Log\LoggerInterface; |
||
| 9 | use SimpleSAML\SAML2\Assert\Assert; |
||
| 10 | use SimpleSAML\SAML2\XML\ExtensionPointInterface; |
||
| 11 | use SimpleSAML\XML\AbstractElement; |
||
| 12 | use SimpleSAML\XML\ElementInterface; |
||
| 13 | use SimpleSAML\XMLSchema\Type\QNameValue; |
||
|
0 ignored issues
–
show
|
|||
| 14 | use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmFactory; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSecurity\A...ryptionAlgorithmFactory was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSecurity\A...ansportAlgorithmFactory was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 16 | use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSecurity\A...gnatureAlgorithmFactory was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 17 | |||
| 18 | use function array_key_exists; |
||
| 19 | use function constant; |
||
| 20 | |||
| 21 | abstract class AbstractContainer |
||
| 22 | { |
||
| 23 | /** @var array */ |
||
| 24 | protected array $registry = []; |
||
| 25 | |||
| 26 | /** @var array */ |
||
| 27 | protected array $extRegistry = []; |
||
| 28 | |||
| 29 | /** @var array|null */ |
||
| 30 | protected ?array $blacklistedEncryptionAlgorithms = [ |
||
| 31 | EncryptionAlgorithmFactory::DEFAULT_BLACKLIST, |
||
| 32 | KeyTransportAlgorithmFactory::DEFAULT_BLACKLIST, |
||
| 33 | SignatureAlgorithmFactory::DEFAULT_BLACKLIST, |
||
| 34 | ]; |
||
| 35 | |||
| 36 | |||
| 37 | /** |
||
| 38 | * Get the list of algorithms that are blacklisted for any encryption operation. |
||
| 39 | * |
||
| 40 | * @return string[]|null An array with all algorithm identifiers that are blacklisted, or null if we want to use the |
||
| 41 | * defaults. |
||
| 42 | */ |
||
| 43 | public function getBlacklistedEncryptionAlgorithms(): ?array |
||
| 44 | { |
||
| 45 | return $this->blacklistedEncryptionAlgorithms; |
||
| 46 | } |
||
| 47 | |||
| 48 | |||
| 49 | /** |
||
| 50 | * Register a class that can handle a given element. |
||
| 51 | * |
||
| 52 | * @param string $class The class name of a class extending AbstractElement |
||
| 53 | */ |
||
| 54 | public function registerElementHandler(string $class): void |
||
| 55 | { |
||
| 56 | Assert::subclassOf($class, AbstractElement::class); |
||
| 57 | $key = '{' . constant($class::NS) . '}' . AbstractElement::getClassName($class); |
||
| 58 | $this->registry[$key] = $class; |
||
| 59 | } |
||
| 60 | |||
| 61 | |||
| 62 | /** |
||
| 63 | * Register a class that can handle given extension points of the standard. |
||
| 64 | * |
||
| 65 | * @param string $class The class name of a class extending AbstractElement or implementing ExtensionPointInterface. |
||
| 66 | */ |
||
| 67 | public function registerExtensionHandler(string $class): void |
||
| 68 | { |
||
| 69 | Assert::subclassOf($class, ExtensionPointInterface::class); |
||
| 70 | $key = '{' . $class::getXsiTypeNamespaceURI() . '}' . $class::getXsiTypeName(); |
||
| 71 | $this->extRegistry[$key] = $class; |
||
| 72 | } |
||
| 73 | |||
| 74 | |||
| 75 | /** |
||
| 76 | * Search for a class that implements an element in the given $namespace. |
||
| 77 | * |
||
| 78 | * Such classes must have been registered previously by calling registerExtensionHandler(), and they must |
||
| 79 | * extend \SimpleSAML\XML\AbstractElement. |
||
| 80 | * |
||
| 81 | * @param \SimpleSAML\XMLSchema\Type\QNameValue $qName The qualified name of the element. |
||
| 82 | * |
||
| 83 | * @return string|null The fully-qualified name of a class extending \SimpleSAML\XML\AbstractElement and |
||
| 84 | * implementing support for the given element, or null if no such class has been registered before. |
||
| 85 | */ |
||
| 86 | public function getElementHandler(QNameValue $qName): ?string |
||
| 87 | { |
||
| 88 | $key = '{' . $qName->getNameSpaceURI()->getValue() . '}' . $qName->getLocalName()->getValue(); |
||
| 89 | if (array_key_exists($key, $this->registry) === true) { |
||
| 90 | Assert::implementsInterface($this->registry[$key], ElementInterface::class); |
||
| 91 | return $this->registry[$key]; |
||
| 92 | } |
||
| 93 | |||
| 94 | return null; |
||
| 95 | } |
||
| 96 | |||
| 97 | |||
| 98 | /** |
||
| 99 | * Search for a class that implements a custom element type. |
||
| 100 | * |
||
| 101 | * Such classes must have been registered previously by calling registerExtensionHandler(), and they must |
||
| 102 | * implement \SimpleSAML\SAML11\XML\saml\ExtensionPointInterface. |
||
| 103 | * |
||
| 104 | * @param \SimpleSAML\XMLSchema\Type\QNameValue $qName The qualified name of the extension. |
||
| 105 | * @return string|null The fully-qualified name of a class implementing |
||
| 106 | * \SimpleSAML\SAML11\XML\saml\ExtensionPointInterface or null if no such class has been registered before. |
||
| 107 | */ |
||
| 108 | public function getExtensionHandler(QNameValue $qName): ?string |
||
| 109 | { |
||
| 110 | $key = '{' . $qName->getNameSpaceURI()->getValue() . '}' . $qName->getLocalName()->getValue(); |
||
| 111 | if (array_key_exists($key, $this->extRegistry) === true) { |
||
| 112 | Assert::implementsInterface($this->extRegistry[$key], ExtensionPointInterface::class); |
||
| 113 | return $this->extRegistry[$key]; |
||
| 114 | } |
||
| 115 | |||
| 116 | return null; |
||
| 117 | } |
||
| 118 | |||
| 119 | |||
| 120 | /** |
||
| 121 | * Set the list of algorithms that are blacklisted for any encryption operation. |
||
| 122 | * |
||
| 123 | * @param string[]|null $algos An array with all algorithm identifiers that are blacklisted, |
||
| 124 | * or null if we want to use the defaults. |
||
| 125 | */ |
||
| 126 | abstract public function setBlacklistedAlgorithms(?array $algos): void; |
||
| 127 | |||
| 128 | |||
| 129 | /** |
||
| 130 | * Get a PSR-3 compatible logger. |
||
| 131 | * @return \Psr\Log\LoggerInterface |
||
| 132 | */ |
||
| 133 | abstract public function getLogger(): LoggerInterface; |
||
| 134 | |||
| 135 | |||
| 136 | /** |
||
| 137 | * Log an incoming message to the debug log. |
||
| 138 | * |
||
| 139 | * Type can be either: |
||
| 140 | * - **in** XML received from third party |
||
| 141 | * - **out** XML that will be sent to third party |
||
| 142 | * - **encrypt** XML that is about to be encrypted |
||
| 143 | * - **decrypt** XML that was just decrypted |
||
| 144 | * |
||
| 145 | * @param \DOMElement|string $message |
||
| 146 | */ |
||
| 147 | abstract public function debugMessage($message, string $type): void; |
||
| 148 | |||
| 149 | |||
| 150 | /** |
||
| 151 | * Trigger the user to perform a POST to the given URL with the given data. |
||
| 152 | */ |
||
| 153 | abstract public function getPOSTRedirectURL(string $url, array $data = []): string; |
||
| 154 | |||
| 155 | |||
| 156 | /** |
||
| 157 | * This function retrieves the path to a directory where temporary files can be saved. |
||
| 158 | * |
||
| 159 | * @return string Path to a temporary directory, without a trailing directory separator. |
||
| 160 | * |
||
| 161 | * @throws \Exception If the temporary directory cannot be created or it exists and does not belong |
||
| 162 | * to the current user. |
||
| 163 | */ |
||
| 164 | abstract public function getTempDir(): string; |
||
| 165 | |||
| 166 | |||
| 167 | /** |
||
| 168 | * Atomically write a file. |
||
| 169 | * |
||
| 170 | * This is a helper function for writing data atomically to a file. It does this by writing the file data to a |
||
| 171 | * temporary file, then renaming it to the required file name. |
||
| 172 | * |
||
| 173 | * @param string $filename The path to the file we want to write to. |
||
| 174 | * @param string $data The data we should write to the file. |
||
| 175 | * @param int|null $mode The permissions to apply to the file. Defaults to 0600. |
||
| 176 | */ |
||
| 177 | abstract public function writeFile(string $filename, string $data, ?int $mode = null): void; |
||
| 178 | |||
| 179 | |||
| 180 | /** |
||
| 181 | * Get the system clock, using UTC for a timezone |
||
| 182 | */ |
||
| 183 | abstract public function getClock(): ClockInterface; |
||
| 184 | } |
||
| 185 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths