500 Server Error when assigning a user, occurs in single, bulk, import and API
Debug mode
- [X] I have enabled debug mode
- [X] I have read checked the Common Issues page
Describe the bug
When assigning a user we get 500 | Server Error when we try to assign a user with an @ symbol in the username (we are using UPN for via SAML for SSO).
Bulk Checkout does the same error
Import for checkout whilst it does not actually show the error, it just eventually times-out and dies
using the API (via powershell) to try to assign the users to the the asset gets a return with a little more information
Invoke-WebRequest -Uri "$snipeURL/api/v1/hardware/$snipeID/checkout" -Method POST -Headers $snipeHeaders -Body ($snipeBody | ConvertTo-JSON)
StatusCode : 200
StatusDescription : OK
Content : {"status":"error","messages":"Checkout target for asset 2754547 is invalid - user does not exist.","payload":{"asset":{"id":1078,"asset_tag":"2754547"},"target_id":"[email protected]","target_...
RawContent : HTTP/1.1 200 OK
Connection: keep-alive
Vary: Authorization,Origin
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 117
Pragma: no-cache
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=bl...
Forms : {}
Headers : {[Connection, keep-alive], [Vary, Authorization,Origin], [X-RateLimit-Limit, 120], [X-RateLimit-Remaining, 117]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 214
The user does exist and I have verified that via both the GUI and the API, the API return shows as
Invoke-WebRequest -Uri "$snipeURL/api/v1/users/2080" -Method GET -Headers $snipeHeaders
StatusCode : 200
StatusDescription : OK
Content : {"id":2080,"avatar":"\/\/gravatar.com\/avatar\/3c582cf2f50285fa6bbabfd72ba656f9","name":"Class 00A","first_name":"Class","last_name":"00A","username":"[email protected]","remote":false,"locale...
RawContent : HTTP/1.1 200 OK
Connection: keep-alive
Vary: Authorization,Origin
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 119
Pragma: no-cache
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=bl...
Forms : {}
Headers : {[Connection, keep-alive], [Vary, Authorization,Origin], [X-RateLimit-Limit, 120], [X-RateLimit-Remaining, 119]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 1059
The User ID was validated via the GUI.
This does not happen when using a random local user I created to test
Reproduction steps
- Acces GUI/Bulk Checkout/API
- Try to check out to user with a UPN as their username (@ symbol)
...
Expected behavior
Assigns device to user without erroring out
Screenshots
No response
Snipe-IT Version
v6.0.14
Operating System
Docker Container
Web Server
Docker Container
PHP Version
Docker Container
Operating System
Windows
Browser
Edge
Version
110.0.1587.46
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
UnexpectedValueException
The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied The exception occurred while attempting to log:
Monolog\Handler\StreamHandler::write
vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146
$url = $this->url;
if (null === $url || '' === $url) {
throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().' . Utils::getRecordMessageForException($record));
}
$this->createDir($url);
$this->errorMessage = null;
set_error_handler([$this, 'customErrorHandler']);
$stream = fopen($url, 'a');
if ($this->filePermission !== null) {
@chmod($url, $this->filePermission);
}
restore_error_handler();
if (!is_resource($stream)) {
$this->stream = null;
throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $url) . Utils::getRecordMessageForException($record));
}
stream_set_chunk_size($stream, $this->streamChunkSize);
$this->stream = $stream;
}
$stream = $this->stream;
if (!is_resource($stream)) {
throw new \LogicException('No stream was opened yet' . Utils::getRecordMessageForException($record));
}
if ($this->useLocking) {
// ignoring errors here, there's not much we can do about them
flock($stream, LOCK_EX);
}
vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php
Monolog\Handler\StreamHandler
:146
10
vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php
Monolog\Handler\AbstractProcessingHandler
:48
9
vendor/monolog/monolog/src/Monolog/Logger.php
Monolog\Logger
:359
8
Monolog\Logger
:602
7
vendor/laravel/framework/src/Illuminate/Log/Logger.php
Illuminate\Log\Logger
:183
6
Illuminate\Log\Logger
:94
5
vendor/laravel/framework/src/Illuminate/Log/LogManager.php
Illuminate\Log\LogManager
:590
4
vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php
Illuminate\Support\Facades\Facade
:261
3
app/Exceptions/Handler.php
App\Exceptions\Handler
:45
2
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
Illuminate\Foundation\Bootstrap\HandleExceptions
:165
1 unknown frame
Additional context
Upgrade or fresh install of the docker container, database is retained however