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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changelog for NeoFS Node
### Fixed
- Resending the header after chunks have already been sent in object service `Get` handler (#3833)
- GC deadlock on local object storage shutdown (#3837)
- `owner mismatches signature` for stored objects (#3836)

### Changed

Expand Down
5 changes: 4 additions & 1 deletion internal/crypto/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"

"github.com/nspcc-dev/neofs-node/pkg/core/version"
neofscrypto "github.com/nspcc-dev/neofs-sdk-go/crypto"
neofsecdsa "github.com/nspcc-dev/neofs-sdk-go/crypto/ecdsa"
"github.com/nspcc-dev/neofs-sdk-go/object"
Expand Down Expand Up @@ -78,7 +79,9 @@ func AuthenticateObject(obj object.Object, fsChain HistoricN3ScriptRunner, ecPar
if !verifyECDSAFns[scheme](*ecdsaPub, sig.Value(), obj.GetID().Marshal()) {
return schemeError(scheme, errSignatureMismatch)
}
if sessionToken == nil && sessionTokenV2 == nil && !ecPart && user.NewFromECDSAPublicKey(*ecdsaPub) != obj.Owner() {
if sessionToken == nil && sessionTokenV2 == nil && !ecPart &&
user.NewFromECDSAPublicKey(*ecdsaPub) != obj.Owner() &&
version.OwnerSignatureMatchRequired(obj.Version()) {
return errors.New("owner mismatches signature")
}
case neofscrypto.N3:
Expand Down
18 changes: 18 additions & 0 deletions pkg/core/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ func SysObjTargetShouldBeInHeader(v *version.Version) bool {
(v.Major() == latestSysObjTargetInPayloadMjr && v.Minor() > latestSysObjTargetInPayloadMnr)
}

// OwnerSignatureMatchRequired returns true if an object with the given version
Copy link
Member

Choose a reason for hiding this comment

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

i would add some info that this was kinda error before not like a regular API change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clarified the comment.

// must have the owner matching the signature's public key. Objects below version
// 2.18 may have a mismatching owner due to a bug that allowed creating such
// objects, so they should not be rejected.
func OwnerSignatureMatchRequired(v *version.Version) bool {
if v == nil || !IsValid(*v) {
return true // assume latest
}

const (
ownerMatchMjr = 2
ownerMatchMnr = 18
)

return v.Major() > ownerMatchMjr ||
(v.Major() == ownerMatchMjr && v.Minor() >= ownerMatchMnr)
}

// IsValid checks if Version is not earlier than the genesis version of the NeoFS.
func IsValid(v version.Version) bool {
const (
Expand Down
Loading