-
Notifications
You must be signed in to change notification settings - Fork 61
Filtering AppConfig #46
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
Comments
Today the AppConfig is serialized with JSON2 and passed on the query string to retrieve the AppManifest. The call that is made to In talking to some other developers, I heard that developers have encountered stringify issues with the AppConfig and have resolved them by overriding I also agree that it is excessive to pass up the entire AppConfig. Of the properties that are in there, the ones I know could be of use to an app on the server-side (for dynamically generated AppManifest) are appId, context, instanceId, and isSecure. |
Perhaps I misunderstand the issue, but are you talking about removing AppConfig.context from being passed to the server? I think using the context object to set up properties for your model is an intuitive way to pass information. If context is removed, we should make it clear in the docs that it's only for one-way communication (Server -> Client). The issue of URL length is certainly a consideration since JSONP won't allow us to use POST for requests. Is there a way we could make a hash of the url using the developers key so they can decode it on the backend? I realize it's not a perfect security solution (since the key would live in the JS), but it's better than transmitting the info in plain text. |
@montlebalm I added support in F2.js for |
@montlebalm I think the issue is that a container developer might put things into |
The central problem is what parameters should be passed to the manifestUrl. Currently, the entire appConfig is serailized and passed as a parameter to the manifestUrl, including what may be sensitive information. After some rumination, I don't think that a filter is the right way to solve the problem -- the manifestUrl is too central to F2 to allow choice and variation in the handling by individual implementers. Here is my proposal:
|
@ilinkuo so you're saying don't serialize any of appConfig.context? |
@brianbaker Yes, that's my new proposal. In other words, ask yourself, what is the manifestUrl server supposed to do with the information you send it? All the existing MoD demo apps, AFAIK, use the same manifestUrl. The actual response only varies based on the appId. Does it need to respond to the other parameters? And even if it did, should it, as that seems to be a very undocumented behavior to me. Even if it does, I think that part of the dynamic behavior can be deferred to the scripts that fetch and execute content after the initial load. |
The server can make a little more efficient use of time/resources and go ahead and render content relevant to the current context rather than having to load an empty app and then go off and make data requests, etc. to populate the app. The example news app, while it does not use context on load (because the container wasn't setup to pass it a symbol), does use context later on to refresh the news. Looking ahead on the roadmap there are plans to introduce a more structured context protocol as well. This behavior is documented over here, so we couldn't remove it at this point without a major version bump. |
I'm not looking to make this change as it's not a blocker, just a concern for me at this point. But it will be a problem once/if client information is placed into the appConfig. The efficient rendering concern is legit, and if I recall correctly, Twitter backed away from a pure ajax approach back to server-side rendering for that reason. Numbers would help to prove the actual performance gain. However, I think there are two advantages to the approach that I propose:
|
@ilinkuo I think the points you made in the previous comment are very good, and I really like the idea of generating a hash of the app manifest for stability and comparison. We'll consider this during development of the Registry. Thanks. |
@markhealey Great! Hope to see that feature in the Registry. Let me know if you want to discuss that more. |
Looking at the AppConfig docs, the properties that an app could need on the server-side are:
Anything else? |
Maybe also version information -- both app version and F2 spec version? |
We haven't totally fleshed out the hash of the |
Just a thought, but you might also consider separating the organization id from the app id, either as a separate parameter, or by virtue of using a separator that is not "_". Having both the organization and the app all together in the current id makes it hard to parse out, and makes it difficult to manage apps by organization. Coming from the Java world, I take my sense of what is needed from Maven, a very successful build tool for java -- see https://support.sonatype.com/entries/20900431-What-is-a-Maven-Artifact-Coordinate- |
For RSS Reader, we're adding applying a whitelist to the appConfig before serializing as query string to manifest request. The whitelist currently must be communicated out-of-band. In the future, it could be a part of the F2 registry. See http://jsfiddle.net/ilinkuo/UJgX5/ for the whitelist function, not dependent on Dojo or jQuery. |
@ilinkuo I like the idea of an In an effort to summarize the 19 comments in this discussion, where do we stand? Here are the options I've arrived at:
Let's get some thoughts on this to keep the discussion going. Thanks. |
I'm having trouble seeing the practicality in freezing the AppManifest. @ilinkuo, it sounds like you're talking about hashing the content of the scripts and styles as well. I'm not sure it's feasible for apps to be so rigid given the distributed nature. What would you do if the hash failed to match on page load? Not render the app? Semver seems like an acceptable middle ground to me. What if we set up versioning similar to NPM? A container could say, "I want version ~1.2", which would match 1.2.0 through 1.2.9. |
I've been busy in release issues, so sorry for the late response: @montlebalm
Using an npm-like system can work. In that case, the entire set of app resources would be loaded to a central "npm"-repository. App owners can upload their resources to the repository, but shouldn't be able to modify existing entries without updating the semver. Taking this approach, however, place responsibility (and liability) upon the central respository to ensure the process is followed. I think that would be too much for MOD to take on. It also greatly changes the F2 App distribution model. Thus I would still prefer having the hash. Another thing that could supplement or replace the hash would be the github SHA1 value. The tradeoff would be that the Container loses the ability to verify on load but gains the capability to analyze the full source tree if necessary, and the App publisher gains the ability to easily roll back. To make this easy to use, I imagine there would be a grunt task created: grunt-f2 -h |
@ilinkuo I can appreciate the sentiment, but I think at best we're dancing around the illusion of safety. If F2 apps were completely static, checking hashes and reverting to previous versions would be sufficient. In my experience, apps are valuable because they pull in dynamic content. I think we can both agree that the safety of hash verified scripts and styles can be compromised via async calls. I don't want to be reductive, but containers shouldn't do business with app developers they don't trust. If we can agree that trust is necessary, we can move on to a situation where both parties can arrange to have the right version of an app delivered to the right page. Semver, when properly implemented, would allow you (and all the other containers receiving the same app) to receive non-breaking bug fixes and internal refactors. These are not easy problems to solve. Containers want bug free apps that only change when explicitly asked. App developers want to distribute to multiple containers and have the ability to ship fixes when necessary. The reality is that apps need some ability to ship changes without emailing a zip file to every container it services. |
While I can agree that all security, especially TSA security, is a dance, there are still reasons to do the dance:
"Trust, but verify" was President Reagan's motto. The hash is the means of verification.
I never mentioned a zip file so there seems to be some misunderstanding. Let me spell out in detail what I'm proposing before deciding to table it.
The burden I'm imposing on the app developer is that he/she must update the semver and the hash value in the manifest whenever the manifest or one of the resources listed in the manifest is altered. In my opinion, that is what I consider
If you take a more high-level view of this procedure, the model of "semver done right" are version control systems such as git -- a resource change necessitates a semver change. |
@markhealey To bring this discussion back to the original topic and to address #46 (comment) I want to go over what I think are the fundamental issues again before looking at the actions. In my mind, these are the important issues:
Of the four options in @markhealey's comment,
|
A partial proposal which solves our immediate problem but doesn't address the question of who owns what is:
|
Pulled from #38:
The text was updated successfully, but these errors were encountered: