Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine/gRPC proxy: Fix mux regression and add test coverage #1456

Merged
merged 4 commits into from
Feb 5, 2024

Conversation

thrasher-
Copy link
Collaborator

PR Description

A user spotted a regression in Slack that the mux wasn't set for the gRPC proxy handler. This PR adds it back and adds test coverage.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested

  • go test ./... -race
  • golangci-lint run

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation and regenerated documentation via the documentation tool
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally and on Github Actions with my changes
  • Any dependent changes have been merged and published in downstream modules

@thrasher- thrasher- added the review me This pull request is ready for review label Jan 24, 2024
@thrasher- thrasher- self-assigned this Jan 24, 2024
Copy link
Collaborator

@gloriousCode gloriousCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for actioning this!

engine/rpcserver_test.go Outdated Show resolved Hide resolved
engine/rpcserver_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@gloriousCode gloriousCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely test improvements!
Just noticed on the easy example response, with the move to using https:
image
Want to update the string to https?

@thrasher-
Copy link
Collaborator Author

Yeppers! Pooshed f9ac86d

Copy link
Collaborator

@gloriousCode gloriousCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK!

@brook-w
Copy link

brook-w commented Jan 26, 2024

Please continue to add HTTP CORS support, in order to better use it in the web (吴兴)
Can be configured in config.json. I think this function is very practical
@thrasher-

Copy link
Collaborator

@shazbert shazbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good one suggestion. tACK! 🚀

if !ok || username != s.Config.RemoteControl.Username || password != s.Config.RemoteControl.Password {
w.Header().Set("WWW-Authenticate", `Basic realm="restricted"`)
http.Error(w, "Access denied", http.StatusUnauthorized)
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: It might be better to log an authentication failure server side as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added with a note: by default we bind to localhost so you'd be notified if something on your machine is trying to gain access to it (with ip reported being localhost). However, it would be good if someone changes the listen address and in that case the IP log would be more useful

@shazbert
Copy link
Collaborator

Please continue to add HTTP CORS support, in order to better use it in the web (吴兴) Can be configured in config.json. I think this function is very practical @thrasher-

@brook-w Good suggestion but out of scope for this as this will probably need a middleware handler and integration with config, PR's are welcome.

@shazbert shazbert added the szrc shazbert review complete label Jan 29, 2024
Copy link

codecov bot commented Jan 30, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (e007f69) 43.39% compared to head (47039cc) 43.83%.
Report is 6 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1456      +/-   ##
==========================================
+ Coverage   43.39%   43.83%   +0.44%     
==========================================
  Files         367      363       -4     
  Lines      147096   145034    -2062     
==========================================
- Hits        63829    63582     -247     
+ Misses      75444    73723    -1721     
+ Partials     7823     7729      -94     
Files Coverage Δ
engine/helpers.go 80.15% <100.00%> (-0.06%) ⬇️
engine/rpcserver.go 39.67% <78.94%> (+1.29%) ⬆️

... and 21 files with indirect coverage changes

Copy link
Collaborator

@shazbert shazbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rude tACK

[WARN]  | GRPC | 30/01/2024 12:52:45 | gRPC proxy server unauthorised access attempt. IP: 127.0.0.1:59740 Path: /favicon.ico

@thrasher- thrasher- merged commit d57fefb into thrasher-corp:master Feb 5, 2024
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review me This pull request is ready for review szrc shazbert review complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants