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

Conflict between content blocks #100

Closed
penx opened this issue Jun 14, 2016 · 3 comments · Fixed by #149
Closed

Conflict between content blocks #100

penx opened this issue Jun 14, 2016 · 3 comments · Fixed by #149

Comments

@penx
Copy link

penx commented Jun 14, 2016

If two content blocks share the same name, or a content block on a page could contain request sensitive information, then the incorrect html content could be served to a user if the server is processing 2 separate requests asynchronously.

e.g.

  • 2 requests come in to the server from 2 different users
  • the first request is processed and saves a content block, but then encounters an async helper function
  • the second request is then processed before the first is completed, and consumes the content block that was saved to the blocks object by the first request
@jtwebman
Copy link
Collaborator

I created a test for this in PR #148. It doesn't seem to be an issue but maybe my test isn't tested what you are saying @penx. Let me know.

@jtwebman
Copy link
Collaborator

Ok after thinking about it more I think I have a failing test now See #148 @penx let me see if this can be fixed without much changing.

jtwebman added a commit to jtwebman/express-hbs that referenced this issue Aug 27, 2018
Fixed TryGhost#144 registerAsyncHelper using the wrong replace call
Fixes TryGhost#143 Update handlebars to 4.0.8 (did latest handlebars)
Fixed TryGhost#101 Cached blocks should be stored per request
Fixed TryGhost#100 Conflict between content blocks
Fixed TryGhost#99 Blocks prone to memory leaks

After digging round most of the weekend I fixed the block and sync cache issues by storing them
on the options which is setup once per request and passed to everything that needed it. This
also fixes the issue with using replace and special strings that can do funny things with
JavaScript replace vs using the function version.

I also update TravisCI to run the newer node versions for tests and update all the dependencies
to the latest versions.
@jtwebman
Copy link
Collaborator

@penx Figured it all out I think please take a look at my PR #149 to see if this fixes your issues as well.

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 a pull request may close this issue.

2 participants