2
0

5 Commits

Author SHA1 Message Date
Sergio Padrino
c77487f645 Bump package version to 0.9.2 2021-02-17 11:27:56 +01:00
Sergio Padrino
88065c4f2a Use specific OS versions in CI scripts 2021-02-17 11:09:05 +01:00
Sergio Padrino
6ac5a9240d Add more compilation flags to improve security 2021-02-17 11:03:00 +01:00
Sergio Padrino
ca0c849738 Bump package version to 0.9.1 2021-02-02 14:57:28 +01:00
Sergio Padrino
8c44f4b5ea Remove DESKTOP_PORT from the valid env vars
DESKTOP_PORT is only for internal usage, no need to forward it.
2021-02-02 14:57:02 +01:00
5 changed files with 27 additions and 13 deletions

View File

@@ -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

View File

@@ -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"', {

View File

@@ -1,6 +1,6 @@
{
"name": "desktop-trampoline",
"version": "0.9.0",
"version": "0.9.2",
"main": "index.js",
"keywords": [],
"author": "",

View File

@@ -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)] == '=') {

View File

@@ -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()
})