Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent instance methods of auth tokens from getting called in logging args #2113

Merged
merged 9 commits into from
Mar 16, 2022

Conversation

fawind
Copy link
Contributor

@fawind fawind commented Mar 16, 2022

Before this PR

Something like this would not get flagged by the existing error-prone check:

void myMethod(AuthHeader header) {
    log.info("msg", SafeArg.of("h", header.toString()));
}

After this PR

Instead of just checking that the type of the safe arg parameter is not an auth token, we can also verify that it is not the invocation of a method of an auth token.

Note that this only catches simple cases and can't handle indirections, e.g. header.toString() being called elsewhere and passed down to the arg.

==COMMIT_MSG==
Prevent instance methods of auth tokens from getting called in logging args
==COMMIT_MSG==

@fawind fawind requested a review from carterkozak March 16, 2022 13:58
@changelog-app
Copy link

changelog-app bot commented Mar 16, 2022

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Prevent instance methods of auth tokens from getting called in logging args

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from CRogers March 16, 2022 14:02
Copy link
Contributor

@carterkozak carterkozak left a comment

Choose a reason for hiding this comment

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

thanks!

@fawind
Copy link
Contributor Author

fawind commented Mar 16, 2022

👍

@bulldozer-bot bulldozer-bot bot merged commit d082f59 into develop Mar 16, 2022
@bulldozer-bot bulldozer-bot bot deleted the fw/token-to-string-logging branch March 16, 2022 14:25
@svc-autorelease
Copy link
Collaborator

Released 4.76.0

This was referenced Mar 16, 2022
bulldozer-bot bot pushed a commit to palantir/witchcraft-api that referenced this pull request Mar 16, 2022
###### _excavator_ is a bot for automating changes across repositories.

Changes produced by the roomba/latest-baseline-oss check.

# Release Notes
## 4.76.0
| Type | Description | Link |
| ---- | ----------- | ---- |
| Improvement | Prevent instance methods of auth tokens from getting called in logging args | palantir/gradle-baseline#2113 |



To enable or disable this check, please contact the maintainers of Excavator.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants