Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Domain Data Mgmt Services
Seismic
Seismic DMS Suite
seismic-dms-service
Commits
fce9462a
Commit
fce9462a
authored
Aug 26, 2021
by
Diego Molteni
Browse files
fix: addressed service security vulnerabilities
parent
81bdf70d
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
npm-shrinkwrap.json
View file @
fce9462a
This diff is collapsed.
Click to expand it.
package.json
View file @
fce9462a
...
...
@@ -127,7 +127,7 @@
"
mocha
"
:
"
^8.4.0
"
,
"
mocha-bamboo-reporter
"
:
"
^1.1.2
"
,
"
mocha-junit-reporter
"
:
"
1.23.3
"
,
"
newman
"
:
"
^
4.6.1
"
,
"
newman
"
:
"
^
5.2.4
"
,
"
nyc
"
:
"
^15.0.0
"
,
"
path
"
:
"
^0.12.7
"
,
"
redis-mock
"
:
"
^0.49.0
"
,
...
...
src/services/tenant/handler.ts
View file @
fce9462a
...
...
@@ -140,12 +140,18 @@ export class TenantHandler {
// get tenant path from data partition information
public
static
async
getTenantSDPath
(
req
:
expRequest
):
Promise
<
string
>
{
const
datapartition
=
TenantParser
.
dataPartition
(
req
);
const
dataPartition
=
TenantParser
.
dataPartition
(
req
);
if
(
FeatureFlags
.
isEnabled
(
Feature
.
AUTHORIZATION
))
{
await
Auth
.
isUserRegistered
(
req
.
headers
.
authorization
,
(
await
TenantDAO
.
get
(
dataPartition
)).
esd
,
req
[
Config
.
DE_FORWARD_APPKEY
]);
}
try
{
const
tenants
=
await
TenantDAO
.
getAll
();
if
(
data
p
artition
===
'
slb
'
)
return
(
Config
.
SDPATHPREFIX
+
data
p
artition
);
if
(
data
P
artition
===
'
slb
'
)
return
(
Config
.
SDPATHPREFIX
+
data
P
artition
);
for
(
const
tenant
of
tenants
)
{
if
(
tenant
.
esd
.
startsWith
(
data
p
artition
))
{
if
(
tenant
.
esd
.
startsWith
(
data
P
artition
))
{
if
(
FeatureFlags
.
isEnabled
(
Feature
.
AUTHORIZATION
))
{
await
Auth
.
isUserRegistered
(
req
.
headers
.
authorization
,
tenant
.
esd
,
req
[
Config
.
DE_FORWARD_APPKEY
]);
...
...
@@ -155,7 +161,7 @@ export class TenantHandler {
}
}
catch
(
error
)
{
if
((
error
as
ErrorModel
).
error
.
code
===
Error
.
Status
.
NOT_IMPLEMENTED
)
{
return
Config
.
SDPATHPREFIX
+
data
p
artition
;
return
Config
.
SDPATHPREFIX
+
data
P
artition
;
}
else
{
throw
error
;
}
}
...
...
tests/utest/services/tenant.ts
View file @
fce9462a
...
...
@@ -97,8 +97,9 @@ export class TestTenantSVC {
Tx
.
testExp
(
async
(
done
:
any
,
expReq
:
expRequest
,
expRes
:
expResponse
)
=>
{
expReq
.
query
.
datapartition
=
'
datapartition
'
;
this
.
sandbox
.
stub
(
TenantDAO
,
'
getAll
'
).
resolves
([{
name
:
'
tenant01
'
,
default_acls
:
'
x
'
,
esd
:
'
datapartition.domain.com
'
,
gcpid
:
'
any
'
}]);
this
.
sandbox
.
stub
(
Auth
,
'
isUserRegistered
'
).
resolves
();
this
.
sandbox
.
stub
(
TenantDAO
,
'
get
'
).
resolves
({
name
:
'
tenant01
'
,
default_acls
:
'
x
'
,
esd
:
'
datapartition.domain.com
'
,
gcpid
:
'
any
'
});
this
.
sandbox
.
stub
(
TenantDAO
,
'
getAll
'
).
resolves
([{
name
:
'
tenant01
'
,
default_acls
:
'
x
'
,
esd
:
'
datapartition.domain.com
'
,
gcpid
:
'
any
'
}]);
Tx
.
checkTrue
((
await
TenantHandler
.
getTenantSDPath
(
expReq
))
===
Config
.
SDPATHPREFIX
+
'
tenant01
'
,
done
);
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment