@@ -57,7 +57,6 @@ public function testDebugEnabled()
57
57
accessToken: $ _ENV ['CONVERTKIT_OAUTH_ACCESS_TOKEN ' ],
58
58
debug: true
59
59
);
60
-
61
60
$ result = $ api ->get_account ();
62
61
63
62
// Confirm that the log includes expected data.
@@ -114,26 +113,44 @@ public function testDebugCredentialsAndEmailsAreMasked()
114
113
debug: true
115
114
);
116
115
117
- // Create log entries with API Key and Email Address, as if an API method
116
+ // Create log entries with Client ID, Client Secret, Access Token and Email Address, as if an API method
118
117
// were to log this sensitive data.
119
- $ this ->callPrivateMethod ($ api , 'create_log ' , ['API Key: ' . $ _ENV ['CONVERTKIT_API_KEY ' ]]);
118
+ $ this ->callPrivateMethod ($ api , 'create_log ' , ['Client ID: ' . $ _ENV ['CONVERTKIT_OAUTH_CLIENT_ID ' ]]);
119
+ $ this ->callPrivateMethod ($ api , 'create_log ' , ['Client Secret: ' . $ _ENV ['CONVERTKIT_OAUTH_CLIENT_SECRET ' ]]);
120
+ $ this ->callPrivateMethod ($ api , 'create_log ' , ['Access Token: ' . $ _ENV ['CONVERTKIT_OAUTH_ACCESS_TOKEN ' ]]);
120
121
$ this ->callPrivateMethod ($ api , 'create_log ' , ['Email: ' . $ _ENV ['CONVERTKIT_API_SUBSCRIBER_EMAIL ' ]]);
121
122
122
- // Confirm that the log includes the masked API Key and Email Address.
123
+ // Confirm that the log includes the masked Client ID, Secret, Access Token and Email Address.
124
+ $ this ->assertStringContainsString (
125
+ str_repeat (
126
+ '* ' ,
127
+ (strlen ($ _ENV ['CONVERTKIT_OAUTH_CLIENT_ID ' ]) - 4 )
128
+ ) . substr ($ _ENV ['CONVERTKIT_OAUTH_CLIENT_ID ' ], -4 ),
129
+ $ this ->getLogFileContents ()
130
+ );
131
+ $ this ->assertStringContainsString (
132
+ str_repeat (
133
+ '* ' ,
134
+ (strlen ($ _ENV ['CONVERTKIT_OAUTH_CLIENT_SECRET ' ]) - 4 )
135
+ ) . substr ($ _ENV ['CONVERTKIT_OAUTH_CLIENT_SECRET ' ], -4 ),
136
+ $ this ->getLogFileContents ()
137
+ );
123
138
$ this ->assertStringContainsString (
124
139
str_repeat (
125
140
'* ' ,
126
- (strlen ($ _ENV ['CONVERTKIT_API_KEY ' ]) - 4 )
127
- ) . substr ($ _ENV ['CONVERTKIT_API_KEY ' ], -4 ),
141
+ (strlen ($ _ENV ['CONVERTKIT_OAUTH_ACCESS_TOKEN ' ]) - 4 )
142
+ ) . substr ($ _ENV ['CONVERTKIT_OAUTH_ACCESS_TOKEN ' ], -4 ),
128
143
$ this ->getLogFileContents ()
129
144
);
130
145
$ this ->assertStringContainsString (
131
146
'o****@n********.c** ' ,
132
147
$ this ->getLogFileContents ()
133
148
);
134
149
135
- // Confirm that the log does not include the unmasked API Key or Email Address.
136
- $ this ->assertStringNotContainsString ($ _ENV ['CONVERTKIT_API_KEY ' ], $ this ->getLogFileContents ());
150
+ // Confirm that the log does not include the unmasked Client ID, Secret, Access Token or Email Address.
151
+ $ this ->assertStringNotContainsString ($ _ENV ['CONVERTKIT_OAUTH_CLIENT_ID ' ], $ this ->getLogFileContents ());
152
+ $ this ->assertStringNotContainsString ($ _ENV ['CONVERTKIT_OAUTH_CLIENT_SECRET ' ], $ this ->getLogFileContents ());
153
+ $ this ->assertStringNotContainsString ($ _ENV ['CONVERTKIT_OAUTH_ACCESS_TOKEN ' ], $ this ->getLogFileContents ());
137
154
$ this ->assertStringNotContainsString ($ _ENV ['CONVERTKIT_API_SUBSCRIBER_EMAIL ' ], $ this ->getLogFileContents ());
138
155
}
139
156
0 commit comments