When the Spryng credentials in gateway are wrong, an uncaught exception is thrown

Open
#413 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

Nobody has claimed this yet.

Assessment

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

Research direction

Start in src/Surfnet/StepupGateway/ApiBundle/Controller/SmsController.php at line 51 and inspect how the SpryngMessageResult handles the 401 response. Reproduce the failure with invalid Spryng credentials and trace the response body containing "Unauthenticated." Done means the controller no longer throws an uncaught illegal string offset exception for this response.

Written by the indexing model from the issue text.

Description

Imported

This issue is imported from pivotal - Originaly created at May 27, 2024 by Paul Rijke

Whe the credentials aren;t okay for the Spryng gateway, the SmsController fails with an:

{"channel":"request","level":"CRITICAL","message":"Uncaught PHP Exception ErrorException: \"Warning: Illegal string offset \'description\'\" at /var/www/html/src/Surfnet/StepupGateway/ApiBundle/Controller/SmsController.php line 51","context":{"exception":{"class":"ErrorException","message":"Warning: Illegal string offset \'description\'","code":0,"file":"/var/www/html/src/Surfnet/StepupGateway/ApiBundle/Controller/SmsController.php:51"}},"extra":{"art":"37995","server":"gateway.dev.openconext.local","application":"stepup-gateway","request_id":"706ed6fb0d4e2c89baf7ace43572bcf6"}}

debugging of the result gave this result dump

^ Surfnet\StepupGateway\ApiBundle\Sms\SpryngMessageResult {#623 ▼
  -message: Spryng\SpryngRestApi\Http\Response {#621 ▼
    #curlInstance: curl resource @20 ▶}
    #rawResponse: """
      HTTP/2 401 
      date: Mon, 27 May 2024 13:45:36 GMT
      content-type: application/json
      server: Apache
      cache-control: no-cache, private
      access-control-allow-origin: *
      access-control-expose-headers: *
      strict-transport-security: max-age=31536000;
      x-frame-options: DENY
      x-content-type-options: nosniff
      x-xss-protection: 1; mode=block
      referrer-policy: no-referrer
      vary: Authorization
      x-robots-tag: none
      
      {"error":"Unauthenticated."}
      """
    #rawBody: "{"error":"Unauthenticated."}"
    #responseCode: 401
  }
Dominant language
PHP
Stars
6
Forks
3
Avg merge
6d 9h
Merged PRs (30d)
15

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from OpenConext/Stepup-Gateway

All issues in OpenConext/Stepup-Gateway

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.