Skip to content

C#: merge ServiceStack feature branch into main (+added support for remote flow sinks) #5494

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

Merged
merged 27 commits into from
Sep 17, 2021
Merged

C#: merge ServiceStack feature branch into main (+added support for remote flow sinks) #5494

merged 27 commits into from
Sep 17, 2021

Conversation

mr-sherman
Copy link
Contributor

Using the debug query to find un-identified sinks, Untrusted Input to External API, we discovered some input being passed as parameters into the function ServiceStack.IRestClient.Get(). This is a sink for remote flow as input or is sometimes used to construct URLs for an API call.

This branch is used by CH Robinson, who notified us that our potential service stack implementation may have been incomplete.

@mr-sherman mr-sherman requested a review from a team as a code owner March 22, 2021 23:37
@github-actions github-actions bot added the C# label Mar 22, 2021
Copy link
Contributor

@tamasvajk tamasvajk left a comment

Choose a reason for hiding this comment

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

As this PR doesn't target main, I think it's fine to merge it.

Rebasing these branches from main would help in getting the tests pass, and the formatting should already be fixed in main too.

…ort from

Remote.qll, as it is un-necessary now.
@intrigus-lgtm
Copy link
Contributor

@mr-sherman looks like something went wrong?

Commits 5,122
Checks 3
Files changed 5,000+
+388,664 −118,560

@tausbn tausbn removed request for a team, felicitymay, jf205 and hubwriter May 28, 2021 14:45
@mr-sherman
Copy link
Contributor Author

It was suggested I merge in main to see if it would resolve the failing checks, hence the 5000+ files changed.

@yo-h
Copy link
Contributor

yo-h commented Jun 1, 2021

@mr-sherman do you intend to maintain the feature branch going forward, or would you like to have the feature branch merged into main? If the latter, it might be easier to review if you target main directly.

@mr-sherman
Copy link
Contributor Author

@yo-h I would like to get it merged into main, as the feature branch is in use at a customer and has been for almost two months. Should I cancel this PR and re-target main?

@yo-h
Copy link
Contributor

yo-h commented Jun 9, 2021

Yes, re-targeting at main seems preferable then.

@mr-sherman mr-sherman changed the base branch from feature/service-stack to main June 24, 2021 16:57
@mr-sherman
Copy link
Contributor Author

OK, re-targeted to main from the feature branch.

@yo-h yo-h changed the title added support for remote flow sinks C#: merge ServiceStack feature branch into main (+added support for remote flow sinks) Jun 25, 2021
@yo-h yo-h requested a review from tamasvajk June 25, 2021 23:33
@mr-sherman
Copy link
Contributor Author

Hi, is there an update on this PR?

@yo-h
Copy link
Contributor

yo-h commented Jul 28, 2021

The C# team is currently on vacation, but it's on their todo list for when they return.

Copy link
Contributor

@tamasvajk tamasvajk left a comment

Choose a reason for hiding this comment

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

@mr-sherman I'm planning to work on this PR to be merged to main. As a first step I went through this PR and added some notes to myself, and one or two questions to you. Also, do you have some test projects to check if these changes do find the relevant problems?

Comment on lines +89 to +100
class ServiceStackRemoteRequestParameter extends ExternalLocationSink {
ServiceStackRemoteRequestParameter() {
exists(MethodCall mc |
mc.getTarget().getQualifiedName() in [
"ServiceStack.IRestClient.Get", "ServiceStack.IRestClient.Put",
"ServiceStack.IRestClient.Post", "ServiceStack.IRestClient.Delete",
"ServiceStack.IRestClient.Patch", "ServiceStack.IRestClient.Send",
"ServiceStack.IRestClientAsync.GetAsync","ServiceStack.IRestClientAsync.DeleteAsync",
"ServiceStack.IRestClientAsync.PutAsync","ServiceStack.IRestClientAsync.PostAsync",
"ServiceStack.IRestClientAsync.PatchAsync","ServiceStack.IRestClientAsync.CustomMethodAsync"
] and
this.asExpr() = mc.getAnArgument()
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably convert these to the new data-driven approach, lines would look something like:
ServiceStack;IRestClient;true;Get<>;;;Argument[0];external

Comment on lines +173 to +176
exists(ObjectCreation oc |
oc.getType().hasQualifiedName("ServiceStack.HttpResult") and
this.asExpr() = oc.getArgument(0)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be converted to the CSV approach.

Comment on lines +111 to +118
class ServiceStackSink extends Sink {
ServiceStackSink() {
exists(MethodCall mc, Method m, int p |
(mc.getTarget() = m.getAnOverrider*() or mc.getTarget() = m.getAnImplementor*()) and
sqlSinkParam(m, p) and
mc.getArgument(p) = this.asExpr()
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could cover all the below with CSV lines.

@tamasvajk tamasvajk mentioned this pull request Aug 10, 2021
9 tasks
@tamasvajk tamasvajk merged commit 2437546 into github:main Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants