• Stars
    star
    230
  • Rank 174,053 (Top 4 %)
  • Language
    Kotlin
  • License
    Other
  • Created almost 6 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Don't leak sensitive data.
                                . .....                                     
                             .=OO:....$ZZ..                                 
                            .O........,~=+Z.                                
                           =Z ..,:~=~~=+???Z.                               
                          .Z .,+++++++???I7IZ.                              
                          .O.~7??????????7$7Z.                              
                          .?.+ZO+~,???..+Z.$Z.                              
                          .,.OZOOOZI?IOZ$ZII7.                              
                        .O,7,O7,+~Z=??:I7?ZI7+Z.                            
                        .O7+.$=~=+O++??+==~=7ZO.                            
                        .ZZ..IIIOOZI?IIO7+=IIZO.                            
                         .O..?O$ZI7?????7$II7Z.                             
                          OZ.,77Z=$$$I?I??7?ZOO                             
                          .Z..O$ZIZZ$????=I7ZO.                             
                           O...O~Z+~:=+II$$7~                               
                            Z,Z:+.OZ7ZZ$7Z?O.                               
                            O.ZOZOOOOOZ7I+?O...                             
                           .Z.$OZZOO77$7+=?Z.O~.                            
                    ......OO..$OZOOZ7I$?~+?=$Z...                           
             .,OZZO$,.... .,...OOOOI???++++O. =..ZZZZOO+...                 
          .=OI.            .   .OZ$???$OZ. .,~    ..,:~~~=ZO.               
         .O..                                         ..:===OO.             
        ,Z..                                             ,===:O.            
       .O.,.     ..                                      .~===,Z            
      .Z.,,.OZOZZOOZZ.                               ... .,====:Z           
     .Z..,O..?...++=?=Z.                           ...~.  .,::==Z:.         
    .O:...Z...?...=?+++IO..      ....+ZZOOO.....  .Z:+:.......~==O.         
    .Z..,:,ZZ+:.+Z7?????=O,IOZZZO..,+??????++++=ZZ,~OOI??++7OZ===~Z.        
    Z..OOI. .IZ$ZZI......   ..:+???????????????????+7Z7??~~+++ZZ==O.        
    O.O.,+  ..,~=+???~.,=?????????????????IZZ7????II?I$??==+++IZOO~Z        
    OO. .,~??????????????????????+++?I$Z77ZZZZOOOZZ7I?+??I??++?$$?ZO        
    O:.:7$I???????????????II?+++?IZZZ7ZO?$ZZZZ7+======+++++===?77?$O        
    .O+ZZZ$III7$ZZZZZZ7I?+++?I$OOO$O$??????++++++++??????????+?I?+O.        
    .OZOOOOOOZZ$$7I?++++?I$ZOOO$ZZ??+????????????????????????????$.         
    ,ZZOOOOZ$I?????????$ZOOZ7+~:,....,I7II??+++==~:,..,+?????????Z.         
    .OZZZZOZZZZ+,..... :::~...Z$$.$$.=$II$$=........$$.,==++++??+Z.         
     OOZZZZOOO$.$$..$..=  .$$$$$=,$=.,......$$$Z.$7.$$.ZIIII????+O.         
      OZZZ$ZZZ+.$$.~$.$. .$$$   .$$..I$ZZ.Z$.Z$.$$..$.$IOOOOOOZOOO          
       .,ZOOZZ:~.$$IZ$...$$$    .$$.$$.$7=$..$$.$$ $Z.ZZZZZ$$7ZO,           
              .$.$.I.. .$$$.    $$.$$$Z..$$.$$=,$..$$.O?$OZZZZ..            
              ...7OOO..$$$.    .$$.$$  ..$$$7$.7,...,Z.$~                   
             ..       .$$$.    .$$.$$$$,......OZZ,.                         
                      .$$$.  ..$$......ZO.$..                               
                       Z$$$$$$Z..OZ....                                     
                      ..?$$$..OZ                                            
                        $OOOZ,.                                             

Mr. Clean

Let Mr. Clean keep your logs clean of sensitive data.

Imagine you have the following model

data class SensitiveData(val creditCardNumber: String, val socialSecurityNumber: String)

This model might be inadvertently logged, leaking sensitive data to the world. One way to get around this is to override toString and manage your state.

data class SensitiveData(val creditCardNumber: String, val socialSecurityNumber: String) {
	override toString(): String {
		if (BuildConfig.DEBUG) {
			return "SensitiveData(
				creditCardNumber='$creditCardNumber'
				socialSecurityNumber='$socialSecurityNumber'
				)"
		}
		else {
			return "SensitiveData@${Integer.toHexString(hashCode())}"
		}
	}
}

But now you have to make sure this stays updated when you add/remove properties.

Enter Mr. Clean

Annotate your class with @Sanitize and delegate to the generated sanitizedToString function:

@Sanitize
data class SensitiveData(val creditCardNumber: String, val socialSecurityNumber: String) {
	override toString() = sanitizedToString()
}

Note: You don't have to build to get this function! The Gradle plugin will generate a default Any.sanitizedToString for use in the IDE.

Mr. Clean manages the implementation of the toString for you.

// in a debuggable build
inline fun SensitiveData.sanitizedToString(condition: Boolean): String =
        "SensitiveData(creditCardNumber = $creditCardNumber, socialSecurityNumber = $socialSecurityNumber)"

// in a non-debuggable build
inline fun SensitiveData.sanitizedToString(condition: Boolean): String = "SensitiveData@${Integer.toHexString(hashCode())}"

Don't leak sensitive info ever again, trust in Mr. Clean.

Usage

buildscript {
  repositories {
    mavenCentral()
    google()
   }
  dependencies {
    classpath 'com.trello.mrclean:mr-clean-plugin:1.2.0'
  }
}

and then apply to your modules

apply plugin: 'com.trello.mrclean'

Contributors

Pull requests, issues and comments welcome. For pull requests:

  • Add tests for new features and bug fixes
  • Follow the existing style
  • Separate unrelated changes into multiple pull requests

See the existing issues for things to start contributing.

For bigger changes, make sure you start a discussion first by creating an issue and explaining the intended change.

Atlassian requires contributors to sign a Contributor License Agreement, known as a CLA. This serves as a record stating that the contributor is entitled to contribute the code/documentation/translation to the project and is willing to have it used in distributions and derivative works (or is willing to transfer ownership).

Prior to accepting your contributions we ask that you please follow the appropriate link below to digitally sign the CLA. The Corporate CLA is for those who are contributing as a member of an organization and the individual CLA is for those contributing as an individual.

License

Copyright (c) 2018 Atlassian and others. Apache 2.0 licensed, see LICENSE file.

More Repositories

1

RxLifecycle

Lifecycle handling APIs for Android apps using RxJava
Java
7,720
star
2

victor

Use SVGs as resources in Android
Java
1,007
star
3

navi

Adds listening capabilities to Activities and Fragments
Java
617
star
4

scientist

A Node.js library for carefully refactoring critical paths in production
CoffeeScript
408
star
5

trellisheets

Guidelines, resources, and examples for writing CSS for Trello
HTML
253
star
6

iconathon

An icon task runner that convert Sketch files to mobile and web formats.
CoffeeScript
219
star
7

power-up-template

A static GitHub pages hosted sample Power-Up
JavaScript
123
star
8

trello-ios-assisted-onboarding

This project is a simple iOS App that hosts the Trello iOS Assisted Onboarding screens.
Swift
44
star
9

node-dependencies

Check out-of-date dependencies for your Node.js app
JavaScript
34
star
10

chromello

A sample Chrome extension written for Trello with a few great features.
JavaScript
32
star
11

api-docs

The documentation site for the Build with Trello content
27
star
12

weather-power-up

A small sample Power-Up for Trello that shows weather data on cards
JavaScript
21
star
13

trellicolors

Converts the Trello brand colors to various formats.
CoffeeScript
19
star
14

category-theory

sometimes math is just too much fun
19
star
15

node-coffee-cache

Caches the contents of required CoffeeScript files so that they are not recompiled to help improve startup time
JavaScript
18
star
16

full-name-splitter

Attempts to split a Latinesque fullname into first name and last name components
JavaScript
17
star
17

glitch-trello-power-up

Example Glitch Project Using Many Power-up Capabilities
JavaScript
15
star
18

glitch-power-up-tutorial-part-one

JavaScript
12
star
19

node-coffee-backtrace

Give some context to uncaught exceptions for Node.js projects written in CoffeeScript
JavaScript
7
star
20

diplomat

A Slack bot for making international collaboration and communication more seamless.
JavaScript
6
star
21

support-team-bookmarklets

Some bookmarklets you can run while using Trello
JavaScript
6
star
22

hearsay

A library for observing things
CoffeeScript
6
star
23

staunton

The massive multiplayer Chess game slash ✨ ReactiveCocoa tutorial ✨
Objective-C
6
star
24

magellan

Mapping and routing for REST endpoints
Objective-C
4
star
25

trello.cards

Less
3
star
26

power-up-on-heroku

A simple Trello Power-Up hosted on Heroku.
JavaScript
3
star
27

code-snippets

Trello Code Snippets Power-Up
JavaScript
3
star
28

yeoman-generator-trello

A Yeoman generator for quickly getting started with the Trello API.
JavaScript
2
star
29

url-parse-fix-auth

Fix url.parse to work with percent (%) characters in auth strings
JavaScript
2
star