Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Commit b5967cf

Browse files
authored
chore: add false positive leak comment on tokens tests (#885)
Signed-off-by: Stephane Bouchet <[email protected]>
1 parent d92992d commit b5967cf

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/test/java/org/jboss/tools/intellij/openshift/ui/cluster/TokenExtractorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class TokenExtractorTest {
2121

2222
@Test
2323
public void checkTokenExtractionOk() {
24-
String contents = "<html><head></head><body><h2>Your API token is</h2>\n <code>sha256~abcd-1234567890ABCDEF</code>\n</body></html>";
24+
String contents = "<html><head></head><body><h2>Your API token is</h2>\n <code>sha256~abcd-1234567890ABCDEF</code>\n</body></html>"; //# notsecret
2525
TokenExtractor extractor = new TokenExtractor(contents);
2626
assertTrue(extractor.isTokenPage());
2727
assertEquals("sha256~abcd-1234567890ABCDEF", extractor.getToken());
@@ -44,7 +44,7 @@ public void checkTokenExtractionFails() {
4444

4545
@Test
4646
public void checkTokenExtractionWithMultipleH2() {
47-
String contents = "<html><head></head><body><h2>Your API token is</h2>\n <code>sha256~abcd-1234567890ABCDEF</code>\n<h2>Log in with this token</h2>\n<pre>oc login <span class=\"nowrap\">--token=sha256~abcd-1234567890ABCDEF</span> <span class=\"nowrap\">--server=https://url.com:1234</span></pre></body></html>";
47+
String contents = "<html><head></head><body><h2>Your API token is</h2>\n <code>sha256~abcd-1234567890ABCDEF</code>\n<h2>Log in with this token</h2>\n<pre>oc login <span class=\"nowrap\">--token=sha256~abcd-1234567890ABCDEF</span> <span class=\"nowrap\">--server=https://url.com:1234</span></pre></body></html>"; //# notsecret
4848
TokenExtractor extractor = new TokenExtractor(contents);
4949
assertTrue(extractor.isTokenPage());
5050
assertEquals("sha256~abcd-1234567890ABCDEF", extractor.getToken());

src/test/java/org/jboss/tools/intellij/openshift/utils/OCCommandUtilsTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,33 @@ public class OCCommandUtilsTest {
2626
@Test
2727
public void testCommandWithToken() {
2828
assertEquals("123456789123456789",
29-
OCCommandUtils.getToken("oc login https://api.engint.openshift.com --token=123456789123456789"));
29+
OCCommandUtils.getToken("oc login https://api.engint.openshift.com --token=123456789123456789")); //# notsecret
3030
assertEquals("123456789123456789",
31-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=123456789123456789 "));
31+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=123456789123456789 ")); //# notsecret
3232
assertEquals("1234567891234567..89",
33-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=1234567891234567..89 "));
33+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=1234567891234567..89 ")); //# notsecret
3434
assertEquals("12345678912345678_9",
35-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=12345678912345678_9 "));
35+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=12345678912345678_9 ")); //# notsecret
3636
assertEquals("1234567891234567.89",
37-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=1234567891234567.89 "));
37+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=1234567891234567.89 ")); //# notsecret
3838
assertEquals("1234567891234567-89",
39-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=1234567891234567-89 "));
39+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=1234567891234567-89 ")); //# notsecret
4040
}
4141

4242
@Test
4343
public void testCommandWithTokenOCP4() {
4444
assertEquals("sha256~123456789123456789",
45-
OCCommandUtils.getToken("oc login https://api.engint.openshift.com --token=sha256~123456789123456789"));
45+
OCCommandUtils.getToken("oc login https://api.engint.openshift.com --token=sha256~123456789123456789")); //# notsecret
4646
assertEquals("sha256~123456789123456789",
47-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~123456789123456789 "));
47+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~123456789123456789 ")); //# notsecret
4848
assertEquals("sha256~1234567891234567..89",
49-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~1234567891234567..89 "));
49+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~1234567891234567..89 ")); //# notsecret
5050
assertEquals("sha256~12345678912345678_9",
51-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~12345678912345678_9 "));
51+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~12345678912345678_9 ")); //# notsecret
5252
assertEquals("sha256~1234567891234567.89",
53-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~1234567891234567.89 "));
53+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~1234567891234567.89 ")); //# notsecret
5454
assertEquals("sha256~1234567891234567-89",
55-
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~1234567891234567-89 "));
55+
OCCommandUtils.getToken("oc login https://api.-uengint.openshift.com --token=sha256~1234567891234567-89 ")); //# notsecret
5656
}
5757

5858
@Test
@@ -68,24 +68,24 @@ public void testCommandWithPassword() {
6868
@Test
6969
public void testValidCommand() {
7070
assertFalse(
71-
OCCommandUtils.isValidCommand("oc loginhttps://api.engint.openshift.com --token=123456789123456789"));
71+
OCCommandUtils.isValidCommand("oc loginhttps://api.engint.openshift.com --token=123456789123456789")); //# notsecret
7272
assertTrue(
73-
OCCommandUtils.isValidCommand("oc login https://api.engint.openshift.com --token=123456789123456789"));
73+
OCCommandUtils.isValidCommand("oc login https://api.engint.openshift.com --token=123456789123456789")); //# notsecret
7474
assertTrue(OCCommandUtils.isValidCommand("oc login https://12.34.5.6:8443 -u developer -p deve"));
7575
}
7676

7777
@Test
7878
public void testServerAddress() {
7979
assertEquals("https://api.engint.openshift.com",
80-
OCCommandUtils.getServer("oc login https://api.engint.openshift.com --token=123456789123456789"));
80+
OCCommandUtils.getServer("oc login https://api.engint.openshift.com --token=123456789123456789")); //# notsecret
8181
assertEquals("https://api.engint.openshift.com",
82-
OCCommandUtils.getServer("oc login -s=https://api.engint.openshift.com --token=123456789123456789"));
82+
OCCommandUtils.getServer("oc login -s=https://api.engint.openshift.com --token=123456789123456789")); //# notsecret
8383
assertEquals("https://api.engint.openshift.com",
84-
OCCommandUtils.getServer("oc login -s https://api.engint.openshift.com --token=123456789123456789"));
84+
OCCommandUtils.getServer("oc login -s https://api.engint.openshift.com --token=123456789123456789")); //# notsecret
8585
assertEquals("https://api.engint.openshift.com",
86-
OCCommandUtils.getServer("oc login --server=https://api.engint.openshift.com --token=123456789123456789"));
86+
OCCommandUtils.getServer("oc login --server=https://api.engint.openshift.com --token=123456789123456789")); //# notsecret
8787
assertEquals("https://api.engint.openshift.com",
88-
OCCommandUtils.getServer("oc login --server https://api.engint.openshift.com --token=123456789123456789"));
88+
OCCommandUtils.getServer("oc login --server https://api.engint.openshift.com --token=123456789123456789")); //# notsecret
8989
}
9090

9191
@Test

0 commit comments

Comments
 (0)