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

Merge 2310 #1990

Merged
merged 153 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 151 commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
3be5cbf
support cb 23.2.1
sjjian Oct 5, 2023
b575553
generate code for gql
sjjian Oct 5, 2023
d834901
add unit test
hasa1K Oct 7, 2023
e13d038
update unit test
hasa1K Oct 7, 2023
6141e33
Merge pull request #1887 from actiontech/fix-issue1783
ColdWaterLW Oct 7, 2023
826ad7c
fix: DMLCheckJoinFieldType rule not triggered
winfredLIN Oct 8, 2023
dbc8ff9
define apis
ColdWaterLW Oct 8, 2023
c68c48b
feat:support redirect to sql_audit list
taolx0 Oct 8, 2023
44d2f2c
Merge pull request #1891 from actiontech/change-to-list-api
ColdWaterLW Oct 8, 2023
2930eb8
Merge pull request #1890 from actiontech/issue-ee-1003
taolx0 Oct 8, 2023
aedd379
fix: a risk of misjudgment in rule judgment
winfredLIN Oct 8, 2023
6269310
chore:add field length
taolx0 Oct 8, 2023
59c6d0f
Merge pull request #1885 from actiontech/support-1884
ColdWaterLW Oct 8, 2023
0640ee2
chore:support sql audit list redirect
taolx0 Oct 8, 2023
5c1ced1
test: unit test for util ColumeNameVisitor
winfredLIN Oct 9, 2023
18c12ba
test: add 5 test cases for rule DMLCheckJoinFieldType
winfredLIN Oct 9, 2023
930a714
chore:rename
taolx0 Oct 9, 2023
35eb6cb
Merge pull request #1894 from actiontech/change-to-list-impl
ColdWaterLW Oct 9, 2023
c8c5ed3
chore:change input param compatible front
taolx0 Oct 9, 2023
2c8b704
test: correct case
winfredLIN Oct 9, 2023
c1ffdd3
Merge pull request #1896 from actiontech/change-to-list-impl-chore
hasa1K Oct 9, 2023
a7e2523
Merge pull request #1892 from winfredLIN/issue1888
ColdWaterLW Oct 9, 2023
4f8d7ab
modified: correct spelling of word column
winfredLIN Oct 9, 2023
0bbd551
Merge pull request #1898 from winfredLIN/issue1888
ColdWaterLW Oct 9, 2023
d2afbe6
fix: empty node after parse cause by empty sql
winfredLIN Oct 9, 2023
b5eef03
Merge pull request #1901 from winfredLIN/issue1897
taolx0 Oct 10, 2023
ce832d9
fix:spell error
taolx0 Oct 10, 2023
cfc00b8
Merge pull request #1902 from actiontech/spell-fix
ColdWaterLW Oct 10, 2023
aa0f6de
fix:SQL result set with limit may be empty
taolx0 Oct 10, 2023
7823da6
fix:Add check that SQL result set may be empty
taolx0 Oct 10, 2023
6b8f6e1
chore:add log
taolx0 Oct 10, 2023
f6f9584
chore:rename & annotation
taolx0 Oct 10, 2023
d0696b7
Merge pull request #1904 from actiontech/fix-count-affect-row
ColdWaterLW Oct 10, 2023
76b9398
fix filter for getting rules
ColdWaterLW Oct 11, 2023
7ce0e7d
Merge pull request #1905 from actiontech/issue-1899
hasa1K Oct 11, 2023
5b793a8
db_type is needed when get rules by audit result
ColdWaterLW Oct 11, 2023
876ce1f
Merge pull request #1906 from actiontech/issue-1899
hasa1K Oct 11, 2023
6408d19
feat: support adding enterprise customized api
winfredLIN Oct 12, 2023
61776bf
refactor: change function name
winfredLIN Oct 12, 2023
bb13afe
modify: handle error when regist custom api
winfredLIN Oct 12, 2023
f02da6f
Merge pull request #1907 from winfredLIN/issue1071-ee
ColdWaterLW Oct 12, 2023
dcc6c88
everyone can read rule knowledge
ColdWaterLW Oct 13, 2023
704e4f1
Merge pull request #1908 from actiontech/issue-ee-1080
taolx0 Oct 13, 2023
e3449a6
set the limitation as a max number to avoid receive limitation
ColdWaterLW Oct 13, 2023
4422f47
Merge pull request #1910 from actiontech/issue-1909
winfredLIN Oct 13, 2023
31acc0b
fix: incorrect fingerprint algorithm parsing result
winfredLIN Oct 13, 2023
02d12c7
ci: modify bad strings in test case
winfredLIN Oct 13, 2023
efe7f93
ci: add recv to whitelist
winfredLIN Oct 13, 2023
95e46eb
Merge pull request #1911 from winfredLIN/issue1075-ee
ColdWaterLW Oct 13, 2023
719df6a
use inexpr visitor
hasa1K Oct 16, 2023
fde5aa1
support tdsql
ColdWaterLW Oct 16, 2023
d545001
Merge pull request #1916 from actiontech/issue-1915
sjjian Oct 16, 2023
fdaf989
fix: dml_check_fuzzy_search rule cannot handle concat function
winfredLIN Oct 16, 2023
efbf45f
chore:compatible tdsql
taolx0 Oct 16, 2023
9fdb9c9
Merge pull request #1920 from actiontech/compatible-tdsql
ColdWaterLW Oct 17, 2023
0155bed
Merge pull request #1919 from winfredLIN/issue1917
ColdWaterLW Oct 17, 2023
dc1de7c
reduce query times
ColdWaterLW Oct 17, 2023
1e4f2ff
support getting default rule knowledge from plugins
ColdWaterLW Oct 17, 2023
4d440ea
Merge pull request #1922 from actiontech/issue-ee-1059
sjjian Oct 17, 2023
949fdb5
use wherevisitor instead of invisitor
hasa1K Oct 18, 2023
add3ae5
improve unit test
hasa1K Oct 18, 2023
13eae2c
Merge pull request #1914 from actiontech/fix-issue1913
sjjian Oct 18, 2023
274a184
avoid panic
ColdWaterLW Oct 18, 2023
fd1d081
add java parser sql func
hasa1K Oct 18, 2023
32ae528
Merge pull request #1926 from actiontech/issue-1925
hasa1K Oct 18, 2023
22dd5a0
update java-sql-extractor package
hasa1K Oct 18, 2023
fea6728
chore:swagger
taolx0 Oct 18, 2023
566e577
chore:add rule name return
taolx0 Oct 18, 2023
42d0170
fix:error sql
taolx0 Oct 19, 2023
aab1d16
Merge pull request #1931 from actiontech/fix/rule-model
hasa1K Oct 19, 2023
9ccfd80
update java-sql-extractor
hasa1K Oct 19, 2023
66690d7
chore:user controller audit results
taolx0 Oct 19, 2023
102bf8b
feat: rule dml_check_join_has_on increase coverage
winfredLIN Oct 18, 2023
a8c889a
test: add unit test for rull CheckHasJoinCondition
winfredLIN Oct 19, 2023
ad8635a
test: modify test cases
winfredLIN Oct 19, 2023
91f1422
test: add test for EqualConditionVisitor
winfredLIN Oct 19, 2023
80ca1f6
Merge pull request #1930 from actiontech/knowledge
sjjian Oct 19, 2023
37b7bf4
update parser lib, for #1923 and #1924
sjjian Oct 20, 2023
a3157ad
Merge pull request #1933 from actiontech/update-parser-lib
ColdWaterLW Oct 20, 2023
7e66dea
avoid panic
ColdWaterLW Oct 20, 2023
bb801d3
Merge pull request #1927 from actiontech/java-sql
sjjian Oct 20, 2023
30a176a
Merge pull request #1934 from actiontech/issue-ee-1059
taolx0 Oct 20, 2023
b31e159
perf: the performance of selectivity calculate
winfredLIN Oct 20, 2023
0d5cacc
test: modify test case of index selectivity rules
winfredLIN Oct 20, 2023
46fbb6a
refactor: the code for adding breakpoints during debugging
winfredLIN Oct 20, 2023
404e33b
fix:Rule error reporting
taolx0 Oct 23, 2023
134d3ea
Merge pull request #1939 from actiontech/fix-1936
hasa1K Oct 23, 2023
08627f3
modify: logic for determining connection condition
winfredLIN Oct 23, 2023
a79d09a
todo: add fix me todo
winfredLIN Oct 23, 2023
73c1cbe
test: add and modified test case
winfredLIN Oct 23, 2023
54da00c
refactor: structure of getting column selectivity
winfredLIN Oct 24, 2023
ec472b5
test: modify test case owing to change of logic
winfredLIN Oct 24, 2023
112f676
modify: add handling error when convert string to float64
winfredLIN Oct 24, 2023
a2d578f
modify: calculate selectivity using statistical methods when there is…
winfredLIN Oct 24, 2023
80c4c20
test: convert selective values to percentages
winfredLIN Oct 24, 2023
544ddb6
refactor: rename and reuse variables
winfredLIN Oct 25, 2023
1f39c7c
modified: take two selectivity algorithm into two method
winfredLIN Oct 25, 2023
30c3243
modified: change method in two rules
winfredLIN Oct 25, 2023
a21875f
test: change test case due to rules change
winfredLIN Oct 25, 2023
a7f18bd
modified: change logic of calculating index selectivity
winfredLIN Oct 25, 2023
5f3687c
add audit plan upload sql blanklist function
hasa1K Oct 25, 2023
731214b
refactor:Remove fingerprint map
taolx0 Oct 24, 2023
aba1279
increase timeout duration
ColdWaterLW Oct 25, 2023
dd4f6c5
Merge pull request #1941 from actiontech/label-1
sjjian Oct 25, 2023
2af63f4
Merge pull request #1949 from actiontech/issue-1947-1
sjjian Oct 25, 2023
e9ab257
modified: place the logic to determine whether two columns are unequa…
winfredLIN Oct 25, 2023
36c98a6
test: modify test cases due to visitor change
winfredLIN Oct 25, 2023
1682aa3
modified: use the function getTableSourceByColumnName to determine wh…
winfredLIN Oct 25, 2023
3c0dd72
modified: add cache to GetSelectivityOfIndex
winfredLIN Oct 26, 2023
5255408
modified: add cache to GetSelectivityOfColumns
winfredLIN Oct 26, 2023
c2c37e4
refactor: rewrite comment and rename function
winfredLIN Oct 26, 2023
20c2442
modified: change the location of the cache
winfredLIN Oct 26, 2023
76da297
Merge pull request #1932 from winfredLIN/issue1921
sjjian Oct 26, 2023
65d2cff
refactor: reuse method of context
winfredLIN Oct 26, 2023
718e227
Merge pull request #1938 from actiontech/issue1918
sjjian Oct 26, 2023
ac44b61
change model name && add log
hasa1K Oct 26, 2023
001b055
change log
hasa1K Oct 26, 2023
f74e0c9
use warn level log
hasa1K Oct 26, 2023
f214216
Merge pull request #1946 from actiontech/fix-issue1119
ColdWaterLW Oct 26, 2023
223c2c9
change error name
hasa1K Oct 26, 2023
c7cf769
Merge pull request #1956 from actiontech/fix-issue1119
ColdWaterLW Oct 26, 2023
16cce9b
use strings.Contains instead of re
hasa1K Oct 26, 2023
2bfa7de
Merge pull request #1959 from actiontech/fix-issue1119
ColdWaterLW Oct 26, 2023
fe776fe
correct response struct
ColdWaterLW Oct 26, 2023
20f81e3
Merge pull request #1961 from actiontech/issue-ee-1065-1
sjjian Oct 26, 2023
03b2eff
support default rule knowledge
ColdWaterLW Oct 27, 2023
a4f89ea
Merge pull request #1954 from actiontech/issue-ee-1059
sjjian Oct 27, 2023
e576571
fix spelling
ColdWaterLW Oct 27, 2023
7f82081
Merge pull request #1962 from actiontech/fix-spelling
taolx0 Oct 27, 2023
6bb37d4
fix spelling error
ColdWaterLW Oct 27, 2023
16d8464
Merge pull request #1963 from actiontech/fix-spelling
taolx0 Oct 27, 2023
082d9c6
fix:add foreign instance
taolx0 Oct 31, 2023
3e7881d
trim sql \r\n
hasa1K Oct 31, 2023
79153e6
Merge pull request #1967 from actiontech/fix-sync
hasa1K Oct 31, 2023
567ac59
use trimSpace function
hasa1K Oct 31, 2023
ad81ce4
Merge pull request #1968 from actiontech/fix-issue1965
ColdWaterLW Oct 31, 2023
dd7b0f2
not case sensitive
hasa1K Oct 31, 2023
58c37c4
Merge pull request #1970 from actiontech/fix-issue1119
ColdWaterLW Oct 31, 2023
f22381f
feat: add function result generator to generator result of function
winfredLIN Nov 2, 2023
a00cd48
fix: CheckWhereFuzzySearch support upper function
winfredLIN Nov 2, 2023
2a621c8
fix: when there is no where in the outer layer of the SQL statement, …
winfredLIN Nov 2, 2023
af5aa7f
test: unit test for four rules
winfredLIN Nov 2, 2023
5a4fdf8
perf: avoided checking other rules caused by current rules
winfredLIN Nov 2, 2023
d780a26
test: unit test for FuncCallVisitor
winfredLIN Nov 2, 2023
fb90de4
test: unit tset for UpperFunc and ConCatFunc
winfredLIN Nov 2, 2023
0f38d9b
Merge pull request #1978 from actiontech/issue1974
hasa1K Nov 3, 2023
02919e3
fix panic && null
hasa1K Nov 3, 2023
5d3716c
Merge pull request #1979 from actiontech/fix-issue1048
ColdWaterLW Nov 3, 2023
601f64f
Merge remote-tracking branch 'origin/release-2.2310.x' into merge-2310
LordofAvernus Nov 6, 2023
b7d4024
Merge remote-tracking branch 'origin/release-2.2310.x' into release-3…
LordofAvernus Nov 7, 2023
6209c4a
fix : wrong table preload query
LordofAvernus Nov 7, 2023
d59fead
fix check member permissions failed
LordofAvernus Nov 7, 2023
dbec370
support get task without instance
LordofAvernus Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/Masterminds/semver/v3 v3.1.1
github.com/actiontech/dms v0.0.0-20231019085256-6c3ffc8b3489
github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62
github.com/actiontech/mybatis-mapper-2-sql v0.4.0
github.com/agiledragon/gomonkey v2.0.2+incompatible
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
Expand Down Expand Up @@ -89,6 +90,7 @@ require (
github.com/alibabacloud-go/openapi-util v0.1.0 // indirect
github.com/alibabacloud-go/tea-xml v1.1.2 // indirect
github.com/aliyun/credentials-go v1.1.2 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
Expand Down Expand Up @@ -163,6 +165,7 @@ require (
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
Expand All @@ -179,7 +182,6 @@ replace (
cloud.google.com/go/compute/metadata => cloud.google.com/go/compute/metadata v0.1.0
github.com/labstack/echo/v4 => github.com/labstack/echo/v4 v4.6.1
github.com/pingcap/log => github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9
github.com/pingcap/parser => github.com/sjjian/parser v0.0.0-20220614062700-e3219e3d6833
golang.org/x/sys => golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71
github.com/pingcap/parser => github.com/sjjian/parser v0.0.0-20231020015929-c5d7ca486d80
google.golang.org/grpc => google.golang.org/grpc v1.29.0
)
67 changes: 63 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ
github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/actiontech/dms v0.0.0-20231019085256-6c3ffc8b3489 h1:K+fg7bPud+sMFyjbZrxNxRrjh++6lLlRayMb7Ylzlws=
github.com/actiontech/dms v0.0.0-20231019085256-6c3ffc8b3489/go.mod h1:NjDg7X3pKEQCaXSSphdwEGTh+D6nvB19OnKj/AF2CX0=
github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62 h1:JM7WnLzlvXOGE90KKd+aigi+qUDS+U5dLwQMNpTKZxE=
github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62/go.mod h1:adDZHhAf2LRMx2h0JzofPXn12x2XlyQjVE116KXquwo=
github.com/actiontech/mybatis-mapper-2-sql v0.4.0 h1:FSzK3qnnD9/JjOUJMRcctGxQjK7cg1M01yRMq59TSZg=
github.com/actiontech/mybatis-mapper-2-sql v0.4.0/go.mod h1:ZMmUEDfbjm8oWxSAZkejqeOzlXa1BWNCfhNIxCMu7lw=
github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw=
Expand Down Expand Up @@ -105,6 +107,8 @@ github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
github.com/appleboy/gin-jwt/v2 v2.6.3/go.mod h1:MfPYA4ogzvOcVkRwAxT7quHOtQmVKDpTwxyUrC2DNw0=
github.com/appleboy/gofight/v2 v2.1.2/go.mod h1:frW+U1QZEdDgixycTj4CygQ48yLTUhplt43+Wczp3rw=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
Expand Down Expand Up @@ -849,8 +853,8 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sjjian/parser v0.0.0-20220614062700-e3219e3d6833 h1:0JHwfRBrBZr/QcLo7+q9C3xOt8oXRKLCnZOrHN+Bza0=
github.com/sjjian/parser v0.0.0-20220614062700-e3219e3d6833/go.mod h1:Qq2tnreUXwVo7NAKAHmbWFsgqpDUkxwhJCClY+ZCudA=
github.com/sjjian/parser v0.0.0-20231020015929-c5d7ca486d80 h1:2pFDv4Gd1vVqHwPEzWiTN4vgP9jLKZDuVP/jEcC0SE0=
github.com/sjjian/parser v0.0.0-20231020015929-c5d7ca486d80/go.mod h1:Qq2tnreUXwVo7NAKAHmbWFsgqpDUkxwhJCClY+ZCudA=
github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM=
github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
Expand Down Expand Up @@ -1052,6 +1056,8 @@ golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm0
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
Expand Down Expand Up @@ -1139,8 +1145,61 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71 h1:ikCpsnYR+Ew0vu99XlDp55lGgDJdIMx3f4a18jfse/s=
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
9 changes: 8 additions & 1 deletion spelling_dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -431,4 +431,11 @@ larkapproval
ccer
tdsql
unhandled
mkdir
mkdir
msar
recv
xtra
XtraBackup
mysqldump
datediff
xxx
53 changes: 50 additions & 3 deletions sqle/api/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,44 @@ const (
apiV2 = "v2"
)

type restApi struct {
method string
path string
handlerFn echo.HandlerFunc
middleWareFns []echo.MiddlewareFunc
}

var restApis []restApi

func LoadRestApi(method string, path string, handlerFn echo.HandlerFunc, middleWareFns ...echo.MiddlewareFunc) {
restApis = append(restApis, restApi{
method: method,
path: path,
handlerFn: handlerFn,
middleWareFns: middleWareFns,
})
}

func addCustomApis(e *echo.Group, apis []restApi) error {
for _, api := range apis {
switch api.method {
case http.MethodGet:
e.GET(api.path, api.handlerFn, api.middleWareFns...)
case http.MethodPost:
e.POST(api.path, api.handlerFn, api.middleWareFns...)
case http.MethodPatch:
e.PATCH(api.path, api.handlerFn, api.middleWareFns...)
case http.MethodDelete:
e.DELETE(api.path, api.handlerFn, api.middleWareFns...)
case http.MethodPut:
e.PUT(api.path, api.handlerFn, api.middleWareFns...)
default:
return fmt.Errorf("unsupported http method")
}
}
return nil
}

// @title Sqle API Docs
// @version 1.0
// @description This is a sample server for dev.
Expand Down Expand Up @@ -110,6 +148,8 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti
v1Router.DELETE("/custom_rules/:rule_id", v1.DeleteCustomRule, sqleMiddleware.AdminUserAllowed())
v1Router.POST("/custom_rules", v1.CreateCustomRule, sqleMiddleware.AdminUserAllowed())
v1Router.PATCH("/custom_rules/:rule_id", v1.UpdateCustomRule, sqleMiddleware.AdminUserAllowed())
v1Router.PATCH("/rule_knowledge/db_types/:db_type/rules/:rule_name/", v1.UpdateRuleKnowledgeV1, sqleMiddleware.AdminUserAllowed())
v1Router.PATCH("/rule_knowledge/db_types/:db_type/custom_rules/:rule_name/", v1.UpdateCustomRuleKnowledgeV1, sqleMiddleware.AdminUserAllowed())

// configurations
// v1Router.GET("/configurations/ldap", v1.GetLDAPConfiguration, AdminUserAllowed())
Expand Down Expand Up @@ -140,9 +180,6 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti
// v1Router.GET("/configurations/webhook", v1.GetWorkflowWebHookConfig, sqleMiddleware.AdminUserAllowed())
// v1Router.POST("/configurations/webhook/test", v1.TestWorkflowWebHookConfig, sqleMiddleware.AdminUserAllowed())

v1Router.GET("/rule_knowledge/db_types/:db_type/rules/:rule_name/", v1.GetRuleKnowledge, sqleMiddleware.AdminUserAllowed())
v1Router.PATCH("/rule_knowledge/db_types/:db_type/rules/:rule_name/", v1.UpdateRuleKnowledgeV1, sqleMiddleware.AdminUserAllowed())

// statistic
v1Router.GET("/statistic/instances/type_percent", v1.GetInstancesTypePercentV1, sqleMiddleware.AdminUserAllowed())
v1Router.GET("/statistic/instances/sql_average_execution_time", v1.GetSqlAverageExecutionTimeV1, sqleMiddleware.AdminUserAllowed())
Expand Down Expand Up @@ -267,6 +304,7 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti
v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/notify_config/test", v1.TestAuditPlanNotifyConfig)
v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls/:number/analysis", v1.GetAuditPlanAnalysisData)
v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/sqls", v1.GetAuditPlanReportSQLsV1)
v1ProjectRouter.GET("/:project_name/audit_plans/:audit_plan_name/reports/:audit_plan_report_id/export", v1.ExportAuditPlanReportV1)
// scanner token auth
v1ProjectRouter.POST("/:project_name/audit_plans/:audit_plan_name/sqls/full", v1.FullSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
v1ProjectRouter.POST("/:project_name/audit_plans/:audit_plan_name/sqls/partial", v1.PartialSyncAuditPlanSQLs, sqleMiddleware.ScannerVerifier())
Expand Down Expand Up @@ -365,6 +403,8 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti

// 全局 workflow
v1Router.GET("/workflows", v1.GetGlobalWorkflowsV1)
v1Router.GET("/rule_knowledge/db_types/:db_type/rules/:rule_name/", v1.GetRuleKnowledge)
v1Router.GET("/rule_knowledge/db_types/:db_type/custom_rules/:rule_name/", v1.GetCustomRuleKnowledge)

//rule
v1Router.GET("/rules", v1.GetRules)
Expand Down Expand Up @@ -401,8 +441,15 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti
// sql audit
v1Router.POST("/sql_audit", v1.DirectAudit)
v1Router.POST("/audit_files", v1.DirectAuditFiles)
v2Router.POST("/audit_files", v2.DirectAuditFiles)
v1Router.GET("/sql_analysis", v1.DirectGetSQLAnalysis)

// enterprise customized apis
err := addCustomApis(v1Router, restApis)
if err != nil {
log.Logger().Fatalf("failed to register custom api, %v", err)
return
}
// UI
e.File("/", "ui/index.html")
e.Static("/static", "ui/static")
Expand Down
1 change: 1 addition & 0 deletions sqle/api/cloudbeaver_wrapper/graph/model/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading