Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ public Response nuke() {
}

private void performReset() {
// Storage first. Services re-create their bootstrap state in clear(), and a wipe
// afterwards would remove it again until the next restart.
storageFactory.clearAll();
for (Resettable r : resettables) {
r.clear();
Comment on lines +151 to 153

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the mechanism is right, the failure is not.
hasIdentityStore() falls back to scanAllAccounts(), so a bootstrap instance seeded under another account's partition is still found.
Checked on a JVM build of this branch. A reset signed as 111111111111 followed by a default-account SCIM ServiceProviderConfig call returns 200, not 401.
ListInstances for the default account re-seeds its own partition on first use, and the misplaced entry is not visible to ListInstances of either account.

This is pre-existing behavior of ensureBootstrapInstance() and independent of the order change in this PR.
Using getForAccount/putForAccount there is a reasonable hardening, but it belongs in its own change.

Let's keep this PR small.

}
storageFactory.clearAll();
}

static String resolveVersion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ void stateReset_returnsOkOnAllPaths(String path) {
.body("status", equalTo("OK"));
}

@Test
void stateReset_keepsBootstrapStateOfServicesThatReseedOnClear() {
// IAM Identity Center recreates its bootstrap instance in clear(). A reset that wiped
// storage after that step left every SCIM call answering 401 until a restart.
given()
.when().post("/_floci/state/reset")
.then()
.statusCode(200);

given()
.header("Authorization", "Bearer floci-scim-token")
.when()
.get("/9067f2a3c1-00000000-0000-0000-0000-000000000000/scim/v2/ServiceProviderConfig")
.then()
.statusCode(200)
.body("schemas[0]", equalTo("urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"));
}

@Test
void stateReset_clearsDatabaseState() {
// 1. Put SSM parameter
Expand Down
Loading