Skip to content

Commit

Permalink
Correctly encode password in ServerSettingsModel (#359)
Browse files Browse the repository at this point in the history
* Correctly encode password in ServerSettingsModel

* ubuntu-latest is 24.04 now, we still need 22.04

We still need a python2 package which 24.04 no longer offers, so run
this on 22.04 until the need for the python2 package goes away.
  • Loading branch information
rmunn authored Feb 19, 2025
1 parent 49493f8 commit 51c25ac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci+cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
event_file:
name: "Event File"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Upload
uses: actions/upload-artifact@v4
Expand All @@ -25,11 +25,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-22.04, windows-latest]
framework: [net462, net8.0]
exclude:
# dotnet on Linux cannot build net461 without additional, unnecessary, work
- os: ubuntu-latest
- os: ubuntu-22.04
framework: net462
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.framework }}
Expand All @@ -55,7 +55,7 @@ jobs:

- name: Install python2 for test execution
run: sudo apt-get install python2
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-22.04'

- name: Test Chorus
run: dotnet test src/Chorus.Tests/Chorus.Tests.csproj -f ${{ matrix.framework }} --no-build -c Release --filter TestCategory!=SkipOnBuildServer -- NUnit.TestOutputXml=TestResults
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
publish-nuget:
name: "Publish NuGet package"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: build-installers
if: github.event_name == 'push'
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
test-results:
name: Test Results
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: github.event.workflow_run.conclusion != 'skipped'

permissions:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- Prevent S&R to Internet without full URL
- [SIL.Chorus.LibChorus] Correctly handle & and other special characters in passwords

## [5.1.0] - 2023-03-07

Expand Down
3 changes: 2 additions & 1 deletion src/LibChorus/Model/ServerSettingsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using Chorus.Properties;
using Chorus.Utilities;
using Chorus.VcsDrivers;
Expand Down Expand Up @@ -335,7 +336,7 @@ private WebResponse LogIn()
var privateQuery = IsPrivateServer ? "?private=true" : string.Empty;
var request = WebRequest.Create($"https://admin{LanguageForgeServer}/api/user/{Username}/projects{privateQuery}");
request.Method = "POST";
var passwordBytes = Encoding.UTF8.GetBytes($"password={Password}");
var passwordBytes = Encoding.UTF8.GetBytes($"password={HttpUtility.UrlEncode(Password)}");
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = passwordBytes.Length;
var passwordStream = request.GetRequestStream();
Expand Down

0 comments on commit 51c25ac

Please sign in to comment.