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

Mongo Saver: Save only known top level keys #321

Merged
merged 3 commits into from
Sep 14, 2020
Merged

Conversation

glensc
Copy link
Contributor

@glensc glensc commented Sep 7, 2020

Mongo Saver: Save known top-level keys

This will prevent Upload or File saver submitting totally arbitrary top-level keys.

@glensc
Copy link
Contributor Author

glensc commented Sep 14, 2020

Due to this sanitizing that known input is submitted, found a bug that MongoSaver test calls save for multiple profiling:

The mongodb insert maybe supports inserting multiple records a time:

but the rest of the code in the block assumes single row:

  • if (!isset($data['_id'])) {
    $data['_id'] = self::getLastProfilingId();
    }
    if (isset($data['meta']['request_ts'])) {
    $data['meta']['request_ts'] = new MongoDate($data['meta']['request_ts']['sec']);
    }

@glensc glensc requested a review from a team September 14, 2020 18:04
@glensc glensc changed the title Drop superfluous fields Mongo Saver: Save known top level keys Sep 14, 2020
@glensc glensc changed the title Mongo Saver: Save known top level keys Mongo Saver: Save only known top level keys Sep 14, 2020
This will prevent Upload or File saver submitting totally arbitrary
top-level keys.
@glensc glensc merged commit 8a45a11 into master Sep 14, 2020
@glensc glensc deleted the drop-superfluous-fields branch September 14, 2020 23:15
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

Successfully merging this pull request may close these issues.

None yet

1 participant