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

limit console cmd length #1870

Closed
wants to merge 2 commits into from
Closed

Conversation

knightXun
Copy link
Contributor

For Security, Limit the max length of a single cmd.

Copy link
Contributor

@dutor dutor left a comment

Choose a reason for hiding this comment

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

Thanks.

Comment on lines 147 to 157
auto lineSize = line.size() - 1;
if (lineSize > kMaxCmdLen) {
cmdTooLarge = true;
break;
}
line.resize(lineSize);
cmd += line;
if(cmd.length() > kMaxCmdLen) {
cmdTooLarge = true;
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Only catch the case there are line breaks?
I think you could just check right before the command gets executed/processed.

@dangleptr
Copy link
Contributor

Any progress about this pr?
@knightXun @dutor @laura-ding

@jude-zhu
Copy link
Contributor

we should take it into consideration as a whole instead of just limiting the length of cmd. For example. r we gonna limit the length of string prop. Maybe do it at parser? 🤷‍♂️🤷‍♂️

@jude-zhu jude-zhu closed this Jul 15, 2020
@knightXun knightXun deleted the cmdLine branch July 15, 2020 05:50
yixinglu pushed a commit to yixinglu/nebula that referenced this pull request Jan 31, 2023
<!--
Thanks for your contribution!
In order to review PR more efficiently, please add information according to the template.
-->

## What type of PR is this?
- [X] bug
- [ ] feature
- [ ] enhancement

## What problem(s) does this PR solve?
#### Issue(s) number: 
Close vesoft-inc#5020 

#### Description:
The `with *` in a match clause like `match ...(v999)... match ... match ... match ...(v999)... with *` from a multi-match query, where v999 is defined in a previous match, rebuilds named aliases from all query parts, causing v999 to duplicate and trigger a false error.

This is actually ok, since they are in fact the same ones. There is actually no redefinition. This compiles with openCypher and neo4j.

## How do you solve it?

1. Allow the usage of aliases defined in previous matches. Only report redefinition of aliases if an alias is repeateed within the current query part.
2. Fixed an unstable tck case.


## Special notes for your reviewer, ex. impact of this fix, design document, etc:



## Checklist:
Tests:
- [ ] Unit test(positive and negative cases)
- [ ] Function test
- [ ] Performance test
- [X] TCK

Affects:
- [ ] Documentation affected (Please add the label if documentation needs to be modified.)
- [ ] Incompatibility (If it breaks the compatibility, please describe it and add the label.)
- [ ] If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
- [ ] Performance impacted: Consumes more CPU/Memory


## Release notes:

Please confirm whether to be reflected in release notes and how to describe:
> ex. Fixed the bug .....


Migrated from vesoft-inc#5021

Co-authored-by: Cheng Xuntao <7731943+xtcyclist@users.noreply.github.com>
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.

4 participants