-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#10 Password Hashes and API Tokens Returned in Response
Summary: - Removed fields with sensitive data from users information. Test Plan: Scenario. 1. Login YW. 2. Open the browser developers panel; tab 'Network'; type of packets 'XHR'; (captions are from Chrome, could differ for other browsers); 3. In YW: go to 'Profile' (from the dropdown list under the user icon in right upper corner); open tab 'Users'; 4. In developers panel: Find a request ''users", select the "Preview" mode in right panel of the developers panel; check that each user's description (data) doesn't have fields 'passwordHash' and 'apiToken' (see the picture). {F14340} Reviewers: daniel Reviewed By: daniel Subscribers: jenkins-bot, yugaware, wesley Differential Revision: https://phabricator.dev.yugabyte.com/D9785
- Loading branch information
1 parent
c1462a1
commit ce47c60
Showing
2 changed files
with
11 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,24 +3,15 @@ | |
package com.yugabyte.yw.models; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.yugabyte.yw.common.ApiUtils; | ||
import com.yugabyte.yw.common.ModelFactory; | ||
import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; | ||
import org.apache.commons.lang3.RandomStringUtils; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mindrot.jbcrypt.BCrypt; | ||
import play.libs.Json; | ||
|
||
import com.yugabyte.yw.common.FakeDBApplication; | ||
|
||
import javax.persistence.PersistenceException; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
import static com.yugabyte.yw.models.Users.Role; | ||
import static org.junit.Assert.*; | ||
|
||
|
@@ -136,4 +127,13 @@ public void testSetRole() { | |
assertEquals(fetchUser.getRole(), Role.ReadOnly); | ||
} | ||
|
||
@Test | ||
public void testNoSensitiveDataInJson() { | ||
Users u = Users.create("[email protected]", "password", Role.Admin, customer.uuid); | ||
assertNotNull(u.uuid); | ||
|
||
JsonNode json = Json.toJson(u); | ||
assertEquals(false, json.has("passwordHash")); | ||
assertEquals(false, json.has("apiToken")); | ||
} | ||
} |