Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
debomatic-webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
debomatic-webui-admins
debomatic-webui
Commits
cd7f5c26
Commit
cd7f5c26
authored
Aug 29, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better code to forbid accesses to chroots
parent
c931a2a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
18 deletions
+11
-18
debomatic-webui/lib/app.coffee
debomatic-webui/lib/app.coffee
+11
-18
No files found.
debomatic-webui/lib/app.coffee
View file @
cd7f5c26
...
@@ -45,25 +45,18 @@ if config.routes.commands
...
@@ -45,25 +45,18 @@ if config.routes.commands
# debomatic static page
# debomatic static page
if
config
.
routes
.
debomatic
if
config
.
routes
.
debomatic
app
.
all
config
.
routes
.
debomatic
+
"*"
,
(
req
,
res
,
next
)
->
chroot_forbidden
=
(
res
)
->
# send 403 status when users want to browse the chroots:
res
.
status
(
403
).
send
"""<h1>403 Forbidden</h1>
# - unstable/unstable
<h2>You cannot see the chroot internals</h2>"""
# - unstable/build/*
# this prevents system crashes
app
.
get
config
.
routes
.
debomatic
+
'/:distribution/:subdir'
,
(
req
,
res
,
next
)
->
base
=
config
.
routes
.
debomatic
if
req
.
params
.
distribution
==
req
.
params
.
subdir
base
+=
"/"
if
base
[
base
.
length
-
1
]
isnt
"/"
# append /
chroot_forbidden
(
res
)
match
=
req
.
url
.
replace
(
base
,
""
).
split
(
"/"
)
else
match
.
pop
()
if
match
[
match
.
length
-
1
]
is
""
if
match
.
length
>=
2
and
((
match
[
0
]
is
match
[
1
])
or
# case unstable/unstable
(
match
[
1
]
is
"build"
and
match
.
length
>
2
))
# case unstable/build/*
res
.
status
(
403
).
send
"""<h1>403 Forbidden</h1>
<h2>You cannot see the chroot internals</h2>
"""
else
# call next() here to move on to next middleware/router
next
()
next
()
return
app
.
get
config
.
routes
.
debomatic
+
'/:distribution/build/:subdir'
,
(
req
,
res
)
->
chroot_forbidden
(
res
)
app
.
get
config
.
routes
.
debomatic
+
'/:distribution/logs/:file'
,
(
req
,
res
)
->
app
.
get
config
.
routes
.
debomatic
+
'/:distribution/logs/:file'
,
(
req
,
res
)
->
distribution
=
req
.
params
.
distribution
distribution
=
req
.
params
.
distribution
...
...
Write
Preview
Markdown
is supported
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