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

API: Add submission with non existing sectionId results Fatal Error #9471

Closed
defstat opened this issue Oct 31, 2023 · 6 comments
Closed

API: Add submission with non existing sectionId results Fatal Error #9471

defstat opened this issue Oct 31, 2023 · 6 comments
Assignees
Milestone

Comments

@defstat
Copy link
Collaborator

defstat commented Oct 31, 2023

Describe the bug
If a user tries to call the add endpoint of the submission API providing a sectionId that can't be found in the DB, a fatal error is produced

To Reproduce
Steps to reproduce the behavior:
POST http://localhost:8000/index.php/publicknowledge/api/v1/submissions with following data

"commentsForTheEditors": "test api insert",
"locale": "en_US",
"sectionId": 0,
"userGroupId": 0

What application are you using?
OJS, OMP or OPS version 3.4

Additional information
PKPSubmissionHandler => add function does not check if the $section = Repo::section()->get($sectionId, $context->getId()); is returning a valid section entity. Should check and add a validation error.


PRs

Branch stable-3_4_0
PKP-LIB: #9472
OJS: pkp/ojs#4192 TESTS ONLY

Branch main
PKP-LIB: #9473
OMP: pkp/omp#1526 TESTS ONLY

defstat added a commit to defstat/pkp-lib that referenced this issue Oct 31, 2023
@defstat defstat self-assigned this Oct 31, 2023
defstat added a commit to defstat/pkp-lib that referenced this issue Oct 31, 2023
defstat added a commit to defstat/pkp-lib that referenced this issue Oct 31, 2023
@defstat
Copy link
Collaborator Author

defstat commented Oct 31, 2023

@asmecher I have added PRs for this issue for review.

@asmecher
Copy link
Member

@defstat, will this work with OMP, where series are optional?

defstat added a commit to defstat/pkp-lib that referenced this issue Feb 16, 2024
@defstat
Copy link
Collaborator Author

defstat commented Feb 16, 2024

@defstat, will this work with OMP, where series are optional?

@asmecher given that the section related code is already in place at the PKP-LIB level here, OMP is already taken into account.

The $params[$sectionIdPropName] will not be set if series is not defined, thus not taking into account the section related code. Do you have something else in mind for this?

defstat added a commit to defstat/omp that referenced this issue Feb 16, 2024
defstat added a commit to defstat/pkp-lib that referenced this issue Feb 17, 2024
defstat added a commit to defstat/ojs that referenced this issue Feb 17, 2024
asmecher pushed a commit that referenced this issue Feb 22, 2024
@asmecher
Copy link
Member

That makes sense, @defstat, thanks. I've merged to main but as I'm just about to release from stable-3_4_0 I'd rather not make a last-minute merge there unless it's a bug actually causing trouble in the wild. I'd be open to either merging to stable-3_4_0 after this next release, or just leaving it as is. Do you have a preference?

@asmecher asmecher added this to the 3.5.0 LTS milestone Feb 23, 2024
@defstat
Copy link
Collaborator Author

defstat commented Feb 23, 2024

That makes sense, @defstat, thanks. I've merged to main but as I'm just about to release from stable-3_4_0 I'd rather not make a last-minute merge there unless it's a bug actually causing trouble in the wild. I'd be open to either merging to stable-3_4_0 after this next release, or just leaving it as is. Do you have a preference?

Ι have no strong opinion on that. It seems that this is not widely reported, so we could leave it unmerged for the stable branch and revisit it if a related issue/need comes up

@asmecher
Copy link
Member

Makes sense to me, thanks!

ipula pushed a commit to ipula/pkp-lib that referenced this issue Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants