Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7eabea0f1a | ||
|
|
82635217c5 | ||
|
|
0ff24f8744 | ||
|
|
dd13c4b6cc | ||
|
|
639ed9be89 | ||
|
|
ff581e8b44 | ||
|
|
1a8de46fb7 | ||
|
|
ad699b35c0 | ||
|
|
31bc7170f6 | ||
|
|
9cc5d4f9ee | ||
|
|
731c53d97f | ||
|
|
6669833e3d | ||
|
|
ca8d10fddb | ||
|
|
c77487f645 | ||
|
|
88065c4f2a | ||
|
|
6ac5a9240d | ||
|
|
ca0c849738 | ||
|
|
8c44f4b5ea |
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -17,13 +17,13 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [12.14.1]
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
os: [macos-10.14, windows-2019, ubuntu-18.04]
|
||||
include:
|
||||
- os: macos-latest
|
||||
- os: macos-10.14
|
||||
friendlyName: macOS
|
||||
- os: windows-latest
|
||||
- os: windows-2019
|
||||
friendlyName: Windows
|
||||
- os: ubuntu-latest
|
||||
- os: ubuntu-18.04
|
||||
friendlyName: Linux
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
17
binding.gyp
17
binding.gyp
@@ -13,12 +13,25 @@
|
||||
'xcode_settings': {
|
||||
'OTHER_CFLAGS': [
|
||||
'-Wall',
|
||||
'-Werror'
|
||||
],
|
||||
'-Werror',
|
||||
'-Werror=format-security',
|
||||
'-fPIC',
|
||||
'-D_FORTIFY_SOURCE=1',
|
||||
'-fstack-protector-strong'
|
||||
]
|
||||
},
|
||||
'cflags!': [
|
||||
'-Wall',
|
||||
'-Werror',
|
||||
'-fPIC',
|
||||
'-pie',
|
||||
'-D_FORTIFY_SOURCE=1',
|
||||
'-fstack-protector-strong',
|
||||
'-Werror=format-security'
|
||||
],
|
||||
'ldflags!': [
|
||||
'-z relro',
|
||||
'-z now'
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
|
||||
25
docs/releases.md
Normal file
25
docs/releases.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Releases
|
||||
|
||||
All releases are published using GitHub releases. Anyone with push access to the
|
||||
repository can create a new release.
|
||||
|
||||
### Release Process
|
||||
|
||||
1. Create a branch named `releases/X.Y.Z`, where `X.Y.Z` is the version you want
|
||||
to release.
|
||||
1. Update the `version` field in the `package.json` with the new version you're
|
||||
about to release.
|
||||
1. Open a Pull Request for that branch.
|
||||
1. Once the branch is approved, `git tag vX.Y.Z` the version you wish to
|
||||
publish. **Important:** the version in the tag name must be preceeded by a
|
||||
`v`.
|
||||
1. `git push --follow-tags` to ensure all new commits (and the tag) are pushed
|
||||
to the remote. Pushing the tag will start the release process.
|
||||
1. Wait a few minutes for the build to finish (look for the build in
|
||||
https://github.com/desktop/desktop-trampoline/actions)
|
||||
1. Once the build is complete it will create a new release with all of the
|
||||
assets and suggested release notes.
|
||||
1. Update the changelog to whatever makes sense for this release. It should be
|
||||
focused on user-facing changes.
|
||||
1. Confirm all assets are uploaded for all the supported platforms.
|
||||
1. Merge the Pull Request into `main` and you're done :tada:
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "desktop-trampoline",
|
||||
"version": "0.9.0",
|
||||
"version": "0.9.4",
|
||||
"main": "index.js",
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
||||
@@ -17,10 +17,9 @@ if (writeSocket(socket, dataString, strlen(dataString) + 1) != 0) { \
|
||||
|
||||
// This is a list of valid environment variables that GitHub Desktop might
|
||||
// send or expect to receive.
|
||||
#define NUMBER_OF_VALID_ENV_VARS 5
|
||||
#define NUMBER_OF_VALID_ENV_VARS 4
|
||||
static const char *sValidEnvVars[NUMBER_OF_VALID_ENV_VARS] = {
|
||||
"DESKTOP_TRAMPOLINE_IDENTIFIER",
|
||||
"DESKTOP_PORT",
|
||||
"DESKTOP_TRAMPOLINE_TOKEN",
|
||||
"DESKTOP_USERNAME",
|
||||
"DESKTOP_ENDPOINT",
|
||||
@@ -33,8 +32,8 @@ int isValidEnvVar(char *env) {
|
||||
|
||||
// Make sure that not only the passed env var string starts with the
|
||||
// candidate contesnts, but also that there is a '=' character right after:
|
||||
// Valid: "DESKTOP_PORT=50"
|
||||
// Not valid: "DESKTOP_PORT_SOMETHING=50"
|
||||
// Valid: "DESKTOP_USERNAME=sergiou87"
|
||||
// Not valid: "DESKTOP_USERNAME_SOMETHING=sergiou87"
|
||||
if (strncmp(env, candidate, strlen(candidate)) == 0
|
||||
&& strlen(env) > strlen(candidate)
|
||||
&& env[strlen(candidate)] == '=') {
|
||||
@@ -67,7 +66,9 @@ int runTrampolineClient(SOCKET *outSocket, int argc, char **argv, char **envp) {
|
||||
*outSocket = socket;
|
||||
|
||||
if (connectSocket(socket, desktopPort) != 0) {
|
||||
printSocketError("ERROR: Couldn't connect to 127.0.0.1:%d", desktopPort);
|
||||
printSocketError("ERROR: Couldn't connect to 127.0.0.1:%d - Please make "
|
||||
"sure you don't have an antivirus or firewall blocking "
|
||||
"this connection.", desktopPort);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -103,7 +104,7 @@ int runTrampolineClient(SOCKET *outSocket, int argc, char **argv, char **envp) {
|
||||
|
||||
// TODO: send stdin stuff?
|
||||
|
||||
char buffer[BUFFER_LENGTH];
|
||||
char buffer[BUFFER_LENGTH + 1];
|
||||
size_t totalBytesRead = 0;
|
||||
ssize_t bytesRead = 0;
|
||||
|
||||
|
||||
27
src/socket.c
27
src/socket.c
@@ -6,13 +6,30 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
||||
#define MAX_WSA_ERROR_DESCRIPTION_LENGTH 4096
|
||||
|
||||
void getWSALastErrorDescription(wchar_t *buffer, int bufferLength) {
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, WSAGetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPWSTR)buffer, bufferLength - 1, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int initializeNetwork(void) {
|
||||
#ifdef WINDOWS
|
||||
// Initialize Winsock
|
||||
WSADATA wsaData;
|
||||
int result = WSAStartup(MAKEWORD(2,2), &wsaData);
|
||||
if (result != NO_ERROR) {
|
||||
fprintf(stderr, "ERROR: WSAStartup failed: %d\n", result);
|
||||
wchar_t errorDescription[MAX_WSA_ERROR_DESCRIPTION_LENGTH];
|
||||
getWSALastErrorDescription(errorDescription, MAX_WSA_ERROR_DESCRIPTION_LENGTH);
|
||||
|
||||
fprintf(stderr, "ERROR: WSAStartup failed (%d). Error %ld: %ls\n",
|
||||
result, WSAGetLastError(), errorDescription);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@@ -55,8 +72,7 @@ int readSocket(SOCKET socket, void *buffer, size_t length) {
|
||||
return recv(socket, buffer, length, 0);
|
||||
}
|
||||
|
||||
void printSocketError(char *fmt, ...)
|
||||
{
|
||||
void printSocketError(char *fmt, ...) {
|
||||
char formatted_string[4096];
|
||||
|
||||
va_list argptr;
|
||||
@@ -65,7 +81,10 @@ void printSocketError(char *fmt, ...)
|
||||
va_end(argptr);
|
||||
|
||||
#ifdef WINDOWS
|
||||
fprintf(stderr, "%s: %ld\n", formatted_string, WSAGetLastError());
|
||||
wchar_t errorDescription[MAX_WSA_ERROR_DESCRIPTION_LENGTH];
|
||||
getWSALastErrorDescription(errorDescription, MAX_WSA_ERROR_DESCRIPTION_LENGTH);
|
||||
|
||||
fprintf(stderr, "%s (%ld): %ls\n", formatted_string, WSAGetLastError(), errorDescription);
|
||||
#else
|
||||
fprintf(stderr, "%s (%d): %s\n", formatted_string, errno, strerror(errno));
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,7 @@ describe('desktop-trampoline', () => {
|
||||
// done forwarding data.
|
||||
socket.end()
|
||||
})
|
||||
server.unref()
|
||||
|
||||
const startTrampolineServer = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -42,9 +43,10 @@ describe('desktop-trampoline', () => {
|
||||
|
||||
const port = await startTrampolineServer()
|
||||
const env = {
|
||||
DESKTOP_PORT_FAKE: 32123,
|
||||
DESKTOP_TRAMPOLINE_IDENTIFIER: '123456',
|
||||
DESKTOP_PORT: port,
|
||||
DESKTOP_USERNAME: 'sergiou87',
|
||||
DESKTOP_USERNAME_FAKE: 'fake-user',
|
||||
INVALID_VARIABLE: 'foo bar',
|
||||
}
|
||||
const opts = { env }
|
||||
@@ -57,7 +59,7 @@ describe('desktop-trampoline', () => {
|
||||
const outputEnv = output.slice(3)
|
||||
expect(outputEnv).toHaveLength(2)
|
||||
expect(outputEnv).toContain('DESKTOP_TRAMPOLINE_IDENTIFIER=123456')
|
||||
expect(outputEnv).toContain(`DESKTOP_PORT=${port}`)
|
||||
expect(outputEnv).toContain(`DESKTOP_USERNAME=sergiou87`)
|
||||
|
||||
server.close()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user