Merge pull request #1873

This commit is contained in:
larabr 2025-07-31 19:19:10 +02:00 committed by GitHub
commit ddbd0d72f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 9 deletions

View File

@ -52,7 +52,7 @@ jobs:
dist
test/lib
key: cache-${{ github.sha }}
# ignore cache miss, since it was taken care of the `build` step and it should never occur here
fail-on-cache-miss: true # sanity check for runner issues or misconfigurations
- run: npm test
test-browsers-latest:
@ -63,8 +63,7 @@ jobs:
matrix:
# run on all main platforms to test platform-specific code, if present
# (e.g. webkit's WebCrypto API implementation is different in macOS vs Linux)
# TODO: windows-latest fails to fetch resources from the wtr server; investigate if the problem is with path declaration or permissions
runner: ['ubuntu-latest', 'macos-latest']
runner: ['ubuntu-latest', 'macos-latest', 'windows-latest']
runs-on: ${{ matrix.runner }}
steps:
@ -79,6 +78,8 @@ jobs:
dist
test/lib
key: cache-${{ github.sha }}
enableCrossOsArchive: true
fail-on-cache-miss: true # sanity check for runner issues or misconfigurations
- name: Install dependencies
# cannot use `--ignore-scripts` since playwright seems to use it to set ENV vars
@ -88,13 +89,15 @@ jobs:
- name: Get Playwright version and cache location
id: playwright-version
if: ${{ matrix.runner != 'windows-latest' }} # setting env vars does not work in windows, it'd require custom handling
run: |
PLAYWRIGHT_VERSION=$(npm ls playwright --depth=0 | grep playwright | sed 's/.*@//')
PLAYWRIGHT_VERSION=$(npx playwright --version | sed 's/^Version //')
echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
PLAYWRIGHT_CACHE=${{ fromJSON('{"ubuntu-latest": "~/.cache/ms-playwright", "macos-latest": "~/Library/Caches/ms-playwright"}')[matrix.runner] }}
echo "playwright_cache=$PLAYWRIGHT_CACHE" >> $GITHUB_OUTPUT
- name: Check for cached browsers
id: cache-playwright-browsers
if: ${{ matrix.runner != 'windows-latest' }}
uses: actions/cache@v4
with:
path: ${{ steps.playwright-version.outputs.playwright_cache }}

View File

@ -91,13 +91,13 @@ export default () => describe('ECDH key exchange @lightweight', function () {
'secp256k1', 2, 7, secp256k1_value, secp256k1_point, secp256k1_invalid_point, secp256k1_data, []
)).to.be.rejectedWith(/Public key is not valid for specified curve|Failed to translate Buffer to a EC_POINT|bad point/).notify(done);
});
it('Invalid key data integrity', function (done) {
it('Invalid key data integrity', async function () {
if (!openpgp.config.useEllipticFallback && !util.getNodeCrypto()) {
this.skip();
}
expect(decrypt_message(
await expect(decrypt_message(
'secp256k1', 2, 7, secp256k1_value, secp256k1_point, secp256k1_point, secp256k1_data, []
)).to.be.rejectedWith(/Key Data Integrity failed/).notify(done);
)).to.be.rejectedWith(/Key Data Integrity faile|Invalid padding/); // invalid padding thrown by webkit on Windows
});
const Q1 = new Uint8Array([
@ -160,7 +160,7 @@ export default () => describe('ECDH key exchange @lightweight', function () {
const { publicKey: V, wrappedKey: C } = await ecdh.encrypt(oid, kdfParams, data, Q1, fingerprint1);
await expect(
ecdh.decrypt(oid, kdfParams, V, C, Q2, d2, fingerprint1)
).to.be.rejectedWith(/Key Data Integrity failed/);
).to.be.rejectedWith(/Key Data Integrity failed|Invalid padding/); // invalid padding thrown by webkit on Windows
});
it('Invalid fingerprint', async function () {
@ -171,7 +171,7 @@ export default () => describe('ECDH key exchange @lightweight', function () {
const { publicKey: V, wrappedKey: C } = await ecdh.encrypt(oid, kdfParams, data, Q2, fingerprint1);
await expect(
ecdh.decrypt(oid, kdfParams, V, C, Q2, d2, fingerprint2)
).to.be.rejectedWith(/Key Data Integrity failed/);
).to.be.rejectedWith(/Key Data Integrity failed|Invalid padding/); // invalid padding thrown by webkit on Windows
});
it('Successful exchange x25519 (legacy)', async function () {