Skip to content

Commit 3dc2d3f

Browse files
committed
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
2 parents b1fbeb6 + 6fb63d0 commit 3dc2d3f

33 files changed

+860
-342
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ permissions:
1313
pull-requests: write
1414

1515
jobs:
16-
build:
16+
# Ubuntu build with MongoDB matrix (9 combinations: 3 Node × 3 MongoDB)
17+
build-ubuntu:
1718
runs-on: ubuntu-latest
1819

1920
strategy:
@@ -38,7 +39,7 @@ jobs:
3839
node-version: ${{ matrix.node-version }}
3940

4041
- name: Start MongoDB
41-
uses: supercharge/mongodb-github-action@315db7fe45ac2880b7758f1933e6e5d59afd5e94 # ratchet:supercharge/mongodb-github-action@1.12.1
42+
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
4243
with:
4344
mongodb-version: ${{ matrix.mongodb-version }}
4445

@@ -65,24 +66,21 @@ jobs:
6566
with:
6667
files: ./coverage/lcov.info
6768
token: ${{ secrets.CODECOV_TOKEN }}
68-
# - name: Exit if coverage condition not met
69-
# if: ${{ steps.test.outputs.exit_code }} != 0
70-
# run: exit ${{ steps.test.outputs.exit_code }}
7169

7270
- name: Build frontend
7371
run: npm run build-ui
7472

7573
- name: Save build folder
76-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
74+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
7775
with:
78-
name: build-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
76+
name: build-ubuntu-node-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
7977
if-no-files-found: error
8078
path: build
8179

8280
- name: Download the build folders
83-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # ratchet:actions/download-artifact@v5
81+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
8482
with:
85-
name: build-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
83+
name: build-ubuntu-node-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
8684
path: build
8785

8886
- name: Run cypress test
@@ -93,37 +91,80 @@ jobs:
9391
wait-on-timeout: 120
9492
command: npm run cypress:run
9593

