Skip to content

Commit

Permalink
Merge branch 'trunk' into gitbook
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierChanth authored Oct 7, 2024
2 parents 1d96096 + dc08ff9 commit ed8cc46
Show file tree
Hide file tree
Showing 26 changed files with 417 additions and 120 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/c_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
with:
ref: c_release-${{github.run_number}}
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- run: |
docker buildx build -t atsigncompany/sshnpdc -f sshnpd/tools/Dockerfile.package \
--platform ${{ matrix.platform }} -o type=tar,dest=bins.tar .
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
with:
ref: c_release-${{github.run_number}}
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- run: |
docker buildx build -t atsigncompany/sshnpdcmusl -f sshnpd/tools/Dockerfile.musl \
--platform ${{ matrix.platform }} -o type=tar,dest=bins.tar .
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -60,7 +60,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/autobuild@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -73,6 +73,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/analyze@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/dockerhub_sshnpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

steps:
- name: execute tests on cicd vm
uses: appleboy/ssh-action@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3
uses: appleboy/ssh-action@25ce8cbbcb08177468c7ff7ec5cbfa236f9341e1 # v1.1.0
env:
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/multibuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ jobs:
- if: ${{ ! inputs.main_build_only }}
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- if: ${{ ! inputs.main_build_only }}
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- if: ${{ ! inputs.main_build_only }}
run: |
docker buildx build -t atsigncompany/sshnptarball -f ./tools/multibuild/Dockerfile.package \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-sshnpd-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
name: sshnpd-python-package
path: dist/
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b # v1.10.2
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
with:
skip-existing: true
attestations: true
Expand All @@ -99,7 +99,7 @@ jobs:
name: sshnpd-python-package
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b # v1.10.2
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
with:
attestations: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/upload-sarif@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
with:
sarif_file: results.sarif
2 changes: 2 additions & 0 deletions packages/dart/noports_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 6.2.0
- feat: allow hyphens in device name
# 6.1.1
- build[deps]: upgrade: \
at_client to 3.2.2 | at_onboarding_cli to 1.6.4 | at_utils to 3.0.19 | at_commons to 5.0.0
Expand Down
9 changes: 7 additions & 2 deletions packages/dart/noports_core/lib/src/common/default_args.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ class DefaultArgs {
static const bool authenticateDeviceToRvd = true;
static const bool encryptRvdTraffic = true;

/// How long a client should wait for response after pinging a daemon
/// How long a client should wait for response after pinging a NoPorts daemon
static const int daemonPingTimeoutSeconds = 20;
static const Duration daemonPingTimeoutDuration =
Duration(seconds: daemonPingTimeoutSeconds);

/// How long a client should wait for response from a NoPorts relay
static const int relayResponseTimeoutSeconds = 20;
static const Duration relayResponseTimeoutDuration =
Duration(seconds: relayResponseTimeoutSeconds);

/// How long srv should stay running if SocketConnector has no connections
static const int srvTimeoutInSeconds = 30;
static const Duration srvTimeout = Duration(seconds: srvTimeoutInSeconds);
Expand All @@ -49,5 +54,5 @@ class DefaultSshnpdArgs {
static const String deviceGroupName = '__none__';
static const String sshPublicKeyPermissions = "";
static const Duration policyHeartbeatFrequency = Duration(minutes: 5);
static const String permitOpen ='localhost:22,localhost:3389';
static const String permitOpen = 'localhost:22,localhost:3389';
}
15 changes: 12 additions & 3 deletions packages/dart/noports_core/lib/src/common/validation_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ import 'package:noports_core/src/common/file_system_utils.dart';
import 'package:noports_core/src/common/io_types.dart';
import 'package:path/path.dart' as path;

const String sshnpDeviceNameRegex = r'[a-z0-9_]{1,36}';
const String sshnpDeviceNameRegex = r'[a-z0-9_][a-z0-9_\-]{1,35}';
const String invalidDeviceNameMsg = 'Device name must be alphanumeric'
' snake case, max length 36';
const String deviceNameFormatHelp = 'Alphanumeric snake case, max length 36.';
' snake case, max length 36. First char must be _, a-z, or 0-9.';
const String deviceNameFormatHelp = 'Alphanumeric snake case, max length 36.'
' First char must be _, a-z, or 0-9.';
const String invalidSshKeyPermissionsMsg =
'Detected newline characters in the ssh public key permissions which malforms the authorized_keys file.';

/// Returns deviceName with uppercase latin replaced by lowercase, and
/// whitespace replaced with underscores. Note that multiple consecutive
/// whitespace characters will be replaced by a single underscore.
String snakifyDeviceName(String deviceName) {
return deviceName.toLowerCase().replaceAll(RegExp(r'\s+'), '_');
}

/// Returns false if the device name does not match [sshnpDeviceNameRegex]
bool invalidDeviceName(String test) {
return RegExp(sshnpDeviceNameRegex).allMatches(test).first.group(0) != test;
}
Expand Down
Loading

0 comments on commit ed8cc46

Please sign in to comment.