Skip to content

Commit

Permalink
Ziga/gateway verbose logging and bugfix (#1884)
Browse files Browse the repository at this point in the history
* verbose logging on deployed gateway
* fix type checking for user inputs
  • Loading branch information
zkokelj authored Apr 26, 2024
1 parent 49112a3 commit 0526f7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manual-deploy-obscuro-gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,5 @@ jobs:
&& docker run -d -p 80:80 -p 81:81 --name ${{ github.event.inputs.testnet_type }}-OG-${{ GITHUB.RUN_NUMBER }} \
-e OBSCURO_GATEWAY_VERSION="${{ GITHUB.RUN_NUMBER }}-${{ GITHUB.SHA }}" \
${{ vars.DOCKER_BUILD_TAG_GATEWAY }} \
-host=0.0.0.0 -port=8080 -portWS=81 -nodeHost=${{ vars.L2_RPC_URL_VALIDATOR }} \
-host=0.0.0.0 -port=8080 -portWS=81 -nodeHost=${{ vars.L2_RPC_URL_VALIDATOR }} -verbose=true \
-logPath=sys_out -dbType=mariaDB -dbConnectionURL="obscurouser:${{ secrets.OBSCURO_GATEWAY_MARIADB_USER_PWD }}@tcp(obscurogateway-mariadb-${{ github.event.inputs.testnet_type }}.uksouth.cloudapp.azure.com:3306)/ogdb"'
13 changes: 10 additions & 3 deletions tools/walletextension/httpapi/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func versionRequestHandler(walletExt *rpcapi.Services, userConn UserConn) {
}
}

// getMessageRequestHandler handles request to /get-message endpoint.
// getMessageRequestHandler handles request to /getmessage endpoint.
func getMessageRequestHandler(walletExt *rpcapi.Services, conn UserConn) {
// read the request
body, err := conn.ReadRequest()
Expand All @@ -351,8 +351,15 @@ func getMessageRequestHandler(walletExt *rpcapi.Services, conn UserConn) {

// get address from the request
encryptionToken, ok := reqJSONMap[common.JSONKeyEncryptionToken]
if !ok || len(encryptionToken.(string)) != common.MessageUserIDLen {
handleError(conn, walletExt.Logger(), fmt.Errorf("unable to read encryptionToken field from the request or it is not of correct length"))
if !ok {
handleError(conn, walletExt.Logger(), fmt.Errorf("encryptionToken field not found in the request"))
return
}
if tokenStr, ok := encryptionToken.(string); !ok {
handleError(conn, walletExt.Logger(), fmt.Errorf("encryptionToken field is not a string"))
return
} else if len(tokenStr) != common.MessageUserIDLen {
handleError(conn, walletExt.Logger(), fmt.Errorf("encryptionToken field is not of correct length"))
return
}

Expand Down

0 comments on commit 0526f7a

Please sign in to comment.