94+
# Windows build - single combination for development support
95+
build-windows:
96+
runs-on: windows-latest
97+
98+
steps:
99+
- name: Harden Runner
100+
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
101+
with:
102+
egress-policy: audit
103+
104+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
105+
with:
106+
fetch-depth: 0
107+
108+
- name: Use Node.js 24.x
109+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
110+
with:
111+
node-version: 24.x
112+
113+
- name: Enable Windows Developer Mode
114+
shell: powershell
115+
run: |
116+
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
117+
118+
- name: Install dependencies
119+
run: npm ci
120+
121+
- name: Check Types (Server)
122+
run: npm run check-types:server
123+
124+
- name: Build TypeScript
125+
run: npm run build-ts
126+
127+
- name: Test
128+
id: test
129+
shell: bash
130+
run: |
131+
npm run test-coverage-ci
132+
npm run test-coverage-ci --workspaces --if-present
133+
134+
- name: Build frontend
135+
run: npm run build-ui
136+
96137
# Execute a final job to collect the results and report a single check status
97138
results:
98139
if: ${{ always() }}
99140
runs-on: ubuntu-latest
100141
name: build result
101-
needs: [build]
142+
needs: [build-ubuntu, build-windows]
102143
steps:
103144
- name: Check build results
104145
run: |
105-
result="${{ needs.build.result }}"
106-
if [[ $result == "success" || $result == "skipped" ]]; then
146+
ubuntu_result="${{ needs.build-ubuntu.result }}"
147+
windows_result="${{ needs.build-windows.result }}"
148+
if [[ ($ubuntu_result == "success" || $ubuntu_result == "skipped") && ($windows_result == "success" || $windows_result == "skipped") ]]; then
107149
echo "### ✅ All builds passed" >> $GITHUB_STEP_SUMMARY
108150
exit 0
109151
else
110152
echo "### ❌ Some builds failed" >> $GITHUB_STEP_SUMMARY
153+
echo "- Ubuntu: $ubuntu_result" >> $GITHUB_STEP_SUMMARY
154+
echo "- Windows: $windows_result" >> $GITHUB_STEP_SUMMARY
111155
exit 1
112156
fi
113157
114158
- name: Parse failed matrix jobs
115-
if: needs.build.result == 'failure'
159+
if: needs.build-ubuntu.result == 'failure' || needs.build-windows.result == 'failure'
116160
run: |
117161
echo "## Failed Matrix Combinations" >> $GITHUB_STEP_SUMMARY
118162
echo "" >> $GITHUB_STEP_SUMMARY
119-
echo "| Node Version | MongoDB Version | Status |" >> $GITHUB_STEP_SUMMARY
120-
echo "|--------------|-----------------|--------|" >> $GITHUB_STEP_SUMMARY
121-
122-
# Parse the matrix results from the build job
123-
results='${{ toJSON(needs.build.outputs) }}'
163+
echo "| OS | Node Version | MongoDB Version | Status |" >> $GITHUB_STEP_SUMMARY
164+
echo "|----|--------------|-----------------|--------|" >> $GITHUB_STEP_SUMMARY
124165
125166
# Since we can't directly get individual matrix job statuses,
126167
# we'll note that the build job failed
127-
echo "| Multiple | Multiple | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
168+
echo "| Multiple | Multiple | Multiple | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
128169
echo "" >> $GITHUB_STEP_SUMMARY
129170
echo "⚠️ Check the [build job logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details on which specific matrix combinations failed." >> $GITHUB_STEP_SUMMARY

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ jobs:
2121
with:
2222
comment-summary-in-pr: always
2323
fail-on-severity: high
24-
allow-licenses: MIT, MIT-0, Apache-2.0, BSD-3-Clause, BSD-3-Clause-Clear, ISC, BSD-2-Clause, Unlicense, CC0-1.0, 0BSD, X11, MPL-2.0, MPL-1.0, MPL-1.1, MPL-2.0, OFL-1.1, Zlib, BlueOak-1.0.0
24+
allow-licenses: MIT, MIT-0, Apache-2.0, BSD-3-Clause, BSD-3-Clause-Clear, ISC, BSD-2-Clause, Unlicense, CC0-1.0, 0BSD, X11, MPL-2.0, MPL-1.0, MPL-1.1, MPL-2.0, OFL-1.1, Zlib, BlueOak-1.0.0, Ubuntu-font-1.0
2525
fail-on-scopes: development, runtime
2626
allow-dependencies-licenses: 'pkg:npm/caniuse-lite'

.github/workflows/unused-dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
node-version: '22.x'
2222
- name: 'Run depcheck'
2323
run: |
24-
npx depcheck --skip-missing --ignores="tsx,@babel/*,@commitlint/*,eslint,eslint-*,husky,ts-node,concurrently,nyc,prettier,typescript,tsconfig-paths,vite-tsconfig-paths,quicktype,history,@types/domutils,@vitest/coverage-v8"
24+
npx depcheck --skip-missing --ignores="tsx,@babel/*,@commitlint/*,eslint,eslint-*,husky,ts-node,concurrently,nyc,prettier,typescript,tsconfig-paths,vite-tsconfig-paths,quicktype,history,@types/domutils,@vitest/coverage-v8,cross-env"
2525
echo $?
2626
if [[ $? == 1 ]]; then
2727
echo "Unused dependencies or devDependencies found"

