Skip to content

Why does System.Formats.Nrbf.ArrayRecord.GetArray require the type of the object in the array? #108625

Answered by huoyaoyuan
qsc-jhndnn asked this question in Q&A
Discussion options

You must be logged in to vote

GetArray lets the NRBF library creates the array and objects for you. For security manner, it must not create a type that the caller code is not aware of.

I was able to create an empty shell of the class with the same name/namespace without any members at all and was able to deserialize without any issues.

This is safe because the code of the type has clearly no risk. It also guarantees that the payload doesn't contain other types.

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by jeffhandley
Comment options

You must be logged in to vote
1 reply
@huoyaoyuan
Comment options

Comment options

You must be logged in to vote
1 reply
@huoyaoyuan
Comment options

Comment options

You must be logged in to vote
3 replies
@qsc-jhndnn
Comment options

@qsc-jhndnn
Comment options

@adamsitnik
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants