Skip to content

Commit 23135a5

Browse files
authored
Drop KeePass Dependency (Azure#22063)
1 parent b47af33 commit 23135a5

File tree

59 files changed

+2010
-219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2010
-219
lines changed

NOTICE.txt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,53 @@ rights to this code.
462462
You should have received a copy of the CC0 legalcode along with this
463463
work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
464464

465+
License notice for Bouncy Castle
466+
------------------------------------------------------------------------------
467+
468+
Copyright (c) 2000 - 2021 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)
469+
470+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
471+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
472+
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
473+
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
474+
475+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
476+
477+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
478+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
479+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
480+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
481+
482+
483+
License notice for KeePassJava2
484+
------------------------------------------------------------------------------
485+
486+
Copyright 2015 Jo Rabin
487+
488+
Licensed under the Apache License, Version 2.0 (the "License");
489+
you may not use this file except in compliance with the License.
490+
You may obtain a copy of the License at
491+
492+
http://www.apache.org/licenses/LICENSE-2.0
493+
494+
Unless required by applicable law or agreed to in writing, software
495+
distributed under the License is distributed on an "AS IS" BASIS,
496+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
497+
See the License for the specific language governing permissions and
498+
limitations under the License.
499+
500+
License notice for openkeepass
501+
------------------------------------------------------------------------------
502+
503+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
504+
in compliance with the License. You may obtain a copy of the License at
505+
506+
http://www.apache.org/licenses/LICENSE-2.0
507+
508+
Unless required by applicable law or agreed to in writing, software distributed under the License
509+
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
510+
or implied. See the License for the specific language governing permissions and limitations under
511+
the License.
512+
513+
Openkeepass License Link: https://github.com/cternes/openkeepass/blob/master/LICENSE.txt
514+
-------------------------------------------------------------------------------------------------

eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,12 @@ the main ServiceBusClientBuilder. -->
606606
<!-- Issue: https://github.com/Azure/azure-sdk-for-java/issues/22117 -->
607607
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck" files="com.azure.communication.callingserver.CallingServerAsyncClient"/>
608608

609+
<!-- Third party source code files, retained as is. -->
610+
<suppress checks="[a-zA-Z0-9]*" files="com.azure.identity.implementation.intellij.Aes"/>
611+
<suppress checks="[a-zA-Z0-9]*" files="com.azure.identity.implementation.intellij.HashedBlockInputStream"/>
612+
<suppress checks="[a-zA-Z0-9]*" files="com.azure.identity.implementation.intellij.LittleEndianDataInputStream"/>
613+
<suppress checks="[a-zA-Z0-9]*" files="com.azure.identity.implementation.intellij.Salsa20"/>
614+
609615
<!-- Checkstyle suppressions to keep HttpPipelinePolicy in implementation folder. -->
610616
<suppress checks="com.azure.tools.checkstyle.checks.HttpPipelinePolicyCheck"
611617
files="com.azure.communication.callingserver.implementation.RedirectPolicy.java"/>

eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@
5353
UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD,
5454
NM_FIELD_NAMING_CONVENTION"/>
5555
</Match>
56+
57+
<!-- Internal implementation details, not at risk.-->
58+
<Match>
59+
<Class name="~com\.azure\.identity\.implementation\.intellij\.IntelliJKdbxMetadata"/>
60+
<Bug pattern="EI_EXPOSE_REP,
61+
EI_EXPOSE_REP2"/>
62+
</Match>
63+
64+
<Match>
65+
<Class name="~com\.azure\.identity\.implementation\.intellij\.IntelliJKdbxDatabase"/>
66+
<Bug pattern="NP_NULL_ON_SOME_PATH"/>
67+
</Match>
68+
69+
<!-- Third party source code files, kept as it is.-->
70+
<Match>
71+
<Class name="~com\.azure\.identity\.implementation\.intellij\.LittleEndianDataInputStream"/>
72+
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
73+
</Match>
74+
75+
<Match>
76+
<Class name="~com\.azure\.identity\.implementation\.intellij\.Salsa20"/>
77+
<Bug pattern="DM_DEFAULT_ENCODING"/>
78+
</Match>
5679

5780
<!-- Exception needs to be caught here.-->
5881
<Match>
@@ -2337,8 +2360,10 @@
23372360
<Or>
23382361
<Method name="getIntellijServicePrincipalDetails"/>
23392362
<Method name="getKdbxPassword"/>
2363+
<Method name="getCredentialFromKdbx"/>
23402364
</Or>
2341-
<Bug pattern="DM_DEFAULT_ENCODING"/>
2365+
<Bug pattern="DM_DEFAULT_ENCODING,
2366+
REC_CATCH_EXCEPTION"/>
23422367
</Match>
23432368

23442369
<!-- The field is designed to be unread and for serialization purpose. -->

sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosBulkGatewayTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.azure.cosmos.models.ThroughputProperties;
1313
import com.azure.cosmos.models.ThroughputResponse;
1414
import io.netty.handler.codec.http.HttpResponseStatus;
15-
import org.jetbrains.annotations.NotNull;
1615
import org.slf4j.Logger;
1716
import org.slf4j.LoggerFactory;
1817
import org.testng.annotations.AfterClass;
@@ -154,7 +153,6 @@ public void createItem_withBulk_split() throws InterruptedException {
154153
container.delete().block();
155154
}
156155

157-
@NotNull
158156
private List<PartitionKeyRange> getPartitionKeyRanges(
159157
String containerId, CosmosAsyncClient asyncClient) {
160158
List<PartitionKeyRange> partitionKeyRanges = new ArrayList<>();

sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosClientEncryptionKeyTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.azure.cosmos.models.EncryptionKeyWrapMetadata;
99
import com.azure.cosmos.models.FeedResponse;
1010
import com.azure.cosmos.rx.TestSuiteBase;
11-
import org.spongycastle.util.encoders.Hex;
1211
import org.testng.annotations.AfterClass;
1312
import org.testng.annotations.BeforeClass;
1413
import org.testng.annotations.Factory;
@@ -48,7 +47,7 @@ public void afterClass() {
4847
@Test(groups = {"emulator"}, timeOut = TIMEOUT)
4948
public void createClientEncryptionKey() {
5049
EncryptionKeyWrapMetadata encryptionKeyWrapMetadata = new EncryptionKeyWrapMetadata("key1", "tempmetadata1", "custom");
51-
byte[] key = Hex.decode(("34 62 52 77 f9 ee 11 9f 04 8c 6f 50 9c e4 c2 5b b3 39 f4 d0 4d c1 6a 32 fa 2b 3b aa " +
50+
byte[] key = decodeHexString(("34 62 52 77 f9 ee 11 9f 04 8c 6f 50 9c e4 c2 5b b3 39 f4 d0 4d c1 6a 32 fa 2b 3b aa " +
5251
"ae 1e d9 1c").replace(" ", ""));
5352

5453
CosmosClientEncryptionKeyProperties cosmosClientEncryptionKeyProperties =
@@ -67,7 +66,7 @@ public void createClientEncryptionKey() {
6766
@Test(groups = {"emulator"}, timeOut = TIMEOUT)
6867
public void replaceClientEncryptionKey() {
6968
EncryptionKeyWrapMetadata encryptionKeyWrapMetadata = new EncryptionKeyWrapMetadata("custom", "key2", "tempmetadata1");
70-
byte[] key = Hex.decode(("34 62 52 77 f9 ee 11 9f 04 8c 6f 50 9c e4 c2 5b b3 39 f4 d0 4d c1 6a 32 fa 2b 3b aa " +
69+
byte[] key = decodeHexString(("34 62 52 77 f9 ee 11 9f 04 8c 6f 50 9c e4 c2 5b b3 39 f4 d0 4d c1 6a 32 fa 2b 3b aa " +
7170
"ae 1e d9 1c").replace(" ", ""));
7271

7372
CosmosClientEncryptionKeyProperties cosmosClientEncryptionKeyProperties =
@@ -90,7 +89,7 @@ public void replaceClientEncryptionKey() {
9089
@Test(groups = {"emulator"}, timeOut = TIMEOUT)
9190
public void queryClientEncryptionKeys() {
9291
EncryptionKeyWrapMetadata encryptionKeyWrapMetadata = new EncryptionKeyWrapMetadata("custom", "key3", "tempmetadata1");
93-
byte[] key = Hex.decode(("34 62 52 77 f9 ee 11 9f 04 8c 6f 50 9c e4 c2 5b b3 39 f4 d0 4d c1 6a 32 fa 2b 3b aa " +
92+
byte[] key = decodeHexString(("34 62 52 77 f9 ee 11 9f 04 8c 6f 50 9c e4 c2 5b b3 39 f4 d0 4d c1 6a 32 fa 2b 3b aa " +
9493
"ae 1e d9 1c").replace(" ", ""));
9594

9695
CosmosClientEncryptionKeyProperties cosmosClientEncryptionKeyProperties =

sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosContainerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import com.azure.cosmos.models.ThroughputProperties;
3434
import com.azure.cosmos.rx.TestSuiteBase;
3535
import com.azure.cosmos.util.CosmosPagedIterable;
36-
import org.spongycastle.util.encoders.Hex;
3736
import org.testng.annotations.AfterClass;
3837
import org.testng.annotations.AfterMethod;
3938
import org.testng.annotations.BeforeClass;
@@ -43,6 +42,7 @@
4342
import org.testng.annotations.Test;
4443
import reactor.core.publisher.Mono;
4544

45+
import java.io.ByteArrayOutputStream;
4646
import java.nio.charset.StandardCharsets;
4747
import java.time.Duration;
4848
import java.util.ArrayList;
@@ -863,7 +863,7 @@ private void validateContainerResponseWithEncryption(CosmosContainerProperties c
863863

864864
private void createEncryptionKey() {
865865
EncryptionKeyWrapMetadata encryptionKeyWrapMetadata = new EncryptionKeyWrapMetadata("key1", "tempmetadata1", "custom");
866-
byte[] key = Hex.decode(("34 62 52 77 f9 ee 11 9f 04 8c 6f 50 9c e4 c2 5b b3 39 f4 d0 4d c1 6a 32 fa 2b 3b aa " +
866+
byte[] key = decodeHexString(("34 62 52 77 f9 ee 11 9f 04 8c 6f 50 9c e4 c2 5b b3 39 f4 d0 4d c1 6a 32 fa 2b 3b aa " +
867867
"ae 1e d9 1c").replace(" ", ""));
868868

869869
CosmosClientEncryptionKeyProperties cosmosClientEncryptionKeyProperties1 =

sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosMultiHashTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
package com.azure.cosmos;
88

9-
import com.azure.cosmos.implementation.Document;
109
import com.azure.cosmos.implementation.InternalObjectNode;
1110

1211
import com.azure.cosmos.models.CosmosContainerProperties;
@@ -26,13 +25,11 @@
2625
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
2726
import com.fasterxml.jackson.databind.node.ObjectNode;
2827
import com.fasterxml.jackson.databind.node.TextNode;
29-
import org.apache.http.HttpStatus;
3028
import org.testng.annotations.AfterClass;
3129
import org.testng.annotations.BeforeClass;
3230
import org.testng.annotations.Factory;
3331
import org.testng.annotations.Test;
3432

35-
import javax.print.Doc;
3633
import java.util.ArrayList;
3734
import java.util.List;
3835
import java.util.UUID;

sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/QueryValidationTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import com.azure.cosmos.util.CosmosPagedFlux;
3636
import com.fasterxml.jackson.databind.JsonNode;
3737
import io.reactivex.subscribers.TestSubscriber;
38-
import org.jetbrains.annotations.NotNull;
3938
import org.testng.annotations.BeforeClass;
4039
import org.testng.annotations.DataProvider;
4140
import org.testng.annotations.Factory;
@@ -459,7 +458,6 @@ public void queryLargePartitionKeyOn100BPKCollection() throws Exception {
459458
container.delete().block();
460459
}
461460

462-
@NotNull
463461
private List<PartitionKeyRange> getPartitionKeyRanges(
464462
String containerId, AsyncDocumentClient asyncDocumentClient) {
465463
List<PartitionKeyRange> partitionKeyRanges = new ArrayList<>();

sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import reactor.core.publisher.Mono;
7474
import reactor.core.scheduler.Schedulers;
7575

76+
import java.io.ByteArrayOutputStream;
7677
import java.time.Duration;
7778
import java.util.ArrayList;
7879
import java.util.Collections;
@@ -1237,4 +1238,13 @@ public Object[][] queryMetricsArgProvider() {
12371238
public static CosmosClientBuilder copyCosmosClientBuilder(CosmosClientBuilder builder) {
12381239
return CosmosBridgeInternal.cloneCosmosClientBuilder(builder);
12391240
}
1241+
1242+
public byte[] decodeHexString(String string) {
1243+
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
1244+
for (int i = 0; i < string.length(); i+=2) {
1245+
int b = Integer.parseInt(string.substring(i, i + 2), 16);
1246+
outputStream.write(b);
1247+
}
1248+
return outputStream.toByteArray();
1249+
}
12401250
}

sdk/hdinsight/azure-resourcemanager-hdinsight/src/test/java/com/azure/resourcemanager/hdinsight/HDInsightTests.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@
2929
import com.azure.resourcemanager.network.models.Subnet;
3030
import com.azure.resourcemanager.storage.StorageManager;
3131
import com.azure.resourcemanager.storage.models.PublicAccess;
32-
import com.google.common.collect.ImmutableList;
33-
import com.google.common.collect.ImmutableMap;
3432
import org.junit.jupiter.api.Test;
3533

3634
import java.net.MalformedURLException;
3735
import java.net.URL;
38-
import java.util.Random;
36+
import java.util.*;
3937

4038
public class HDInsightTests extends TestBase {
4139

@@ -86,6 +84,13 @@ public void clusterTest() throws MalformedURLException {
8684
.withPublicAccess(PublicAccess.NONE)
8785
.create();
8886

87+
Map<String, Map<String, String>> clusterDefinition = new HashMap<>(1);
88+
Map<String, String> clusterProperties = new HashMap<>(3);
89+
clusterProperties.put("restAuthCredential.isEnabled", "true");
90+
clusterProperties.put("restAuthCredential.username", "admin");
91+
clusterProperties.put("restAuthCredential.password", "Pa$s" + randomPadding());
92+
clusterDefinition.put("gateway", Collections.unmodifiableMap(clusterProperties));
93+
8994
// cluster
9095
manager.clusters().define("cluster" + randomPadding())
9196
.withExistingResourceGroup(resourceGroupName)
@@ -96,15 +101,10 @@ public void clusterTest() throws MalformedURLException {
96101
.withTier(Tier.STANDARD)
97102
.withClusterDefinition(new ClusterDefinition()
98103
.withKind("Spark")
99-
.withConfigurations(ImmutableMap.of(
100-
"gateway", ImmutableMap.of(
101-
"restAuthCredential.isEnabled", "true",
102-
"restAuthCredential.username", "admin",
103-
"restAuthCredential.password", "Pa$s" + randomPadding()
104-
)))
104+
.withConfigurations(Collections.unmodifiableMap(clusterDefinition))
105105
)
106106
.withComputeProfile(new ComputeProfile()
107-
.withRoles(ImmutableList.of(
107+
.withRoles(Collections.unmodifiableList(new LinkedList<>(Arrays.asList(
108108
new Role().withName("headnode")
109109
.withTargetInstanceCount(2)
110110
.withHardwareProfile(new HardwareProfile()
@@ -137,16 +137,16 @@ public void clusterTest() throws MalformedURLException {
137137
.withId(network.id())
138138
.withSubnet(subnet.id())
139139
)
140-
))
140+
))))
141141
)
142142
.withStorageProfile(new StorageProfile()
143-
.withStorageaccounts(ImmutableList.of(
143+
.withStorageaccounts(Collections.unmodifiableList(Arrays.asList(
144144
new StorageAccount()
145145
.withName(new URL(storageAccount.endPoints().primary().blob()).getHost())
146146
.withKey(storageAccountKey)
147147
.withContainer(containerName)
148148
.withIsDefault(true)
149-
))
149+
)))
150150
))
151151
.create();
152152
// @embedmeEnd

0 commit comments

Comments
 (0)