-
Notifications
You must be signed in to change notification settings - Fork 84
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
WIP - Add nonce validation in PoP token verifier #367
base: master
Are you sure you want to change the base?
WIP - Add nonce validation in PoP token verifier #367
Conversation
d4a3aca
to
19be0ef
Compare
time.Sleep(2 * time.Second) | ||
|
||
_, err = verifierNonce.ValidatePopToken(validToken) | ||
assert.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this have an error since the PoP token is only valid for 1 second according to the NewPoPVerifier
call on line 313, and it's been 2 seconds since the token was created?
@julienstroheker is this PR still open? |
Yes. I was waiting the UT refactor pr to merge first. |
7394192
to
c4e6be9
Compare
e6b3b70
to
5aa0f6e
Compare
* add pop token nonce validation Signed-off-by: Julien Stroheker <juliens@microsoft.com> * add details on UT Signed-off-by: Julien Stroheker <juliens@microsoft.com> * Safe map lock + Uts update Signed-off-by: Julien Stroheker <juliens@microsoft.com> * review Signed-off-by: Julien Stroheker <juliens@microsoft.com> * gen fmt Signed-off-by: Julien Stroheker <juliens@microsoft.com> * Fixing ut race Signed-off-by: Julien Stroheker <juliens@microsoft.com> * using len Signed-off-by: Julien Stroheker <juliens@microsoft.com> * ut reusing nonce with different ts Signed-off-by: Julien Stroheker <juliens@microsoft.com> * Using same token different ts on UT Signed-off-by: Julien Stroheker <juliens@microsoft.com> * remove unused param Signed-off-by: Julien Stroheker <juliens@microsoft.com> * lint issue Signed-off-by: Julien Stroheker <juliens@microsoft.com> * save work * update UTs * review --------- Signed-off-by: Julien Stroheker <juliens@microsoft.com>
Signed-off-by: Julien Stroheker <juliens@microsoft.com>
b8e33bf
to
c358321
Compare
Still holding this PR due to changes we do on RBAC. This requires more tests + to review PR comments. PLEASE DO NOT MERGE |
Signed-off-by: Julien Stroheker <juliens@microsoft.com>
Signed-off-by: Julien Stroheker <juliens@microsoft.com>
Signed-off-by: Julien Stroheker <juliens@microsoft.com>
"github.com/pkg/errors" | ||
"gopkg.in/square/go-jose.v2/jwt" | ||
"k8s.io/klog/v2" | ||
) | ||
|
||
// // create a cache to save nonce claim to make sure the nonce is not reused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be removed
Making sure nonce claim is not been re-used more than once on each requests.
nonce
claim value into a map (cache)nonce
claims by checking the values in the cache.