docs/Upgrading to v2.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Upgrading to GitProxy v2
2+
3+
This guide attempts to cover everything needed for a seamless upgrade from GitProxy v1 (`1.19.2`) to v2.
4+
5+
Most errors will be related to invalid database records added in v1 - mainly in the `user` and `repo` databases. As of writing, database migration files are not provided.
6+
7+
## Breaking changes
8+
9+
Two important breaking changes were made:
10+
11+
### Associate commits by email
12+
13+
Commits are no longer associated by Git's `user.name`. Now, they're associated by email (to match the handling of commits by GitHub, GitLab and other SCM providers), which allows Git Proxy to handle multiple SCM providers. [#973](github.com/finos/git-proxy/pull/973)
14+
15+
In practice, pushes that were working in v1 (made with an improperly configured git client) may be blocked in v2 due to the change in requirements. The user's GitProxy email must match the commit's email (Git's `user.email`). This is often already required by a firm's contribution policy or to pass a CLA (Contributor License Agreement) check on a project.
16+
17+
### Support for GitLab and other Git hosts
18+
19+
Added support for Git SCM hosts other than GitHub. Eliminated assumptions about GitHub as the Git repository host. [#1043](https://github.com/finos/git-proxy/pull/1043)
20+
21+
Repositories are no longer identified by name, but by internal ID instead. This means that multiple forks of the same repo are now supported, as well as repos for other Git host (GitLab, etc.).
22+
23+
From v2 onwards, Git Proxy git URLs include the domain of the git host (e.g. https://git-proxydomain.net:8443/org/project.git has changed to https://git-proxydomain.net:8443/github.com/org/project.git). Backwards compatibility was implemented to ensure that these older URLs don't break. However, users should be advised to update the URL used in their remote in case this is removed in a subsequent major release.
24+
25+
## Troubleshooting typical errors
26+
27+
Most of these errors can be easily **fixed by simply accessing the UI** to delete the offending repository, add it again, and restore all the allowed users. Manually editing the database entries is not recommended, but also works.
28+
29+
If you encounter any errors not on this guide, feel free to [open a discussion](https://github.com/finos/git-proxy/discussions).
30+
31+
### Errors when pushing to a repo that was working in v1:
32+
33+
#### fatal: <repo-url>/info/refs not valid: is this git repository?
34+
35+
`git push` returns:
36+
37+
```
38+
fatal: <repo-url>/info/refs not valid: is this git repository?
39+
```
40+
41+
This error happens when pushing to GitProxy with a mismatched URL.
42+
43+
In v1, Git URLs without the trailing `.git` were considered valid:
44+
45+
```
46+
"url": "https://github.com/my-org/my-repo"
47+
```
48+
49+
In v2, URLs are automatically formatted when adding a repo. **Repos added in v1 must be edited or re-added to fix this error**:
50+
51+
```
52+
"url": "https://github.com/my-org/my-repo.git"
53+
```
54+
55+
#### Your push has been blocked (<email> is not allowed to push on repo <repo-url>)
56+
57+
`git push` returns:
58+
59+
```
60+
Your push has been blocked (<email> is not allowed to push on repo <repo-url>)
61+
```
62+
63+
This error occurs when pushing to GitProxy without being in the `canPush` list. This error can also occur when no GitProxy users match the given email.
64+
65+
In v1, authorised users were matched based on `gitAccount` (which was actually the Git `user.name` and mistakenly being used as the GitHub username in the UI):
66+
67+
```
68+
"users":{"canPush":["John Doe"],"canAuthorise":["John Doe","admin"]}
69+
```
70+
71+
In v2, authorised users are identified by the email address associated with their GitProxy username. The email associated with the push (Git config `user.email`) must match their GitProxy email:
72+
73+
Repo data:
74+
75+
```
76+
{"users":{"canPush":["johndoe123"],"canAuthorise":["johndoe123","admin"]"}, ...}`
77+
```
78+
79+
User data:
80+
81+
```
82+
{"username":"johndoe123","gitAccount":"<does-not-matter>","email":"<email>", ...}
83+
```
84+
85+
Changing the email address associated with commits can be accomplished via a number of routes, including 'rewriting history' [using rebase](https://stackoverflow.com/questions/750172/how-do-i-change-the-author-and-committer-name-email-for-multiple-commits) (dangerous but preserves the commits) or creating new commits with the correct metadata (safer but involves creating a new history/branch).
86+
87+
## Other notable changes
88+
89+
### Features
90+
91+
- Replaced `getMissingData` action with `checkEmptyBranch` to handle empty branch processing in [#1134](https://github.com/finos/git-proxy/pull/1134)
92+
- `getMissingData` was setting the `Commit` object's `committer` to the `author_name` which is not always true. Furthermore, the edge case that `getMissingData` was trying to solve was already covered by the `checkHiddenCommits` action
93+
- `checkEmptyBranch` simply checks whether the branch has had any new commits (if not, the push will be rejected)
94+
- Added a settings page for configuring the JWT token to authenticate UI requests to API when `apiAuthentication` is enabled in [#1096](https://github.com/finos/git-proxy/pull/1096)
95+
- Previously, requests from the UI were bypassing the JWT check if the user was logged in, and failing otherwise when `apiAuthentication` was set
96+
- For more details on setting JWT, check the [architecture documentation](./Architecture.md#setting-up-jwt-authentication):
97+
- Added the ability to create new users via the GitProxy CLI in [#981](https://github.com/finos/git-proxy/pull/981)
98+
- Added `/healthcheck` endpoint for AWS Load Balancer support [#1197](https://github.com/finos/git-proxy/pull/1197)
99+
- Improved login page flexibility, error handling and visibility of available auth methods in [#1227](https://github.com/finos/git-proxy/pull/1227)
100+
- Added config schema for `commitConfig`, `attestationConfig` and `domains` in [#1243](https://github.com/finos/git-proxy/pull/1243)
101+
- See the [schema reference](https://git-proxy.finos.org/docs/configuration/reference) for a detailed description of each
102+
- Also removes the defunct `api.github` config element
103+
- Added confirmation dialog to `RepoDetails` page to prevent accidental repository deletions in [#1267](https://github.com/finos/git-proxy/pull/1267)
104+
- Added support for using AWS Credential Provider to authenticate MongoDB connections in [#1319](https://github.com/finos/git-proxy/pull/1319)
105+
- Optimized push speed by performing shallow clones by default in [#1189](https://github.com/finos/git-proxy/pull/1189)
106+
- Increased push speeds for larger repos [by around 30~50%](https://github.com/finos/git-proxy/issues/985)
107+
- Improved configuration validation and typing in [#1140](https://github.com/finos/git-proxy/pull/1140)
108+
109+
### Bugfixes
110+
111+
- Fixed issue where requests for unknown repos were being forwarded to GitHub instead of being blocked as expected in [#1163](https://github.com/finos/git-proxy/issues/1163)
112+
- Improved error handling on chain execution to ensure errors always block pushes
113+
- Ensured `checkRepoInAuthList` is run for all requests
114+
- Fixed MongoDB client implementation issues (not awaiting promises, searching repos against the wrong field) in [#1167](https://github.com/finos/git-proxy/pull/1167)
115+
- Fixed issues with Git client not rendering error messages on rejected pushes in [#1178](https://github.com/finos/git-proxy/pull/1178)
116+
- Reverted previous changes to status codes on rejected pushes since the Git client only renders errors on `200 OK`
117+
- Fixed Push table committer and author links, replaced links to profile with `mailto:` in [#1179](https://github.com/finos/git-proxy/pull/1179)
118+
- Fixed display errors when adding a new repo in [#1120](https://github.com/finos/git-proxy/pull/1120)
119+
- Caused by an issue with server side errors being silently ignored
120+
- Fixed `--force` pushes failing due to the `getDiff` action blocking legitimate empty diffs in [#1182](https://github.com/finos/git-proxy/pull/1182)
121+
- Fixed incorrect error message on cloning unauthorized repos in [#1204](https://github.com/finos/git-proxy/pull/1204)
122+
- Caused by improper Git protocol error handling for `GET /info/refs` requests, resulting in Git client receiving malformed `upload-pack` data
123+
- Fixed duplicated chain execution when pushing a PR that has been approved in [#1209](https://github.com/finos/git-proxy/pull/1209)
124+
- Caused by an issue with raw body extraction on `POST git-pack` requests
125+
- Reimplemented push parsing to fix various issues related to packfile decoding in [#1187](https://github.com/finos/git-proxy/pull/1187)
126+
- Fixed `Z_DATA_ERROR` when pushing
127+
- Fixed Git object header parsing and packfile metadata reading
128+
- Reimplemented decompression to better replicate how Git handles it (replaced inflating/deflating the object)
129+
- Fixed logout failure in production caused by UI defaulting to `http://localhost:3000` when `VITE_API_URI` is unset in [#1201](https://github.com/finos/git-proxy/pull/1201)
130+
- Refactors API URL usages to rely on a single source of truth, sets default values
131+
- Fixed a potential denial-of-service vulnerability when pushing to an unknown repository in [#1095](https://github.com/finos/git-proxy/pull/1095)
132+
- Caused by a bug in the MongoDB implementation `isUserPushAllowed` which assumed that the repository exists. If the repository wasn't found, the backend crashed when attempting to access its properties
133+
- Fixed `MongoServerError` when updating user due to attempting to override the pre-existent `_id` in [#1230](https://github.com/finos/git-proxy/pull/1230)
134+
- Fixed error with `commitConfig.diff.block.literals` entry being matched as regular expressions instead in [#1251](https://github.com/finos/git-proxy/pull/1251)
135+
- Fixed infinite loop in `UserList` component causing excessive API requests and preventing proper rendering in [#1255](https://github.com/finos/git-proxy/pull/1255)
136+
- Fixed broken user links in `PushDetails` and `RepoDetails` components in [#1268](https://github.com/finos/git-proxy/pull/1268)
137+
- Created `UserLink` component to centralise user navigation
138+
- Fixed pagination component to show correct page count when no data is available in [#1274](https://github.com/finos/git-proxy/pull/1274)
139+
- Fixed proxy startup failure due to default repo mismatch in [#1284](https://github.com/finos/git-proxy/pull/1284)
140+
- Caused by matching repos by name instead of URL on calling `proxyPreparations`
141+
- Fixed error when making subsequent pushes to a new branch in [#1291](https://github.com/finos/git-proxy/pull/1291)
142+
- `Error: fatal: Invalid revision range` was being thrown on valid pushes to new branches
143+
- Caused by setting `singleBranch: true` when pulling the remote repo for optimization purposes
144+
- Removal of this option does not affect pull/push times considerably. Rudimentary benchmarks show that despite removing the option, push speeds [are still considerably faster](https://github.com/finos/git-proxy/pull/1305#issuecomment-3611774012) than without the `depth: 1` optimization
145+
- Fixed misleading backend status codes and improved UI error handling in [#1293](https://github.com/finos/git-proxy/pull/1293)
146+
- Also removed redundant `/api/auth/me` endpoint
147+
- Fixed race condition preventing MongoDB connection when loading configuration in [#1316](https://github.com/finos/git-proxy/pull/1316)
148+
- Deferred retrieval of database config allowing the user configuration to be loaded before attempting to use it
149+
- Replaced `jwk-to-pem` dependency with native `crypto` to remove vulnerable dependency (`elliptic`) in [#1283](https://github.com/finos/git-proxy/pull/1283)

index.html

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,6 @@
3131
<link rel="manifest" href="/manifest.json" />
3232
<link rel="shortcut icon" href="/favicon.ico" />
3333
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon.png" />
34-
<link rel="stylesheet" href="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.css" />
35-
36-
<script
37-
src="https://cdn.jsdelivr.net/chartist.js/0.11.0/chartist.min.js"
38-
integrity="sha384-BnJvHBnDyKVZFn8I5i6LHXOscPlizGS+cgZi1crgdHmjU9lVKXwtNsqXQ521P++Z"
39-
crossorigin="anonymous"
40-
></script>
41-
<link
42-
rel="stylesheet"
43-
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons"
44-
/>
45-
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
46-
<link
47-
rel="stylesheet"
48-
href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
49-
/>
50-
51-
<link
52-
rel="stylesheet"
53-
type="text/css"
54-
href="https://cdn.jsdelivr.net/npm/diff2html/bundles/css/diff2html.min.css"
55-
/>
5634

5735
<!--
5836
Notice the use of / in the tags above.

0 commit comments

Comments
 (0)