Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Cesium
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elmau
Cesium
Commits
8405bcc0
Commit
8405bcc0
authored
Jun 22, 2022
by
Benoit Lavenier
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix_search' into 'master'
Remove CS+ attacks from list result. Closes
#978
et #959 See merge request
!646
parents
def29a0e
2c4ed271
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
www/js/controllers/wot-controllers.js
+20
-2
20 additions, 2 deletions
www/js/controllers/wot-controllers.js
www/js/services/wot-services.js
+9
-0
9 additions, 0 deletions
www/js/services/wot-services.js
with
29 additions
and
2 deletions
www/js/controllers/wot-controllers.js
+
20
−
2
View file @
8405bcc0
...
...
@@ -162,7 +162,7 @@ angular.module('cesium.wot.controllers', ['cesium.services'])
;
function
WotLookupController
(
$scope
,
$state
,
$q
,
$timeout
,
$focus
,
$location
,
$ionicPopover
,
$ionicHistory
,
UIUtils
,
csConfig
,
csCurrency
,
csSettings
,
Device
,
BMA
,
csWallet
,
csWot
)
{
UIUtils
,
csConfig
,
csCurrency
,
csSettings
,
Device
,
BMA
,
csWallet
,
csWot
,
csCrypto
)
{
'
ngInject
'
;
var
defaultSearchLimit
=
10
;
...
...
@@ -293,10 +293,28 @@ function WotLookupController($scope, $state, $q, $timeout, $focus, $location, $i
$scope
.
search
.
loading
=
true
;
$scope
.
search
.
type
=
'
text
'
;
// If checksum is correct, search on simple pubkey
let
pubkeyWithCk
;
if
(
BMA
.
regexp
.
PUBKEY_WITH_CHECKSUM
.
test
(
text
))
{
console
.
debug
(
"
[wot] Validating pubkey checksum...
"
);
let
matches
=
BMA
.
regexp
.
PUBKEY_WITH_CHECKSUM
.
exec
(
text
);
console
.
log
(
matches
)
pubkey
=
matches
[
1
];
let
checksum
=
matches
[
2
];
let
expectedChecksum
=
csCrypto
.
util
.
pkChecksum
(
pubkey
);
if
(
checksum
===
expectedChecksum
)
{
console
.
debug
(
"
[wot] checksum {
"
+
checksum
+
"
} valid for pubkey {
"
+
pubkey
+
"
}
"
)
text
=
pubkey
pubkeyWithCk
=
pubkey
+
'
:
'
+
checksum
}
}
return
csWot
.
search
(
text
)
.
then
(
function
(
idties
){
if
(
$scope
.
search
.
type
!==
'
text
'
)
return
;
// could have change
if
(
$scope
.
search
.
text
.
trim
()
!==
text
)
return
;
// search text has changed before received response
originText
=
$scope
.
search
.
text
.
trim
();
if
(
originText
!==
text
&&
originText
!==
pubkeyWithCk
)
return
;
// search text has changed before received response
if
((
!
idties
||
!
idties
.
length
)
&&
(
BMA
.
regexp
.
PUBKEY
.
test
(
text
)
||
BMA
.
regexp
.
PUBKEY_WITH_CHECKSUM
.
test
(
text
)))
{
return
BMA
.
uri
.
parse
(
text
)
...
...
This diff is collapsed.
Click to expand it.
www/js/services/wot-services.js
+
9
−
0
View file @
8405bcc0
...
...
@@ -856,6 +856,15 @@ angular.module('cesium.wot.services', ['ngApi', 'cesium.bma.services', 'cesium.c
return
api
.
data
.
raisePromise
.
search
(
text
,
idties
,
'
pubkey
'
)
.
then
(
function
()
{
// remove CS+ ids that match pubkey regex (considered attacks) - fix #959
idties
=
idties
.
filter
(
function
(
idty
)
{
if
(
BMA
.
regexp
.
PUBKEY
.
test
(
text
)
||
BMA
.
regexp
.
PUBKEY_WITH_CHECKSUM
.
test
(
text
))
{
text_pk
=
text
.
split
(
'
:
'
)[
0
]
return
idty
.
pubkey
==
text_pk
}
return
true
;
})
// Make sure to add uid to new results - fix #488
if
(
idties
.
length
>
lookupResultCount
)
{
var
idtiesWithoutUid
=
_
.
filter
(
idties
,
function
(
idty
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment