Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-16 Thread Sean Mullan
Updated webrev looks good. --Sean On 11/16/18 10:31 AM, Seán Coffey wrote: I've renamed the 'peerCertificateId' variable and label in TLSHandshakeEvent to 'certificateId'. This allows the event data to be co-displayed in JMC views which share the same type of data (@CertificateId). I've uploa

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-16 Thread Seán Coffey
I've renamed the 'peerCertificateId' variable and label in TLSHandshakeEvent to 'certificateId'. This allows the event data to be co-displayed in JMC views which share the same type of data (@CertificateId). I've uploaded an example screenshot [1] I've also made an adjustment to the TestModule

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-14 Thread Seán Coffey
Thanks for the comments Weijun. As per other review thread, I'm now recording all properties set via Security.setProperty(String, String). regards, Sean. On 14/11/2018 01:11, Weijun Wang wrote: Confused. Aren't all Security properties security-related? This is not about normal system prope

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-14 Thread Seán Coffey
Hi Sean, comments inline.. On 13/11/2018 18:53, Sean Mullan wrote: Looking good, a couple of comments/questions: * src/java.base/share/classes/java/security/Security.java The isJdkSecurityProperty method could return false positives, for example there may be a non-JDK property starting with

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-14 Thread Sean Mullan
On 11/13/18 1:53 PM, Sean Mullan wrote: * src/java.base/share/classes/sun/security/x509/X509CertImpl.java  158 // Event recording cache list  159 private List recordedCerts; Shouldn't this be static? Otherwise each certificate would have it's own instance and duplicates would not be

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-14 Thread Sean Mullan
On 11/13/18 8:11 PM, Weijun Wang wrote: Confused. Aren't all Security properties security-related? This is not about normal system properties. Although probably not that common, an application could create their own security properties, ex: Security.setProperty("security.myPassword", "abc123

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-13 Thread Weijun Wang
Confused. Aren't all Security properties security-related? This is not about normal system properties. And the method name in the latest webrev is "isSecurityProperty" without the "JDK" word. I assume this means you don't care about the difference between SE properties and JDK properties. --Ma

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-13 Thread Sean Mullan
Looking good, a couple of comments/questions: * src/java.base/share/classes/java/security/Security.java The isJdkSecurityProperty method could return false positives, for example there may be a non-JDK property starting with "security.". I was thinking it would be better to put all the JDK pro

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-09 Thread Seán Coffey
Erik, comments inline.. On 08/11/18 15:12, Erik Gahlin wrote: Hi Sean, I think we could still call the event "jdk.SecurityPropertyModification", but add a @Description that explains that events are only emitted for the JDK due to security concerns. If we at a later stage want to include user

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-08 Thread Erik Gahlin
Hi Sean, I think we could still call the event "jdk.SecurityPropertyModification", but add a @Description that explains that events are only emitted for the JDK due to security concerns. If we at a later stage want to include user events, we could add those and remove the @Description, possib

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-11-06 Thread Seán Coffey
With JDK-8203629 now pushed, I've re-based my patch on latest jdk/jdk code. Some modifications also made based on off-thread suggestions : src/java.base/share/classes/java/security/Security.java * Only record JDK security properties for now (i.e. those in java.security conf file)   - we can co

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-10-17 Thread Seán Coffey
I'd like to re-boot this review. I've been working with Erik off thread who's been helping with code and test design. Some of the main changes worthy of highlighting : * Separate out the tests for JFR and Logger events * Rename some events * Normalize the data view for X509ValidationEvent (old

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-07-10 Thread Seán Coffey
Erik, After some trial edits, I'm not so sure if moving the event & logger commit code into the class where it's used works too well after all. In the code you suggested, there's an assumption that calls such as EventHelper.certificateChain(..) are low cost. While that might be the case here

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-07-09 Thread Seán Coffey
Erik, Thanks for reviewing. Comments inline.. On 09/07/18 17:21, Erik Gahlin wrote: Thanks Sean. Some feedback on the code in the security libraries. - We should use camel case naming convention for variables (not underscore). Sure. I see two offending variable names which I'll fix up. -

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-07-09 Thread Erik Gahlin
Thanks Sean. Some feedback on the code in the security libraries. - We should use camel case naming convention for variables (not underscore). - Looking at sun/security/ssl/Finished.java, I wonder if it wouldn't be less code and more easy to read, if we would commit the event in a local priva

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-07-09 Thread Seán Coffey
As per request from Erik, I separated the tests out into individual ones to test the JFR and Logger functionality. I introduced a new separate test for the CertificateChainEvent event also. Originally this was wrapped into the TLSHandshakeEvent test. Thanks to Erik for extra refactoring and mo

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-07-02 Thread Erik Gahlin
> On 29 Jun 2018, at 17:34, Seán Coffey wrote: > > I've introduced a new test helper class in the jdk/test/lib/jfr directory to > help with the dual test nature of the new tests. It's helped alot with test > code duplication. > My thinking was to put things like the certificates in a separ

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-29 Thread Seán Coffey
I've introduced a new test helper class in the jdk/test/lib/jfr directory to help with the dual test nature of the new tests. It's helped alot with test code duplication. Looked at use of @DataAmount(DataAmount.BITS) also. Not sure if it's fits. The output is displayed in units like "KiB" - no

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-28 Thread Seán Coffey
Comments inline. On 28/06/2018 17:20, Erik Gahlin wrote: It's sufficient if an event object escapes to another method (regardless if JFR is enabled or not). Some more feedback: Rename event jdk.CertChain to jdk.CertificateChain Rename event jdk.X509Cert to jdk.X509Certificate Rename field ce

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-28 Thread Erik Gahlin
It's sufficient if an event object escapes to another method (regardless if JFR is enabled or not). Some more feedback: Rename event jdk.CertChain to jdk.CertificateChain Rename event jdk.X509Cert to jdk.X509Certificate Rename field certChain to certificateChain. Rename field serialNum to seria

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-28 Thread Xuelei Fan
Looks fine to me. Thanks! Xuelei On 6/28/2018 5:28 AM, Seán Coffey wrote: Thanks for reviewing Xuelei, I do acknowledge that the new TLS v1.3 code has greatly improved the logging output for related operations. I think the main drive with this enhancement is to use the new JFR API to captur

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-28 Thread Seán Coffey
Thanks for the update Erik. By default I'm proposing that the new JFR Events and Logger be disabled. As a result the event class shouldn't escape. If performance metrics highlight an issue, we should revisit. regards, Sean. On 27/06/2018 20:57, Erik Gahlin wrote: On 2018-06-27 21:14, Seán Co

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-28 Thread Seán Coffey
Thanks for reviewing Xuelei, I do acknowledge that the new TLS v1.3 code has greatly improved the logging output for related operations. I think the main drive with this enhancement is to use the new JFR API to capture interesting events. We can revisit the Logger requirements if there's a str

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-27 Thread Xuelei Fan
Finished.java - In each handshake, Finished messages are delivered twice. One from client, and the other one from the server side. Catch Finished message and use the final one of them should be sufficient. In the Finished.java implementation, the signal of the final Finished mes

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-27 Thread Erik Gahlin
On 2018-06-27 21:14, Seán Coffey wrote: On 27/06/2018 19:57, Xuelei Fan wrote: Hi Sean, I may reply in several replies. PKIXMasterCertPathValidator.java + CertChainEvent cce = new CertChainEvent(); + if(cce.isEnabled() || EventHelper.loggingSecurity()) { +

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-27 Thread Xuelei Fan
KeyUtil.java 167 public static String getKeyAlgorithm(Key key) { I may suggest remove this method and use Key.getAlgorithm() directly. The KeyUtil.getKeyAlgorithm() is incomplete, and may need additional maintenance if new key algorithms are added in the future. For example, in

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-27 Thread Seán Coffey
On 27/06/2018 19:57, Xuelei Fan wrote: Hi Sean, I may reply in several replies. PKIXMasterCertPathValidator.java +  CertChainEvent cce = new CertChainEvent(); +  if(cce.isEnabled() || EventHelper.loggingSecurity()) { +  String c = reversedCertList.stream(

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-27 Thread Xuelei Fan
Hi Sean, I may reply in several replies. PKIXMasterCertPathValidator.java + CertChainEvent cce = new CertChainEvent(); + if(cce.isEnabled() || EventHelper.loggingSecurity()) { + String c = reversedCertList.stream() + .map(x -> x.getSerialN

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-26 Thread Seán Coffey
Erik, I rebased the patch with TLS v1.3 integration today. I hadn't realized how much the handshaker code had changed. Hopefully, I'll get a review from security dev team on that front. Regards the JFR semantics, I believe the edits should match majority of requests . I still have a preferen

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-25 Thread Seán Coffey
Many thanks for the review comments Erik. Replies inline. On 24/06/2018 14:21, Erik Gahlin wrote: Hi Sean, Some of the changes in the webrev belongs to JDK-8203629 and should be removed for clarity. Some initial comments: default.jfc, profile.jfr: The events should not have control="enable

Re: RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-24 Thread Erik Gahlin
Hi Sean, Some of the changes in the webrev belongs to JDK-8203629 and should be removed for clarity. Some initial comments: default.jfc, profile.jfr: The events should not have control="enable-exceptions". The purpose of the control attribute is so to provide parameterized configuration of

RFR: 8148188: Enhance the security libraries to record events of interest

2018-06-22 Thread Seán Coffey
Following on from the recent JDK-8203629 code review, I'd like to propose enhancements on how we can record events in security libs. The introduction of the JFR libraries can give us much better ways of examining JDK actions. For the initial phase, I'm looking to enhance some key security libra