Skip to content
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

Merged
merged 3 commits into from
Jun 14, 2023
Merged

Conversation

stephenwaite
Copy link
Member

Fixes #

Short description of what this resolves:

Changes proposed in this pull request:

$tmp = getPnotesByUser('1', 'no', $_SESSION['authUser']);
while ($tmp_row = sqlFetchArray($tmp)) {
if (
($tmp_row['id'] == $noteid)
Copy link
Member

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.");
}

*/
function checkPnotesNoteId(int $id, string $user): bool
{
return sqlQuery("SELECT `id`, `user` FROM pnotes WHERE id = ? AND user = ? AND deleted != 1", array($id, $user));
Copy link
Member

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
Copy link
Member

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.");
}

@bradymiller
Copy link
Member

tenor99

@stephenwaite stephenwaite merged commit 96538b9 into openemr:master Jun 14, 2023
stephenwaite added a commit to stephenwaite/openemr that referenced this pull request Jun 15, 2023
* fix: bug

* review suggestion, create dedicated function

* further review fixes
stephenwaite added a commit that referenced this pull request Jun 20, 2023
* 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>
@adunsulag adunsulag added this to the 7.0.2 milestone Nov 10, 2023
@adunsulag adunsulag changed the title fix: bug bug: lock down pnotes to user Nov 16, 2023
@adunsulag adunsulag added the developers This issue targets an issue that is for developers/collaborators/module writers/technical users label Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developers This issue targets an issue that is for developers/collaborators/module writers/technical users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants