Skip to content

[Bug]: SAML_KEY_SIZE is ignored #18065

@smarsching

Description

@smarsching

Snipe-IT Version

v8.3.3 - build 20061 (master)

PHP Version

8.2.26

Composer Version

2.8.12

MySQL/MariaDB version

11.8.3

How did you install Snipe-IT?

Docker

Is this a fresh install or an upgrade?

Fresh install

What happened?

#17692 added support for changing the key size of the certificate that is generated for SAML authentication from its default value of 2048 bits, as requested in #17386. However, setting the SAML_KEY_SIZE variable has no effect.

I was able to track this down to a problem in app/Http/Requests/SettingsSamlRequest.php: When passing the private_key_bits parameter to openssl_pkey_new, the value from config('app.saml_key_size') is used, but when it comes from the SAML_KEY_SIZE environment variable, this is a string, not an int. openssl_pkey_new requires this parameter to be an int and silently ignores it if it is not.

I am going to provide a simple PR that fixes the issue by casting the value to an int before passing it to openssl_pkey_new.

What browsers are you seeing the problem on?

No response

Can you reproduce this on the public demo?

N/A

Do you have full multiple company support enabled?

No

If you have full multiple company support enabled, do you have location scoping to company enabled?

I do not have full multiple company support enabled

Application log output

Browser console output

Common Issues

  • I have searched this repo for existing issues related to my issue (including closed issues)
  • My APP_URL is set correctly in my .env file (including http or https and no trailing slash)
  • I have searched the official Snipe-IT documentation and have checked the Common Issues documentation (where applicable)
  • I have run database migrations (where applicable).
  • I have attached screenshots and/or videos of the issue (where applicable)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions