Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
1a4f1df5
Commit
1a4f1df5
authored
12 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Add CSRF protection to client's forms
parent
c70b987f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
client.inc.php
+10
-1
10 additions, 1 deletion
client.inc.php
include/client/login.inc.php
+1
-0
1 addition, 0 deletions
include/client/login.inc.php
include/client/open.inc.php
+1
-0
1 addition, 0 deletions
include/client/open.inc.php
include/client/view.inc.php
+1
-0
1 addition, 0 deletions
include/client/view.inc.php
with
13 additions
and
1 deletion
client.inc.php
+
10
−
1
View file @
1a4f1df5
...
...
@@ -51,8 +51,17 @@ if($_SESSION['_client']['userID'] && $_SESSION['_client']['key'])
if
(
$thisclient
&&
$thisclient
->
getId
()
&&
$thisclient
->
isValid
()){
$thisclient
->
refreshSession
();
}
/******* CSRF Protectin *************/
// Enforce CSRF protection for POSTS
if
(
$_POST
&&
!
$ost
->
checkCSRFToken
())
{
@
header
(
'Location: index.php'
);
//just incase redirect fails
die
(
'Action denied (400)!'
);
}
/* Client specific defaults */
define
(
'PAGE_LIMIT'
,
DEFAULT_PAGE_LIMIT
);
define
(
'PAGE_LIMIT'
,
DEFAULT_PAGE_LIMIT
);
$nav
=
new
UserNav
(
$thisclient
,
'home'
);
?>
This diff is collapsed.
Click to expand it.
include/client/login.inc.php
+
1
−
0
View file @
1a4f1df5
...
...
@@ -7,6 +7,7 @@ $ticketid=Format::input($_POST['lticket']?$_POST['lticket']:$_GET['t']);
<h1>
Check Ticket Status
</h1>
<p>
To view the status of a ticket, provide us with the login details below.
</p>
<form
action=
"login.php"
method=
"post"
id=
"clientLogin"
>
<?php
csrf_token
();
?>
<strong>
Authentication Required
</strong>
<div>
<label
for=
"email"
>
E-Mail Address:
</label>
...
...
This diff is collapsed.
Click to expand it.
include/client/open.inc.php
+
1
−
0
View file @
1a4f1df5
...
...
@@ -13,6 +13,7 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):$info;
<h1>
Open a New Ticket
</h1>
<p>
Please fill in the form below to open a new ticket.
</p>
<form
id=
"ticketForm"
method=
"post"
action=
"open.php"
enctype=
"multipart/form-data"
>
<?php
csrf_token
();
?>
<input
type=
"hidden"
name=
"a"
value=
"open"
>
<div>
<label
for=
"name"
class=
"required"
>
Full Name:
</label>
...
...
This diff is collapsed.
Click to expand it.
include/client/view.inc.php
+
1
−
0
View file @
1a4f1df5
...
...
@@ -91,6 +91,7 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) {
<div
id=
"msg_warning"
>
<?php
echo
$warn
;
?>
</div>
<?php
}
?>
<form
id=
"reply"
action=
"tickets.php?id=
<?php
echo
$ticket
->
getExtId
();
?>
#reply"
name=
"reply"
method=
"post"
enctype=
"multipart/form-data"
>
<?php
csrf_token
();
?>
<h2>
Post a Reply
</h2>
<input
type=
"hidden"
name=
"id"
value=
"
<?php
echo
$ticket
->
getExtId
();
?>
"
>
<input
type=
"hidden"
name=
"a"
value=
"reply"
>
...
...
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