-
Notifications
You must be signed in to change notification settings - Fork 90
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
OCC-223: Upgrade to Orchard Core 1.8 #412
Conversation
@sarahelsaig Could you please checkout this ZAP report and determine how valid of these errors are? They were not present before now with .NET 8 and OC 1.8? maybe they came to live. |
It's nonsense. It tries to inject SQL text into In general I think the "The query time is controllable using parameter value [some SQL injection]" type errors are safe to ignore, because we never handle raw SQL and usually it's like a few hundred millisecond difference which can be simply random fluctuation, one request incidentally triggering .NET garbage collection and the other not, etc |
Okay now I resolved that. The following error still persist though and I also think that this is another close to nonsense error: So this by the URI that it whines about seems to be fine. I don't have that temp file that it cries about but under the SQLite snapshots this path seems to be fine and image is there. Can you spot something maybe that I can't? On CI there is a double |
Okay so the previous error is coming from a missing Temp folder. Which I have no idea about why is happening. Also it doesn't break anything. So I don't actually know why we need |
|
||
namespace OrchardCore.Commerce.Abstractions.Exceptions; | ||
|
||
[Serializable] | ||
#pragma warning disable S3925 // "ISerializable" should be implemented correctly | ||
// Exception(SerializationInfo info, StreamingContext context) is obsolete and should not be called. |
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.
Always put these comments above the pragmas.
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.
Also can you use [SuppressMessage]
instead? I suggest only using #pragma
inside method bodies. It should be avoided on class/property declarations and method signatures, because it's horrible for readability.
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.
It generated a bunch of .prettierrc.js
files at build. I guess that should be added to the _.gitignore:?
|
||
namespace OrchardCore.Commerce.Abstractions.Exceptions; | ||
|
||
[Serializable] | ||
#pragma warning disable S3925 // "ISerializable" should be implemented correctly | ||
// Exception(SerializationInfo info, StreamingContext context) is obsolete and should not be called. |
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.
Also can you use [SuppressMessage]
instead? I suggest only using #pragma
inside method bodies. It should be avoided on class/property declarations and method signatures, because it's horrible for readability.
That's a known error that I was already working on in #410 before the OC 1.8 upgrade complicated things. It's ZAP probing for path traversal exploits, which correctly results in an error log and UITT should permit this. I ended up disabling path traversal tests altogether, because as long as you only use ASP.NET/OC for resources it's not a real security concern and it generates a ton of error logs and weird false positives. Like this case for example. wtf am I supposed to do with this? To straighten things out, I've merged this branch into |
This makes much more sense now. Well it's non sense but it makes sense to me at least :D I will halt the progress here in this case. Please ping me if there are any news on OCC-218. I started chewing my hair due to these Security error logs. |
You know times are bad when Roland starts spitting hairballs... 😿 |
After doing OC 1.6 - 1.7 - 1.8 upgrades I am hypersensitive to retardedly failing UI tests. At least now I now whener I see a ?= on the internet I should deploy sql injection attac |
@Psichorex it's good now. Did you need to do anything else or is this ready for review? |
|
Same for me. I love random JS commitables. |
Wait, never mind. Please address this first. |
Thats already pushed. CI is running. |
[SuppressMessage( | ||
"Maintainability", | ||
"S3925: ISerializable should be implemented correctly", | ||
Justification = "Exception(SerializationInfo info, StreamingContext context) is obsolete and should not be called.")] |
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.
In this case why isn't this rule turned off altogether? Also based on this issue it seems like if you remove [Serializable]
then you don't have to implement the overload with SerializationInfo
so the attribute behaves like an opt-in. Also isn't the [Serializable]
attribute and the overload you removed related anyway?
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.
That is actually true. [Serializable]
can be removed here.
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.
Could be turned off but this is the first time I came across a problem rooting from this so I wuoldn't actually turn it off now that I could just remove it.
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.
I asked about turning it off because the text in the Justification
made it sound like you are addressing an outdated analyzer rule by suppressing every occurrence individually. That's not ok even if there is only one case. Since removing [Serializable]
did the trick we don't have to worry about it.
string Format(Address address) => | ||
address is null | ||
? "-" | ||
: JoinNotNullAndNotWhiteSpace( | ||
Environment.NewLine, | ||
address.Department, | ||
address.Company, | ||
address.StreetAddress1, | ||
address.StreetAddress2, | ||
JoinNotNullAndNotWhiteSpace(separator: " ", address.City, address.Province, address.PostalCode), | ||
address.Region).ToUpperInvariant(); | ||
string Format(Address address); |
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.
Why did you remove the default implementation?
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.
Well this was hard to track :(
So basically this warning is the cause :
The warning wants us to use concrete types. The default implementation was not in the concrete type but the interface. So I moved the default inmplementation to the inheritor class instead of the interface. I thought we don't do implementations in interfaces. Looks pretty wierd. I guess it had a reason though. So it was moved to the DefaultAddressFormatter : IAddressFormatted
class.
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.
I looked into the git history of the file and looks like this was from before we took over. I don't think this was ever a good use of the default implementation feature, because this is the only method in the interface so the only reason to create a new class implementing it is to "override" this implementation anyway.
So it was a good thing you did here.
OCC-223
Fixes #411