Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ jobs:
if: always()

kmip-cluster-ft-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
env:
S3BACKEND: file
Expand Down Expand Up @@ -1007,7 +1007,7 @@ jobs:
}}${{
matrix.opts.globalEncryptionEnabled && '-global' || ''
}}
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
env:
S3BACKEND: file
Expand Down
4 changes: 2 additions & 2 deletions lib/kms/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function getClientForKey(key, log) {
// if type was extracted, it is a scality arnPrefix, it needs validation
// might throw if arn malformed or backend not available
// for any request (PUT or GET)
const error = validateKeyDetail(detail, availableBackends);
const error = validateKeyDetail(detail, availableBackends, key);
if (error) {
log.error('KMS key arn is invalid', { key, detail, availableBackends });
return { error };
Expand Down Expand Up @@ -253,7 +253,7 @@ class KMS {
// otherwise prepend the current KMS client arnPrefix
if (isScalityKmsArn(configuredMasterKeyId)) {
const detail = extractDetailFromArn(configuredMasterKeyId);
const error = validateKeyDetail(detail, availableBackends);
const error = validateKeyDetail(detail, availableBackends, configuredMasterKeyId);
if (error) {
return cb(error);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@opentelemetry/instrumentation-http": "~0.222.0",
"@opentelemetry/instrumentation-ioredis": "~0.70.0",
"@opentelemetry/instrumentation-mongodb": "~0.75.0",
"@scality/arsenal": "8.6.0-preview.5",
"@scality/arsenal": "8.7.0",
"@scality/bucketclient": "scality/bucketclient#8.3.0",
"@scality/cloudserverclient": "1.0.13",
"@scality/scubaclient": "1.2.1",
Expand Down
31 changes: 31 additions & 0 deletions tests/unit/encryption/kms.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,37 @@ describe('KMS unit tests', () => {
});
});

describe('with a key of a KMS that is not configured', () => {
const keyArn = 'arn:scality:kms:external:kmip:unconfigured:key/1';

function assertRefusedNamingOnlyTheKey(err) {
assert.strictEqual(err.is.InvalidArgument, true);
Comment thread
anurag4DSB marked this conversation as resolved.
Resolved
assert.strictEqual(
err.description,
`KMS Scality KeyArn "${keyArn}" doesn't match any configured providers`,
);
}

it('should refuse it on bucket encryption', done => {
const sseConfig = parseBucketEncryptionHeaders({
'x-amz-scal-server-side-encryption': 'aws:kms',
'x-amz-scal-server-side-encryption-aws-kms-key-id': keyArn,
});
KMS.bucketLevelEncryption(dummyBucket, sseConfig, log, err => {
assertRefusedNamingOnlyTheKey(err);
done();
});
});

it('should refuse it on object encryption', done => {
const sseInfo = { algorithm: 'aws:kms', cryptoScheme: 1, mandatory: true, masterKeyId: keyArn };
KMS.createCipherBundle(sseInfo, log, err => {
assertRefusedNamingOnlyTheKey(err);
done();
});
});
});

it(
'should not construct a sse info object if ' +
'x-amz-scal-server-side-encryption header contains invalid algorithm option',
Expand Down
Loading
Loading