Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
walint
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
hub
walint
Commits
cdaeb321
Commit
cdaeb321
authored
Dec 31, 2021
by
jonny
Browse files
Options
Downloads
Patches
Plain Diff
check scriptUrl for script path
parent
b816da37
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!6
fixed url injection by means of starting an url with "." and turning the prefix into a subdomain
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Properties.hs
+10
-5
10 additions, 5 deletions
lib/Properties.hs
with
10 additions
and
5 deletions
lib/Properties.hs
+
10
−
5
View file @
cdaeb321
...
@@ -12,7 +12,7 @@ module Properties (checkMap, checkTileset, checkLayer) where
...
@@ -12,7 +12,7 @@ module Properties (checkMap, checkTileset, checkLayer) where
import
Control.Monad
(
forM
,
forM_
,
unless
,
when
)
import
Control.Monad
(
forM
,
forM_
,
unless
,
when
)
import
Data.Text
(
Text
,
intercalate
,
isPrefixOf
,
isInfixOf
)
import
Data.Text
(
Text
,
intercalate
,
isPrefixOf
,
isInfixOf
,
unpack
)
import
qualified
Data.Text
as
T
import
qualified
Data.Text
as
T
import
qualified
Data.Vector
as
V
import
qualified
Data.Vector
as
V
import
Tiled
(
Layer
(
..
),
Object
(
..
),
Property
(
..
),
import
Tiled
(
Layer
(
..
),
Object
(
..
),
Property
(
..
),
...
@@ -45,6 +45,7 @@ import Paths (PathResult (..), RelPath (..), getExtension,
...
@@ -45,6 +45,7 @@ import Paths (PathResult (..), RelPath (..), getExtension,
isOldStyle
,
parsePath
)
isOldStyle
,
parsePath
)
import
Types
(
Dep
(
Link
,
Local
,
LocalMap
,
MapLink
))
import
Types
(
Dep
(
Link
,
Local
,
LocalMap
,
MapLink
))
import
Uris
(
SubstError
(
..
),
applySubsts
,
parseUri
,
extractDomain
)
import
Uris
(
SubstError
(
..
),
applySubsts
,
parseUri
,
extractDomain
)
import
Debug.Trace
(
traceId
,
traceShow
,
trace
)
...
@@ -142,7 +143,7 @@ checkMapProperty p@(Property name _) = case name of
...
@@ -142,7 +143,7 @@ checkMapProperty p@(Property name _) = case name of
-- scripts can be used by one map
-- scripts can be used by one map
_
|
T
.
toLower
name
==
"script"
->
_
|
T
.
toLower
name
==
"script"
->
unwrapString
p
$
\
str
->
unwrapString
p
$
\
str
->
unless
((
checkIsRc3Url
str
)
&&
unless
((
checkIsRc3
Script
Url
str
)
&&
(
not
$
"/../"
`
isInfixOf
`
str
)
&&
(
not
$
"/../"
`
isInfixOf
`
str
)
&&
(
not
$
"%"
`
isInfixOf
`
str
)
&&
(
not
$
"%"
`
isInfixOf
`
str
)
&&
(
not
$
"@"
`
isInfixOf
`
str
))
(
not
$
"@"
`
isInfixOf
`
str
))
...
@@ -339,11 +340,15 @@ checkObjectGroupProperty (Property name _) = case name of
...
@@ -339,11 +340,15 @@ checkObjectGroupProperty (Property name _) = case name of
_
->
warn
$
"unknown property "
<>
prettyprint
name
<>
" for objectgroup layers"
_
->
warn
$
"unknown property "
<>
prettyprint
name
<>
" for objectgroup layers"
checkIsRc3Url
::
Text
->
Bool
checkIsRc3Url
::
Text
->
Bool
checkIsRc3Url
text
=
case
extractDomain
text
of
checkIsRc3Url
text
=
case
parseUri
text
of
Nothing
->
False
Nothing
->
False
Just
domain
->
do
Just
(
protocol
,
domain
,
_
)
->
protocol
==
"https"
&&
domain
==
"static.rc3.world"
domain
==
"https://static.rc3.world"
checkIsRc3ScriptUrl
::
Text
->
Bool
checkIsRc3ScriptUrl
url
=
checkIsRc3Url
url
&&
case
parseUri
url
of
Nothing
->
False
Just
(
_
,
_
,
path
)
->
"/scripts"
`
isPrefixOf
`
path
-- | Checks a single (custom) property of a "normal" tile layer
-- | Checks a single (custom) property of a "normal" tile layer
checkTileLayerProperty
::
Property
->
LintWriter
Layer
checkTileLayerProperty
::
Property
->
LintWriter
Layer
...
...
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
register
or
sign in
to comment