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

Remove auth headers from bare git clone on server #549

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@finos/git-proxy",
"version": "1.2.0",
"version": "1.2.1",
"description": "Deploy custom push protections and policies on top of Git.",
"scripts": {
"cli": "node ./packages/git-proxy-cli/index.js",
Expand Down
23 changes: 3 additions & 20 deletions src/proxy/processors/push-action/pullRemote.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,9 @@ const exec = async (req, action) => {

const cmd = `git clone ${action.url} --bare`;

// Retrieve authorization headers
const authorizationHeader = req.headers?.authorization;

// Validate the authorization headers
const authorizationValid =
authorizationHeader &&
typeof authorizationHeader === 'string' &&
authorizationHeader.includes('Basic ');

// Construct clone URL depending on presence of authorization headers
const cloneUrl = authorizationValid
? `https://${Buffer.from(authorizationHeader.split(' ')[1], 'base64')}@${action.url.replace(
/https*:\/\//,
'',
)}`
: action.url;

step.log(`Exectuting ${cmd}${authorizationValid ? ' with credentials' : ''}`);

const response = spawnSync('git', ['clone', cloneUrl, '--bare', '--progress'], {
step.log(`Exectuting ${cmd}`);

const response = spawnSync('git', ['clone', action.url, '--bare', '--progress'], {
cwd: action.proxyGitPath,
encoding: 'utf-8',
});
Expand Down
2 changes: 1 addition & 1 deletion website/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ npm install -g @finos/git-proxy-cli
To install a specific version of Git Proxy, append the version to the end of the install command:

```bash
npm install -g @finos/[email protected].0
npm install -g @finos/[email protected].1
```

To install a specific version of the Git Proxy CLI, append the version to the end of the install command:
Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
projectName: `${projectName}`,
organizationName: 'FINOS',
customFields: {
version: '1.2.0',
version: '1.2.1',
},
scripts: ['https://buttons.github.io/buttons.js'],
stylesheets: ['https://fonts.googleapis.com/css?family=Overpass:400,400i,700'],
Expand Down