-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add a secure registry to F2 #163
Comments
This sounds like it would be a security concern for app developers. The container would have access to any property on any app. Currently, only F2 controls the app instances as a firewall between containers and apps. Is the purpose to allow more powerful plugin development? |
The purpose is not for more powerful plugin development -- it's for the Container to do its job conveniently. Currently, the Container has to keep track of the AppConfigs it passes in in its own private registry. This proposal would remove that duplication. There is no security concern here. The source of the AppConfig information is the Container, so there isn't any registry information that the Container doesn't already have. However, I am very concerned about what I see as misguided security concerns.
The Container owner controls the page, so there really isn't any way to protect the App from the Container. If the Container wants to mess with the App, it can load its own version of F2. The only way that an App can guard against the Container is to refuse to load at all.
Placing trust in F2 is misguided. F2 is a public object in global space with public methods. Any of these methods can be easily hijacked. If an App from evil.com wants to know the registry information, it can just hijack As for being a firewall, there are three avenues to guard:
It seems to me like F2 thinks a lot about the first avenue and neglects the other two, especially the last. I'm not sure what the reason for this emphasis is, but it's contrary to my sense of security. I would recommend the approach that F2 give up on protecting the App from the Container using F2, and instead enlist the Container's help in hardening defenses against 2 & 3. |
Is there a need for the container to get at the actual instance of an App? Or does the container just need access to the configs? Today |
@ilinkuo Would you see this request and #46 as accomplishing some of the same goals? To borrow from your jsfiddle, when manifest requests are sent they are sent the filteredCopy from a call to |
In our implementation there is, but that's because we're filling a hole in the F2 spec. The spec does not specify an F2 App lifecycle. The F2.removeApp() is inadequate, as all it does is remove the App from the DOM, leaving orphaned handlers and other resources. We've asked Ivan to implement two lifecycle methods destroy() and unload(). The second reason we're doing this is because the App is asking for a list of all instanceIds of a certain type via I would agree that ideally, the framework is the only one that should be modifying the AppConfig list or its contents. But I disagree with @montlebalm about the reason. I think the correct reason is a clear division of responsibility -- the framework is the one that owns the list and all modification requests should be made through the framework. However, since the framework is currently providing no access at all to the AppConfig list, I'm forced to hacks like these. Nonetheless, this fiddle illustrates the one of the major philosophical differences I've had with the F2 team. I think the Container should have more privileged access to F2 internals than the F2 Apps, whereas most F2 developers seem to think the Container should have less access, because of what I consider misguided security priorities. This fiddle illustrates a technique for how my security vision can happen that I hope F2 adopts.
This uses the same filterClone function toward security goals, but I think the final goal is quite different. |
I don't think I've heard anyone argue that Apps should have more access than the Container. Rather, the arguments I've seen have been advocating equal privacy for both. I think there's little chance the library would open up App instances (or InstanceIds) to the container. Clever use of targeted events could solve those issues without compromising private data. A registry of AppConfigs sounds reasonable since the container most likely has access to them already. We've implemented a |
I should qualify the above comment by saying that we are still on 1.1.2. In the newest versions of F2, there are the AppHandler hooks which does attempt to invoke Also, the |
@ilinkuo I didn't see a reply to @brianbaker's question above. Regarding the firewall comments and, specifically, these 3 avenues:
No one has mentioned secure apps. The current version of F2 has adequate support for App/Container protections via secure apps. Very few implementers use them though because iframes lead to poor user experiences. If implementers aren't using secure apps, they're inherently trusting the other parties they're sharing a page with and throwing a bit of caution to the wind. Let's wrap this one up. I am in favor of adding a registry for Containers because every single Container I've seen has a duplicate copy of apps which if nothing else is a waste of time. I don't see an issue with providing the contents of |
@markhealey The documentation is insufficient. It isn't mentioned in the docs that the // call the apps destroy method, if it has one
if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function') The documentation does mention events of
Do you mean this question?
This was my answer. Did you need more detail?
Finally,...
That's also why we're not using secure iframed apps. Hence it's not part of our discussion. While I agree that by deciding not to use iframes we've also decided to abandon the best security option that browsers currently provide, I feel that there needs to be a security discussion for non-iframed F2 Apps, if only for the sake of satisfying corporate security watchdogs. There is a big difference between throwing a BIT of caution to the wind and throwing ALL caution to the wind.
Yay! |
@markhealey Just so we're clear on terms, I'm interpreting If that's the case, then I strongly advise against adding |
@ilinkuo have you considered submitting a pull request? All of the spec documentation is open source in addition to the JS.
@montlebalm I'm thinking the |
@markhealey So would that be the function that returns the app class function? For example: F2.Apps['...'] = function() { // <-- Option 1
var App = function() {}; // <-- Option 2
return App;
} It sounds like you're thinking of What would the container do with that? I can't come up with a good use case. Of course, I have the perspective that nothing should be exposed except what's needed. Exclusionist, deletionist, whatever you want to call it. |
Yeah, a container wouldn't do anything with that—it's just what's in |
I'm currently handicapped in that respect. Pull requests would only be relevant with the current release, but we are working with a version too far back. However, an F2 upgrade is tentatively scheduled for the release after this, so I may be able to more actively contribute then.
@montlebalm I would recommend using the |
Add a secure registry to F2 so that the Container can get at the list of _apps on line 8 of https://github.com/OpenF2/F2/blob/master/sdk/src/container.js
and Apps can query the registry securely as well.
By "securely", I mean that only the Container can mutate the registry, and that the Apps receive only a safely filtered copy of what's in the registry. I envision that line 8 above would be replaced by
I've created a jsfiddle to illustrate the technique of creating a secure private mutatable accessor and a public non-mutatable accessor. We are putting this registry code into production in our next release, but without replacing line 8 above.
The text was updated successfully, but these errors were encountered: