You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Referencing ${self:} leads to crash in the print command #4556
When referencing ${self:} with the new circular variables support, the print command will crash with a stack overflow. (For details see #4144 (review) and the discussion in the PR).
This is due to a missing circular object support in the modules to traverse the service object tree used by the print command.
Update:
js-yaml doesn’t and will not support cyclic objects. I opened nodeca/js-yaml#387 and was advised that as callers we have the responsibility to sanitize the input.
Oops. Just seeing that comment. I suppose we could but I've submitted a change that would solve this issue.
There was the issue of cycles but there was also the issue that self-references pulled in the original "augmented" service (via the cache) as opposed to the stripped down service being explicitly loaded in the print command. See print.js, lines 38 & 39 for the remediation.
In implementing a fix, I first tried re-using the already populated service (it was hanging off of this.serverless) but found that version of the service was all sorts of augmented. My initial attempts to reverse that were...
...but there were other additions (e.g. on this.serverless.service.provider) and it struck me there was a general issue and that this is why the existing implementation was chosen (to avoid the whack-a-mole and update print command liability re-using the populated service represents).
The counter to that perspective is that as implemented there is a risk that we miss changes in the standard path... it's a dilemma. However, there is a nuanced to solve problem of identifying what was an addition and what was already present in the service. Additionally perhaps a "what wasn't in the service but is now and we want to show it" problem.
Activity
HyperBrain commentedon Dec 11, 2017
/cc @horike37 @erikerikson @pmuens
This is the decoupled bug for the print command
erikerikson commentedon Dec 13, 2017
Update:
js-yaml doesn’t and will not support cyclic objects. I opened nodeca/js-yaml#387 and was advised that as callers we have the responsibility to sanitize the input.
HyperBrain commentedon Dec 14, 2017
Thanks for the update 💯
So we should probably go for a different module that supports cyclic objects instead of js-yaml.
erikerikson commentedon Dec 14, 2017
Oops. Just seeing that comment. I suppose we could but I've submitted a change that would solve this issue.
There was the issue of cycles but there was also the issue that self-references pulled in the original "augmented" service (via the cache) as opposed to the stripped down service being explicitly loaded in the print command. See print.js, lines 38 & 39 for the remediation.
erikerikson commentedon Dec 14, 2017
In implementing a fix, I first tried re-using the already populated service (it was hanging off of
this.serverless) but found that version of the service was all sorts of augmented. My initial attempts to reverse that were......but there were other additions (e.g. on
this.serverless.service.provider) and it struck me there was a general issue and that this is why the existing implementation was chosen (to avoid the whack-a-mole and update print command liability re-using the populated service represents).The counter to that perspective is that as implemented there is a risk that we miss changes in the standard path... it's a dilemma. However, there is a nuanced to solve problem of identifying what was an addition and what was already present in the service. Additionally perhaps a "what wasn't in the service but is now and we want to show it" problem.
Merge pull request #4572 from erikerikson/fix-crash-cycles-4556