Skip to content

Conversation

@coopernetes
Copy link
Contributor

@coopernetes coopernetes commented Jan 24, 2024

Fixes #410

(Hello from Git Proxy 👋)

@netlify
Copy link

netlify bot commented Jan 24, 2024

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 3092274
🔍 Latest deploy log https://app.netlify.com/sites/endearing-brigadeiros-63f9d0/deploys/65c5486ba8402200084474c4

Copy link
Member

@JamieSlome JamieSlome left a comment

Choose a reason for hiding this comment

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

I've left a couple of comments; otherwise very straight forward and solid implementation 👍 ❤️ 🍰

I love my emojis...

@JamieSlome
Copy link
Member

@coopernetes - can we resolve merge conflicts? I merged #409 which also had changes to the router in src/proxy/index.js?

Copy link
Member

@JamieSlome JamieSlome left a comment

Choose a reason for hiding this comment

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

LGTM! 🍰

Just need the merge conflict resolved and good to go!

@codecov
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

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

Comparison is base (e5bb34a) 56.85% compared to head (3092274) 57.15%.

Files Patch % Lines
src/proxy/routes/index.js 68.18% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #415      +/-   ##
==========================================
+ Coverage   56.85%   57.15%   +0.30%     
==========================================
  Files          39       39              
  Lines        1036     1055      +19     
==========================================
+ Hits          589      603      +14     
- Misses        447      452       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JamieSlome
Copy link
Member

JamieSlome commented Feb 6, 2024

Oh, Codecov how we love you so. @coopernetes - happy to bump up the coverage before we merge?

We should probably make the project level Action informational and the PR level breaking whilst we slowly bring up the coverage for the rest of the repository.

@coopernetes
Copy link
Contributor Author

Oh, Codecov how we love you so. @coopernetes - happy to bump up the coverage before we merge?

Most of the required refactoring for getting additional coverage is not something I want to do in this PR. I would essentially have to rewrite the Express middleware & routing layer to abstract it into a set of testable functions. That's probably effort better spent on changes to move us to 2.x.

We should probably make the project level Action informational and the PR level breaking whilst we slowly bring up the coverage for the rest of the repository.

Let me see what codecov makes available in their configuration. I would like to preserve the PR comment for the report even if the status check isn't blocking builds. This gives needed feedback in the PR while we improve overall coverage.

https://docs.codecov.com/docs/codecovyml-reference

@coopernetes
Copy link
Contributor Author

Looking at the details, I think we can retest this after #429 is merged. The "baseline" report is misreported against a different branch.

https://app.codecov.io/gh/finos/git-proxy/tree/bugfix%2Fci-permissions

@JamieSlome
Copy link
Member

@coopernetes - agree with your comment before last. #429 is now merged by the way 👌

@JamieSlome
Copy link
Member

@coopernetes - as long as we can keep a view of the coverage of suggested changes in the PR that is good enough for now.

@JamieSlome
Copy link
Member

Looking at Codecov, it looks like it is already achieving this. We just don't want to return a failing state to CI.

@coopernetes
Copy link
Contributor Author

Now that #442 is merged, let me rebase again and retest. @JamieSlome are you good with the latest changes? Hoping to get this merged soon.

Copy link
Member

@JamieSlome JamieSlome left a comment

Choose a reason for hiding this comment

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

LGTM @coopernetes ❤️

Would like to get an idea of the coverage percentage but happy to merge in any case. Will keep my eyes open for your re-base.

- Accept is only set for certain git actions so refactored into
  one validation function
- pass routes correctly to express (fix TypeError on startup)
- separate out the HTTP git filtering logic from the URL parsing, which
  includes stripping the GitHub repo owner/name.
@coopernetes
Copy link
Contributor Author

LGTM @coopernetes ❤️

Would like to get an idea of the coverage percentage but happy to merge in any case. Will keep my eyes open for your re-base.

codecov/project — 57.15% (+0.30%) compared to e5bb34a 😅

@coopernetes coopernetes merged commit 245f5b4 into finos:main Feb 8, 2024
@coopernetes coopernetes deleted the gh410-http-filtering branch February 8, 2024 21:41
Psingle20 pushed a commit to Psingle20/git-proxy that referenced this pull request Nov 27, 2024
* feat: filter non-git HTTP requests being proxied

Fixes finos#410

* feat: refactor to one validation function

- Accept is only set for certain git actions so refactored into
  one validation function
- pass routes correctly to express (fix TypeError on startup)

* feat: separate url stripping into its own function

- separate out the HTTP git filtering logic from the URL parsing, which
  includes stripping the GitHub repo owner/name.
coopernetes added a commit to RBC/finos-git-proxy that referenced this pull request Feb 20, 2025
- new abstraction layers for creating & configuring providers
- unify filter & provider configuration into a single properties class
- allow filters to apply on push and/or fetch arbitrarily
- prevent ProxyServlet from sending error'd requests (stop processing
  when the servlet sends an error back to the client)
- re-worked GitClient to be more complete (all common ANSI colors
  included) and friendly for callers. Also, helper method to handle
  plain & emoji symbols

Three filters are implemented so far:
- a path-based whitelist (provider agnostic) on repository owners,
  names and/or full "slugs"
- check that the client is sending authentication (GitHub only)
- only permit proxy requests from valid git clients (a more complete
  version of finos#415)
coopernetes added a commit to coopernetes/git-proxy that referenced this pull request Jun 19, 2025
- new abstraction layers for creating & configuring providers
- unify filter & provider configuration into a single properties class
- allow filters to apply on push and/or fetch arbitrarily
- prevent ProxyServlet from sending error'd requests (stop processing
  when the servlet sends an error back to the client)
- re-worked GitClient to be more complete (all common ANSI colors
  included) and friendly for callers. Also, helper method to handle
  plain & emoji symbols

Three filters are implemented so far:
- a path-based whitelist (provider agnostic) on repository owners,
  names and/or full "slugs"
- check that the client is sending authentication (GitHub only)
- only permit proxy requests from valid git clients (a more complete
  version of finos#415)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter HTTP requests that are not specific to git operations

2 participants