From f8e37cc834a7879ae376bf59c315df1a91c59e72 Mon Sep 17 00:00:00 2001 From: Joe Tannenbaum Date: Fri, 17 Feb 2023 09:03:10 -0500 Subject: [PATCH] bugsnag --- .../Controllers/RegistrationController.php | 20 +- composer.json | 1 + composer.lock | 261 +++++++++++++++++- config/app.php | 1 + config/logging.php | 10 +- resources/views/layout.blade.php | 8 + 6 files changed, 292 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/RegistrationController.php b/app/Http/Controllers/RegistrationController.php index 3507c90..f231dde 100644 --- a/app/Http/Controllers/RegistrationController.php +++ b/app/Http/Controllers/RegistrationController.php @@ -87,7 +87,9 @@ public function generateOptions(Request $request) ->setAttestation( PublicKeyCredentialCreationOptions::ATTESTATION_CONVEYANCE_PREFERENCE_NONE ) - ->setAuthenticatorSelection(AuthenticatorSelectionCriteria::create()) + ->setAuthenticatorSelection( + AuthenticatorSelectionCriteria::create() + ) ->setExtensions(AuthenticationExtensionsClientInputs::createFromArray([ 'credProps' => true, ])) @@ -100,19 +102,25 @@ public function generateOptions(Request $request) )->toArray() ); - $serializedPublicKeyCredentialCreationOptions = $publicKeyCredentialCreationOptions->jsonSerialize(); + $serializedOptions = $publicKeyCredentialCreationOptions->jsonSerialize(); - if (!isset($serializedPublicKeyCredentialCreationOptions['excludeCredentials'])) { + if (!isset($serializedOptions['excludeCredentials'])) { // The JS side needs this, so let's set it up for success with an empty array - $serializedPublicKeyCredentialCreationOptions['excludeCredentials'] = []; + $serializedOptions['excludeCredentials'] = []; } + $serializedOptions['extensions'] = $serializedOptions['extensions']->jsonSerialize(); + + // $serializedOptions['authenticatorSelection']['residentKey'] = AuthenticatorSelectionCriteria::RESIDENT_KEY_REQUIREMENT_PREFERRED; + + // ray($serializedOptions); + $request->session()->put( self::CREDENTIAL_CREATION_OPTIONS_SESSION_KEY, - $serializedPublicKeyCredentialCreationOptions + $serializedOptions ); - return $serializedPublicKeyCredentialCreationOptions; + return $serializedOptions; } public function verify(Request $request, ServerRequestInterface $serverRequest) diff --git a/composer.json b/composer.json index 434743b..40d7395 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "license": "MIT", "require": { "php": "^8.0.2", + "bugsnag/bugsnag-laravel": "^2.0", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.0", "laravel/sanctum": "^3.0", diff --git a/composer.lock b/composer.lock index 6a7c1f3..dcbbdf0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1411fb689443317ab98379ff7291e800", + "content-hash": "7fb203d6a48ddc33d511745267ae1355", "packages": [ { "name": "brick/math", @@ -62,6 +62,265 @@ ], "time": "2022-08-10T22:54:19+00:00" }, + { + "name": "bugsnag/bugsnag", + "version": "v3.29.0", + "source": { + "type": "git", + "url": "https://github.com/bugsnag/bugsnag-php.git", + "reference": "362b93bb4b1318bb4bfe3a9e553413e6c2c1f382" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bugsnag/bugsnag-php/zipball/362b93bb4b1318bb4bfe3a9e553413e6c2c1f382", + "reference": "362b93bb4b1318bb4bfe3a9e553413e6c2c1f382", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "guzzlehttp/guzzle": "^5.0|^6.0|^7.0", + "php": ">=5.5" + }, + "require-dev": { + "guzzlehttp/psr7": "^1.3", + "mtdowling/burgomaster": "dev-master#72151eddf5f0cf101502b94bf5031f9c53501a04", + "php-mock/php-mock-phpunit": "^1.1|^2.1", + "phpunit/phpunit": "^4.8.36|^7.5.15|^9.3.10", + "sebastian/version": ">=1.0.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.20-dev" + } + }, + "autoload": { + "psr-4": { + "Bugsnag\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "James Smith", + "email": "notifiers@bugsnag.com", + "homepage": "https://bugsnag.com" + } + ], + "description": "Official Bugsnag notifier for PHP applications.", + "homepage": "https://github.com/bugsnag/bugsnag-php", + "keywords": [ + "bugsnag", + "errors", + "exceptions", + "logging", + "tracking" + ], + "support": { + "issues": "https://github.com/bugsnag/bugsnag-php/issues", + "source": "https://github.com/bugsnag/bugsnag-php/tree/v3.29.0" + }, + "time": "2022-10-19T09:54:15+00:00" + }, + { + "name": "bugsnag/bugsnag-laravel", + "version": "v2.26.0", + "source": { + "type": "git", + "url": "https://github.com/bugsnag/bugsnag-laravel.git", + "reference": "333a912e38ead3e02724381093778b271168c8a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bugsnag/bugsnag-laravel/zipball/333a912e38ead3e02724381093778b271168c8a3", + "reference": "333a912e38ead3e02724381093778b271168c8a3", + "shasum": "" + }, + "require": { + "bugsnag/bugsnag": "^3.29.0", + "bugsnag/bugsnag-psr-logger": "^1.4|^2.0", + "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/support": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0", + "monolog/monolog": "^1.12|^2.0|^3.0", + "php": ">=5.5" + }, + "require-dev": { + "orchestra/testbench": "^3.1|^4.0|^5.0|^6.0|^7.0|^8.0", + "phpunit/phpunit": "^4.8.36|^6.3.1|^7.5.15|^8.3.5|^9.3.10" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.18-dev" + } + }, + "autoload": { + "psr-4": { + "Bugsnag\\BugsnagLaravel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "James Smith", + "email": "notifiers@bugsnag.com" + } + ], + "description": "Official Bugsnag notifier for Laravel applications.", + "homepage": "https://github.com/bugsnag/bugsnag-laravel", + "keywords": [ + "bugsnag", + "errors", + "exceptions", + "laravel", + "logging", + "tracking" + ], + "support": { + "issues": "https://github.com/bugsnag/bugsnag-laravel/issues", + "source": "https://github.com/bugsnag/bugsnag-laravel/tree/v2.26.0" + }, + "time": "2023-02-16T08:48:39+00:00" + }, + { + "name": "bugsnag/bugsnag-psr-logger", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/bugsnag/bugsnag-psr-logger.git", + "reference": "6c1126e28edcfb7c1da4b492eed883011a09416a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bugsnag/bugsnag-psr-logger/zipball/6c1126e28edcfb7c1da4b492eed883011a09416a", + "reference": "6c1126e28edcfb7c1da4b492eed883011a09416a", + "shasum": "" + }, + "require": { + "bugsnag/bugsnag": "^3.10", + "php": ">=8.0", + "psr/log": "^2.0|^3.0" + }, + "require-dev": { + "graham-campbell/testbench-core": "^1.1", + "mockery/mockery": "^1.3.1", + "phpunit/phpunit": "^9.4.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Bugsnag\\PsrLogger\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "James Smith", + "email": "notifiers@bugsnag.com", + "homepage": "https://bugsnag.com" + } + ], + "description": "Official Bugsnag PHP PSR Logger.", + "homepage": "https://github.com/bugsnag/bugsnag-psr", + "keywords": [ + "bugsnag", + "errors", + "exceptions", + "logging", + "psr", + "tracking" + ], + "support": { + "issues": "https://github.com/bugsnag/bugsnag-psr-logger/issues", + "source": "https://github.com/bugsnag/bugsnag-psr-logger/tree/v2.0.0" + }, + "time": "2022-01-12T11:07:19+00:00" + }, + { + "name": "composer/ca-bundle", + "version": "1.3.5", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "74780ccf8c19d6acb8d65c5f39cd72110e132bbd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/74780ccf8c19d6acb8d65c5f39cd72110e132bbd", + "reference": "74780ccf8c19d6acb8d65c5f39cd72110e132bbd", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.55", + "psr/log": "^1.0", + "symfony/phpunit-bridge": "^4.2 || ^5", + "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/ca-bundle/issues", + "source": "https://github.com/composer/ca-bundle/tree/1.3.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2023-01-11T08:27:00+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.2", diff --git a/config/app.php b/config/app.php index ef76a7e..2f4dd47 100644 --- a/config/app.php +++ b/config/app.php @@ -189,6 +189,7 @@ /* * Application Service Providers... */ + Bugsnag\BugsnagLaravel\BugsnagServiceProvider::class, App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, // App\Providers\BroadcastServiceProvider::class, diff --git a/config/logging.php b/config/logging.php index 5aa1dbb..c894050 100644 --- a/config/logging.php +++ b/config/logging.php @@ -53,10 +53,16 @@ 'channels' => [ 'stack' => [ 'driver' => 'stack', - 'channels' => ['single'], + // Add bugsnag to the stack: + 'channels' => ['single', 'bugsnag'], 'ignore_exceptions' => false, ], + // Create a bugsnag logging channel: + 'bugsnag' => [ + 'driver' => 'bugsnag', + ], + 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), @@ -85,7 +91,7 @@ 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), - 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), + 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), ], ], diff --git a/resources/views/layout.blade.php b/resources/views/layout.blade.php index a35e85c..a98e835 100644 --- a/resources/views/layout.blade.php +++ b/resources/views/layout.blade.php @@ -18,6 +18,14 @@ @endif + + @if (app()->environment('production')) + + + @endif