Skip to content

Conversation

@coffeys
Copy link
Contributor

@coffeys coffeys commented May 29, 2025

Removal of the +thread and +timestamp options that were used to control the logging behavior of output from the java.security.debug system property.

To enhance the security debug logs, the thread and timestamp data should always be present. This brings it to a par with another important security debug system property, the TLS debug property: javax.net.debug. Output from the TLS javax.net.debug logs always contains thread and timestamp data.

This patch remove the +thread and +timestamp support code and print thread and timestamp data by default. This enancement is only proposed for the JDK feature release. Update releases can continue to opt into such data.

Debug output data from use of the java.security.debug property will now resemble something like the following:

properties[0x10|main|Security.java:122|2025-05-01 14:59:42.859 UTC]: Initial security property: package.definition=sun.misc.,sun.reflect.
properties[0x10|main|Security.java:122|2025-05-01 14:59:42.859 UTC]: Initial security property: krb5.kdc.bad.policy=tryLast

I've also trimmed back on some of the test case coverage since use of +thread and +timestamp options is now redundant with this patch.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8358090 to be approved

Issues

  • JDK-8350689: Turn on timestamp and thread metadata by default for java.security.debug (Enhancement - P4)
  • JDK-8358090: Turn on timestamp and thread details by default for java.security.debug (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25528/head:pull/25528
$ git checkout pull/25528

Update a local copy of the PR:
$ git checkout pull/25528
$ git pull https://git.openjdk.org/jdk.git pull/25528/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25528

View PR using the GUI difftool:
$ git pr show -t 25528

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25528.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 29, 2025

👋 Welcome back coffeys! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 29, 2025

@coffeys This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8350689: Turn on timestamp and thread metadata by default for java.security.debug

Reviewed-by: mullan

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 21 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title 8350689 8350689: Turn on timestamp and thread metadata by default for java.security.debug May 29, 2025
@openjdk openjdk bot added csr Pull request needs approved CSR before integration rfr Pull request is ready for review labels May 29, 2025
@openjdk
Copy link

openjdk bot commented May 29, 2025

@coffeys The following label will be automatically applied to this pull request:

  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the security security-dev@openjdk.org label May 29, 2025
@mlbridge
Copy link

mlbridge bot commented May 29, 2025

Webrevs

Copy link
Contributor

@mcpowers mcpowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might need to append 8350689 to @bug in a few test programs.

"",
"krb5loginmodule"),
// thread info only
// thread and timestamp on by default now
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"now" will be confusing ten years from now.

private static Stream<Arguments> patternMatches() {
return Stream.of(
// no extra info present
// thread and timestamp info on by default now
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove "now"

// thread info only
EXPECTED_PROP_REGEX,
"properties:"),
// thread and timestamp info on by default now
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove "now"

@wangweij
Copy link
Contributor

Looks great. Do you need a CSR?

@openjdk openjdk bot removed the rfr Pull request is ready for review label May 30, 2025
@coffeys
Copy link
Contributor Author

coffeys commented May 30, 2025

Looks great. Do you need a CSR?

Yes - need a reviewer for CSR: https://bugs.openjdk.org/browse/JDK-8358090

Thanks.

I've taken Mark's comments on board. I removed the comment referring to default "on" also since there is no concept of on/off for this option anymore.

@wangweij
Copy link
Contributor

I added my name as a reviewer to the CSR. The Summary section currently has "This CSR proposes to turn that data on by default". You may just say "turn that data on always".

<p> To monitor security access, you can set the <code>java.security.debug</code>
system property, which determines what trace messages are printed during
execution. The value of the property is one or more options separated by a
comma.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we add a sentence to this paragraph noting that each trace message also includes the thread id, timestamp, and caller information.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Added

"Each trace message includes the thread id, timestamp and caller information." to this paragraph

@seanjmullan
Copy link
Member

What is the behavior if someone had added these options in JDK 23 and is now debugging the same code with JDK 25? Are they ignored? The CSR should also note the behavior.

@openjdk openjdk bot added the rfr Pull request is ready for review label May 30, 2025
@coffeys
Copy link
Contributor Author

coffeys commented May 30, 2025

What is the behavior if someone had added these options in JDK 23 and is now debugging the same code with JDK 25? Are they ignored? The CSR should also note the behavior.

I've added this clarification to the CSR:

Continued use of the +thread and +timestamp options will no longer have impact. The thread and timestamp data is always printed and valid security components used in the java.security.debug property will continue to be logged.

Comment on lines 55 to 56
comma. Each trace message includes the thread id, timestamp and caller
information.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, but I would list this in the order they are printed: "thread id, caller information, and timestamp".

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Jun 3, 2025
@coffeys
Copy link
Contributor Author

coffeys commented Jun 4, 2025

/integrate

@openjdk
Copy link

openjdk bot commented Jun 4, 2025

Going to push as commit 42f48a3.
Since your change was applied there have been 36 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 4, 2025
@openjdk openjdk bot closed this Jun 4, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 4, 2025
@openjdk
Copy link

openjdk bot commented Jun 4, 2025

@coffeys Pushed as commit 42f48a3.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated security security-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

4 participants