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

Capability spillage #5

Open
guybedford opened this issue Aug 27, 2020 · 1 comment
Open

Capability spillage #5

guybedford opened this issue Aug 27, 2020 · 1 comment

Comments

@guybedford
Copy link

One class of attacks is when a capability is inadvertantly exposed that wasn't intended to be. I would argue these are actually the most important class of attacks to protect against - that the membrane must protect capabilities from never crossing boundaries unintentionally as its primary goal.

Here's the example case with cytoplasm:

const { Membrane } = require('./dist/index.js');
const createReadOnlyDistortion = require('./src/distortions/readOnly.js');

const membrane = new Membrane();
const graphA = membrane.makeMembraneSpace({ label: 'a', createHandler: createReadOnlyDistortion });
const graphB = membrane.makeMembraneSpace({ label: 'b' });

const objA = {
  set: function (val) {
    this.hack();
  }
};

const privateState = {
  setter: undefined,
  hack () {
    throw new Error('Hacked a private method');
  }
};
const objB = {
  setSetter (setter) {
    privateState.setter = setter;
  },
  runSetter () {
    privateState.setter();
  }
}

const objAWrap = membrane.bridge(objA, graphA, graphB);
const objBWrap = membrane.bridge(objB, graphB, graphA);

objBWrap.setSetter(objAWrap.set);
objBWrap.runSetter();

I understand distinguishing the intent from what is expected here can be hard, and I still need to think through this myself so may well be over-assuming this security property too, but this is where taking a slightly more practical "lossy" approach in the name of improving these sorts of inadvertant cases might be worthwhile?

@guybedford
Copy link
Author

I've most certainly misunderstood the complete model so feel free to poke holes in my assumptions here too!

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

No branches or pull requests

1 participant