-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: lock down pnotes to user #6550
Conversation
interface/main/messages/messages.php
Outdated
$tmp = getPnotesByUser('1', 'no', $_SESSION['authUser']); | ||
while ($tmp_row = sqlFetchArray($tmp)) { | ||
if ( | ||
($tmp_row['id'] == $noteid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't this die if more than 1 note is returned in $tmp
may make sense to have a new Pnote function called checkPnotesNoteid(int $id, string $user): bool that would do:
if (!checkPnotesNoteid($noteid,$_SESSION['authUser'] )) {
die("There was an error processing your request.");
}
library/pnotes.inc.php
Outdated
*/ | ||
function checkPnotesNoteId(int $id, string $user): bool | ||
{ | ||
return sqlQuery("SELECT `id`, `user` FROM pnotes WHERE id = ? AND user = ? AND deleted != 1", array($id, $user)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to force the boolean return would do something like (the second check in the conditional is a bit of overkill but might as well :) ):
$check = sqlQuery("SELECT `id` FROM pnotes WHERE id = ? AND user = ? AND deleted != 1", [$id, $user]);
if (!empty($check['id']) && ($check['id'] == $id)) {
return true;
} else {
return false;
}
@@ -350,16 +350,8 @@ | |||
$noteid = $_GET['noteid']; | |||
} | |||
// Check to make sure the noteid is assigned to the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lines 349-351 are throwing me off a bit. it seems like below code (and original code) would break if $_GET['noteid'] is not set, yet that block above lets it run if not set. I'd prob instead do something like:
$noteid = (int)$_GET['noteid'];
if (empty($noteid)) {
die("There was an error processing your request.");
}
* fix: bug * review suggestion, create dedicated function * further review fixes
* convert metric head circ to in for charting (#6556) * fix: bug (#6550) * fix: bug * review suggestion, create dedicated function * further review fixes * Fix styling and bug (#6434) * Fix styling and bug * Fix PSR * Suggested changes * Suggested changes * Suggested changes of return type * Suggested changes to lines 148 and 143 * Suggested changes to 143 space * Additional changes * Fit to window patch in admin.php script (#6521) * feat: implement chart review mechanism (#6554) * use patient filter for remote chart review * remove pt filter event module from tests since now in zend modules * use date range for effective date * custom json * clean up pid by payer list.php * clean up from review * more clean up from review * better custom json name and doc block for ins co svc * better name for util script * fix name for module * remove test module dir * styling * Merge pull request #5 from stephenwaite/cms-rel-701-bill-rpt (#6559) Cms rel 701 bill rpt * fix: bugs (#6552) * more fixes * remove test.php * jerry's got this * fix: default payment method for checkout (#6565) * fix: change acl_req in prior auth module for custom patient menu (#6579) * fix: topatient call in billing report load encounter dropdown (#6584) * fix: topatient call in billing report * fix 701 to 702 upgrade * create separate PR * fix: toggle inactive facilities (#6587) * initial sql changes and start of display * toggle inactive facilities display * simplify naming * seed initial facility --------- Co-authored-by: Sherwin Gaddis <sherwingaddis@gmail.com> Co-authored-by: Steven <38847165+stevenpjohnso@users.noreply.github.com>
Fixes #
Short description of what this resolves:
Changes proposed in this pull request: