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

Secret Keeper Application #745

Merged
merged 4 commits into from
Apr 22, 2024

Conversation

chenchanglew
Copy link
Contributor

What this PR does / why we need it:

Create a new demo application ~ Secret Keeper

Secret Keeper has 5 functions.
InitSecretKeeper:

  • This function will initialize the key "AUTH_LIST_KEY" with value ["Alice", "Bob"] and key "SECRET_KEY" with value "DefaultSecret".
  • This function should only be called once when the application started.
  • Of course a malicious user can call this function to reset the value, but this we will assume this is not what an attacker would want to achieve. RevealSecret:
  • This function allow users that in the Authlist ("AUTH_LIST_KEY") able to reveal the value of secret stored under key "SECRET_KEY". LockSecret:
  • This function allow users that in the Authlist ("AUTH_LIST_KEY") able to store a new value of secret under key "SECRET_KEY".
  • The old value will be replaced. AddUser:
  • This function allow users that in the Authlist ("AUTH_LIST_KEY") able to add a new user to the Authlist.
  • Then the new user can now perform the following four functions (RevealSecret, LockSecret, AddUser, RemoveUser) RemoveUser:
  • This function allow users that in the Authlist ("AUTH_LIST_KEY") able to add remove an existing user off the Authlist.
  • Then the removed user can no longer able to perform the following four functions (RevealSecret, LockSecret, AddUser, RemoveUser)

Example using fpc-simple-client:
./fpcclient invoke initSecretKeeper
./fpcclient query revealSecret Alice
./fpcclient invoke lockSecret Bob NewSecret
./fpcclient query revealSecret Alice
./fpcclient invoke removeUser Alice Bob
./fpcclient query revealSecret Alice
./fpcclient query revealSecret Bob // (will failed) ./fpcclient invoke addUser Alice Bob
./fpcclient query revealSecret Bob // (will success)

Which issue(s) this PR fixes:

This is just create a new application for ppc example

Special notes for your reviewer:

@chenchanglew chenchanglew requested a review from a team as a code owner November 21, 2023 15:21
@mbrandenburger
Copy link
Contributor

@chenchanglew Can you please rebase your PR as we merged the fix for the broken GH actions

@chenchanglew chenchanglew force-pushed the feature/secretkeeper branch 2 times, most recently from e345811 to c9880d4 Compare January 30, 2024 16:14
Secret Keeper has 5 functions.
InitSecretKeeper:
- This function will initialize the key "AUTH_LIST_KEY" with value ["Alice", "Bob"] and key "SECRET_KEY" with value "DefaultSecret".
- This function should only be called once when the application started.
- Of course a malicious user can call this function to reset the value, but this we will assume this is not what an attacker would want to achieve.
RevealSecret:
- This function allow users that in the Authlist ("AUTH_LIST_KEY") able to reveal the value of secret stored under key "SECRET_KEY".
LockSecret:
- This function allow users that in the Authlist ("AUTH_LIST_KEY") able to store a new value of secret under key "SECRET_KEY".
- The old value will be replaced.
AddUser:
- This function allow users that in the Authlist ("AUTH_LIST_KEY") able to add a new user to the Authlist.
- Then the new user can now perform the following four functions (RevealSecret, LockSecret, AddUser, RemoveUser)
RemoveUser:
- This function allow users that in the Authlist ("AUTH_LIST_KEY") able to add remove an existing user off the Authlist.
- Then the removed user can no longer able to perform the following four functions (RevealSecret, LockSecret, AddUser, RemoveUser)

Example using fpc-simple-client:
./fpcclient invoke initSecretKeeper
./fpcclient query revealSecret Alice
./fpcclient invoke lockSecret Bob NewSecret
./fpcclient query revealSecret Alice
./fpcclient invoke removeUser Alice Bob
./fpcclient query revealSecret Alice
./fpcclient query revealSecret Bob  // (will failed)
./fpcclient invoke addUser Alice Bob
./fpcclient query revealSecret Bob // (will success)

--------
* implement secret keeper demo
* debug
* create unit test mock rollback attack
---------

Co-authored-by: Chen Chang Lew <lew@stromness.zrl.ch.ibm.com>
Co-authored-by: tester <tester@fpc>
Signed-off-by: chenchanglew <chelew@student.ethz.ch>
Signed-off-by: chenchanglew <lewchenchang@gmail.com>
@chenchanglew chenchanglew force-pushed the feature/secretkeeper branch 2 times, most recently from 17fca80 to f45665c Compare January 31, 2024 09:13
Copy link
Contributor

@mbrandenburger mbrandenburger left a comment

Choose a reason for hiding this comment

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

What about adding a readme file in the chaincode secret-keeper folder with a description on what it does and how to use it.

@mbrandenburger
Copy link
Contributor

Thanks @chenchanglew, the added README looks good to me.

@munapower could you please check this PR? Thanks

Copy link
Contributor

@munapower munapower left a comment

Choose a reason for hiding this comment

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

Minor changes to readme to make it easier to follow.

samples/chaincode/secret-keeper-go/README.md Outdated Show resolved Hide resolved
samples/chaincode/secret-keeper-go/README.md Show resolved Hide resolved
@chenchanglew chenchanglew force-pushed the feature/secretkeeper branch 2 times, most recently from 58e4f79 to 3d78b59 Compare April 16, 2024 13:21
Signed-off-by: chenchanglew <lewchenchang@gmail.com>
Signed-off-by: chenchanglew <lewchenchang@gmail.com>
@chenchanglew
Copy link
Contributor Author

All the comments has been resolved

@mbrandenburger mbrandenburger merged commit 6ad8d82 into hyperledger:main Apr 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants