Skip to content

encryption 2.0 app - #14472

Merged
DeepDiver1975 merged 119 commits into
masterfrom
feature/wipencryptionapp
Apr 7, 2015
Merged

encryption 2.0 app#14472
DeepDiver1975 merged 119 commits into
masterfrom
feature/wipencryptionapp

Conversation

@th3fallen

Copy link
Copy Markdown
Contributor

Depends on #14376

Very much in development. Please point out any missed opportunities to use new methods/interfaces @schiesbn

  • The encryption module needs a upgrade script to migrate the keys from the old encryption app to the new one, unfortunately we had to make some small changes to the folder structure (added by @schiesbn)

TODOs:

  • Throw exception in case a file cannot be decrypted because enc module could not be loaded - 503 on clients
  • Throw exception in case a file cannot be decrypted because encryption is disabled - 503 on clients - @schiesbn this is going to be funny - as soon as there is no enc manager we have no way to detect if a file is encrypted
  • Throw exception if keys are missing - 503 on clients
  • Prevent sharing in case keys are missing - pre hook
  • File size is lost on upload (browser and webdav)

To Test:

  • Versions
  • desktop sync
  • mount option

Broken scenarios:

  • share by link
  • delete, restore from trash, download -> corrupted - workaround - f7c9066
  • previews in trash bin are broken - works as soon as the trash wrapper is properly in place - see f7c9066

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes needs refactoring, a lot of things are not in di either.

@LukasReschke LukasReschke changed the title WIP encryption 2.0 app [WIP] encryption 2.0 app Feb 24, 2015
Comment thread apps/encryption/lib/recovery.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowStrength? 🙈

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, its just an identifier for the key, it used to be an md5 of the time so security isnt a big concern.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://crypto.junod.info/2012/05/24/owncloud-4-0-and-encryption/ – that's how we generated the key in the past, so we had quite some mistakes 🙈

But you are absolutely right: In this case this is okay. Valid point 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you are absolutely right

Never get tired of hearing that 😉 Lol (as infrequently as i do...)

@th3fallen
th3fallen force-pushed the feature/wipencryptionapp branch from 92b1dea to e84bdb0 Compare February 24, 2015 19:45
@DeepDiver1975 DeepDiver1975 added this to the 8.1-next milestone Feb 24, 2015

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please get rid of this - that's what different exception classes are for

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was copying functionality over, already have a note to update. (will be in next update)

@DeepDiver1975

Copy link
Copy Markdown
Member

2.6k SLOC and not one single unit test?

@schiesbn @th3fallen did you miss to add them? (Let there be hope ....)

@schiessle

Copy link
Copy Markdown
Contributor

@DeepDiver1975 can't speak for @th3fallen but I assume that he is still in the state where he copied a lot of stuff from the old encryption app, restructure it, start adding new code etc. So it is probably to early for unit tests (similar to my pr). I'm quite sure unit test will come if it is the right time for it.

@th3fallen of course you will add new unit tests for your classes and methods. But because most of the existing test in apps/files_encryption are quite high level you can probably reuse most of it as a addition to the new tests. I would also recommend to keep most of them around. Over time we added a lot of corner cases to the tests. So if the old (high-level) tests will pass on the new encryption we can already be quite sure that a lot of the new stuff works as expected.

Comment thread apps/encryption/appinfo/app.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you no longer need to register a stream wrapper. The stream wrapper is now in core

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks removed, will push with next update

@DeepDiver1975

Copy link
Copy Markdown
Member

But because most of the existing test in apps/files_encryption are quite high level you can probably reuse most of it as a addition to the new tests. I would also recommend to keep most of them around.

Well - in the first place we can keep the existing unit integration test - just to ensure that the high level operations continue to work. But these tests have to die and be replace by proper unit tests.

Furthermore unit test are to be written TOGETHER with the code and not afterwards.

Feel free to ping me anytime to get into the details - maybe a personal talk is better suited then commenting on github.

Thanks

@schiessle

Copy link
Copy Markdown
Contributor

You probably also don't need all the file and sharing related hooks. Rename and delete operations will update the key storage right here https://github.com/owncloud/core/pull/14376/files#diff-a36b9c0307e0126dd50baa38fb4bb74aR1

And I think I will also listen to share hooks in core calculate the new list of users and then use the update() call to inform you that a file/folder needs to be re-encrypted for a new set of users https://github.com/owncloud/core/pull/14376/files#diff-8d7e0ca7514556cd6929b4c073c9629dR90

@th3fallen

Copy link
Copy Markdown
Contributor Author

thanks for the notes @schiesbn will update, @DeepDiver1975 Since this is much more of a refactor than a rewrite i was waiting until i go the functionality copied over before i assessed the current status of tests. So i don't end up writing tests that are already written.

@DeepDiver1975

Copy link
Copy Markdown
Member

So i don't end up writing tests that are already written.

well - this is only partially valid - the existing test are more of an integration test type - we require unit tests.

I'm bugging you all that much - because code needs to written and structured in a way that true unit testing is possible. Just coding right away and applying unit tests afterwards will break.

So these are my requirement:

  • I want one unit test class for each introduced class in core
  • no static calls of what soever kind
  • no hard dependencies between classes - inject dependencies and use mocks on unit tests

Feel free to ping me anytime to get into the details - maybe a personal talk is better suited then commenting on github.

^ Still applies 😉

@th3fallen

Copy link
Copy Markdown
Contributor Author

fair enough... adds another thing to my list

@th3fallen
th3fallen force-pushed the feature/wipencryptionapp branch from dd1cbf7 to bc57d17 Compare March 4, 2015 19:13
@DeepDiver1975
DeepDiver1975 force-pushed the feature/wipencryptionapp branch from bc57d17 to 1c58251 Compare March 4, 2015 20:04
@DeepDiver1975 DeepDiver1975 mentioned this pull request Mar 4, 2015
1 task
@MorrisJobke

Copy link
Copy Markdown
Contributor

@DeepDiver1975 can't speak for @th3fallen but I assume that he is still in the state where he copied a lot of stuff from the old encryption app, restructure it, start adding new code etc. So it is probably to early for unit tests (similar to my pr). I'm quite sure unit test will come if it is the right time for it.

Write the unit tests in advance. Design the way you want to interact with the encryption in the unit/acceptance test and then write the implement the code that does the work ;)

Trust me: This will make the code a lot better! ;)

Comment thread lib/private/encryption/keystorage.php Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a unit test and performance POV using an Storage interface here makes more sense instead of the View - do I miss anything?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to have seperate key stores for system keys and user keys (where you inject the $uid so you have one keystore object per user)

Additionally instead of working on a View you should work directly on a Storage
The storage should have the keys in the root of the storage (create a new local storage for $user->getHome() .'/files/encryption' or $dataDir . '/files_encryption)

Working on a view wont work since you need to access the keyfiles without going trough encryption.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@icewind1991 can I ask you to come up with a POC on this approach? A PR against this branch would be best I guess - THX

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And unit tested of course 😉

@th3fallen

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 should setupServerSide() be a part of the app or core? Also ready()

@DeepDiver1975

Copy link
Copy Markdown
Member

should setupServerSide()

seems specific to the encryption implementation as it creates the keys

@DeepDiver1975

Copy link
Copy Markdown
Member

Also ready()

the same I guess

@DeepDiver1975

Copy link
Copy Markdown
Member

that might be better suited in core - as the keystore implementation know about the location of that folder: https://github.com/owncloud/core/blob/master/apps/files_encryption/lib/util.php#L156

@th3fallen

Copy link
Copy Markdown
Contributor Author

what i thought but wanted a second opinion. Thanks, boy this util class is a mess.

@th3fallen

Copy link
Copy Markdown
Contributor Author

i thought that was the case but i assumed there was a reason it was in the code.... What i get for assuming...

@DeepDiver1975

Copy link
Copy Markdown
Member

i thought that was the case but i assumed there was a reason it was in the code.... What i get for assuming...

dependencies in info.xml are relative new (since 8.0) - that's why 😉

@DeepDiver1975
DeepDiver1975 force-pushed the feature/wipencryptionapp branch from b82f07b to 54a3bdf Compare April 7, 2015 11:31
@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: 32 new issues, 273 updated code elements

@karlitschek

Copy link
Copy Markdown
Contributor

yes. awesome work guys :-)

@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@DeepDiver1975

Copy link
Copy Markdown
Member

bildschirmfoto von 2015-04-07 15 30 46

@th3fallen

Copy link
Copy Markdown
Contributor Author

🎉 🍺 🙌

@DeepDiver1975 DeepDiver1975 changed the title [WIP] encryption 2.0 app encryption 2.0 app Apr 7, 2015
@DeepDiver1975

Copy link
Copy Markdown
Member

👍

@th3fallen

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 missing migrator shouldn't we wait for that?

@DeepDiver1975

Copy link
Copy Markdown
Member

@DeepDiver1975 missing migrator shouldn't we wait for that?

we do this isolated in order to get going with other open prs

@schiessle

Copy link
Copy Markdown
Contributor

👍 migration will come in a seperate pull request later today

DeepDiver1975 added a commit that referenced this pull request Apr 7, 2015
@DeepDiver1975
DeepDiver1975 merged commit 1fbf5d8 into master Apr 7, 2015
@DeepDiver1975
DeepDiver1975 deleted the feature/wipencryptionapp branch April 7, 2015 14:46

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use weird date formats
iso_8601

https://xkcd.com/1179/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know us crazy Americans and our crazy date formats....

@DeepDiver1975

Copy link
Copy Markdown
Member

61038703

@LukasReschke

Copy link
Copy Markdown
Contributor

@th3fallen

Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels totally wrong :(

Returns boolean, string and can throw errors 🙈 🙉 🙊

@DeepDiver1975

Copy link
Copy Markdown
Member

file headers will be fixed with the license script .. pr is #15441

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.