Skip to content

Commit b2a69ba

Browse files
committed
Enh 38188654 - [38068862->22.06.14] Do not log an unnecessary message when an access controller fails to verify a subject
(merge 14.1.1.2206 -> ce/22.06 117378) [git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v22.06/": change = 117380]
1 parent b892d78 commit b2a69ba

File tree

1 file changed

+19
-8
lines changed
  • prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/net/security

1 file changed

+19
-8
lines changed

prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/net/security/Standard.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/*
3-
* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
3+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
44
*
55
* Licensed under the Universal Permissive License v 1.0 as shown at
66
* https://oss.oracle.com/licenses/upl.
@@ -271,7 +271,7 @@ public void checkPermission(com.tangosol.net.Cluster cluster, com.tangosol.net.C
271271
{
272272
try
273273
{
274-
validateSubject(sService, subject);
274+
validateSubject(sService, subject, false);
275275
fValid = true;
276276
}
277277
catch (SecurityException ex)
@@ -291,7 +291,7 @@ public void checkPermission(com.tangosol.net.Cluster cluster, com.tangosol.net.C
291291

292292
if (!fValid)
293293
{
294-
validateSubject(sService, subject);
294+
validateSubject(sService, subject, true);
295295
}
296296

297297
// TODO: leave the audit trail?
@@ -685,10 +685,18 @@ private void setValidSubjects(java.util.Map cache)
685685
*/
686686
protected void validateSubject(String sService, javax.security.auth.Subject subject)
687687
{
688-
// import com.tangosol.net.security.AccessController as com.tangosol.net.security.AccessController;
689-
// import java.util.Map;
690-
// import javax.security.auth.Subject;
691-
688+
validateSubject(sService, subject, true);
689+
}
690+
691+
/**
692+
* Prevent a security hole when a caller would construct a Subject object
693+
* with a Principal object that have a high security clearance, but provide
694+
* a valid cerificate representing a low security clearance Principal. The
695+
* very first validated subject becomes assosiated with the specified
696+
* service.
697+
*/
698+
protected void validateSubject(String sService, javax.security.auth.Subject subject, boolean fLog)
699+
{
692700
Map mapValid = getValidSubjects();
693701

694702
if (!mapValid.containsKey(subject))
@@ -704,7 +712,10 @@ protected void validateSubject(String sService, javax.security.auth.Subject subj
704712
}
705713
catch (Exception e)
706714
{
707-
_trace("Failed to verify the subject: " + subject + " due to: " + e.getMessage(), 3);
715+
if (fLog)
716+
{
717+
_trace("Failed to verify the subject: " + subject + " due to: " + e.getMessage(), 3);
718+
}
708719
throw new SecurityException("Failed to verify the subject");
709720
}
710721
}

0 commit comments

Comments
 (0)