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

fix: Do not allow broken session token by SN #2727

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

carpawell
Copy link
Member

If container session token is incorrect, there is no need in Alphabet's check, the error can be returned immediately to a client; otherwise he has to wait for the TX to persist infinitely with not feedback. Closes #2466.

@carpawell carpawell self-assigned this Jan 22, 2024
@carpawell carpawell force-pushed the fix/container-session branch 2 times, most recently from 84c62b9 to e571e4d Compare January 22, 2024 19:42
Copy link
Contributor

@cthulhu-rider cthulhu-rider left a comment

Choose a reason for hiding this comment

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

talking about system testing: with these changes, broken sessions' verification by the IR wont be tested anymore since SNs wont bypass such sessions, right? IR tests are critical, so we must not lose them

@@ -19,6 +19,7 @@ Changelog for NeoFS Node
- Created files are not group writable (#2589)
- IR does not create new notary requests for the SN's bootstraps but signs the received ones instead (#2717)
- IR can handle third-party notary requests without reliance on receiving the original one (#2715)
- SN validates container session token's issuer to be container's owner (#2466)
Copy link
Contributor

Choose a reason for hiding this comment

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

not only ownership is validated

Copy link
Member Author

Choose a reason for hiding this comment

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

do you mean providing a list there? the issue has the exact problem described

Copy link
Contributor

@cthulhu-rider cthulhu-rider Jan 25, 2024

Choose a reason for hiding this comment

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

imo issue is just a ref, changelog contains meaningful changes. Full list is an overhead, i'd say

Suggested change
- SN validates container session token's issuer to be container's owner (#2466)
- SN now validates container session tokens (#2466)

pkg/services/container/morph/executor.go Outdated Show resolved Hide resolved
pkg/services/container/morph/executor.go Show resolved Hide resolved
pkg/services/container/morph/executor.go Outdated Show resolved Hide resolved
pkg/services/container/morph/executor.go Outdated Show resolved Hide resolved
pkg/services/container/morph/executor.go Show resolved Hide resolved
pkg/services/container/morph/executor.go Outdated Show resolved Hide resolved
pkg/services/container/morph/executor.go Outdated Show resolved Hide resolved
pkg/services/container/morph/executor.go Outdated Show resolved Hide resolved
return fmt.Errorf("session session was issued not by the owner, issuer: %x", issuer)
}

return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

why are not all fields checked?

Copy link
Member Author

Choose a reason for hiding this comment

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

what else fields to check? that is not IR validation before we try to change smth, just a logical validation that you are not trying to make totally incorrect things (container owner do not know about your operation but you still trying it). did not want to copy IR behavior

epoch can not be ensured: the final check will be done on the IR side, no one knows at what state and when

Copy link
Contributor

Choose a reason for hiding this comment

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

there are other stateless conditions like lifetime field presence, signature correctness, etc. And some stateful conditions are consistent, e.g. expiraiton claim

Copy link
Member Author

@carpawell carpawell Jan 25, 2024

Choose a reason for hiding this comment

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

there are other stateless conditions like lifetime field presence

i would say it is more like a protocol validation (if we are talking about the presence, and epoch values i wouldn't check by the intermediate SN ever, as I've already said)

signature correctness

well... ok, done but not valuable to me

Copy link
Contributor

Choose a reason for hiding this comment

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

well... ok, done but not valuable to me

words of some undefined behavior...

@carpawell
Copy link
Member Author

with these changes, broken sessions' verification by the IR wont be tested anymore since SNs wont bypass such sessions, right?

Seems so. But that is how the issues like "do not want to wait too long before IR reacts, pls, make it on the SN side" are fixed. Do not see any problems here.

IR tests are critical, so we must not lose them

Can be checked with neo-go and notary requests anyway.

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (895559b) 28.81% compared to head (53dc640) 28.84%.

❗ Current head 53dc640 differs from pull request most recent head f8620ff. Consider uploading reports for the commit f8620ff to get more accurate results

Files Patch % Lines
pkg/services/container/morph/executor.go 66.66% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2727      +/-   ##
==========================================
+ Coverage   28.81%   28.84%   +0.03%     
==========================================
  Files         415      415              
  Lines       32397    32427      +30     
==========================================
+ Hits         9335     9355      +20     
- Misses      22228    22233       +5     
- Partials      834      839       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/services/container/morph/executor.go Outdated Show resolved Hide resolved
If container session token is incorrect, there is no need in Alphabet's check,
the error can be returned immediately to a client; otherwise he has to wait for
the TX to persist infinitely with not feedback. Closes #2466.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
@cthulhu-rider
Copy link
Contributor

Can be checked with neo-go and notary requests anyway.

not everybody will be ready for this. I'd add a remark to Updating section of the changelog

@carpawell
Copy link
Member Author

I'd add a remark to Updating section of the changelog

Not sure what an updater should see in this line. Not sure how @532910 will react. But I tried a little.

@cthulhu-rider
Copy link
Contributor

But I tried a little.

anything i can look at?

@roman-khimov roman-khimov merged commit 8027ca3 into master Jan 26, 2024
8 of 9 checks passed
@roman-khimov roman-khimov deleted the fix/container-session branch January 26, 2024 13:05
@carpawell
Copy link
Member Author

anything i can look at?

Oh, has not pushed, my bad.

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.

Possible incorrect error when a container is deleted by a static session token without the right permissions
3 participants