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

Auth module #1019

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open

Auth module #1019

wants to merge 42 commits into from

Conversation

3ach
Copy link
Collaborator

@3ach 3ach commented Oct 4, 2019

Woo-hoo! A working prototype of the auth module!

@3ach 3ach requested a review from cjmyers October 4, 2019 22:45
@cjmyers
Copy link
Collaborator

cjmyers commented Oct 6, 2019 via email

@3ach
Copy link
Collaborator Author

3ach commented Oct 6, 2019

Does that mean collections you already had uploaded don't let you view them? I can't get mine to recreate that. I tried switching back to master, uploading a new collection, then switching to the auth branch and I can open it without issue.

@cjmyers
Copy link
Collaborator

cjmyers commented Oct 6, 2019 via email

@3ach
Copy link
Collaborator Author

3ach commented Oct 6, 2019

That's probably it. I have uploaded a version which should properly deal with spoofing.

@cjmyers
Copy link
Collaborator

cjmyers commented Oct 7, 2019 via email

@cjmyers
Copy link
Collaborator

cjmyers commented Oct 7, 2019 via email

@3ach
Copy link
Collaborator Author

3ach commented Oct 7, 2019 via email

@cjmyers
Copy link
Collaborator

cjmyers commented Oct 7, 2019 via email

@3ach
Copy link
Collaborator Author

3ach commented Oct 8, 2019 via email

@cjmyers
Copy link
Collaborator

cjmyers commented Oct 8, 2019 via email

@3ach
Copy link
Collaborator Author

3ach commented Oct 14, 2019

Testing --

  • return to page on manage sharing page doesn't actually return
  • spoofing doesn't work on share return to page
  • alias doesn't handle spoofing
  • needs to show up in shared with me
  • too many redirects instead of just not showing
  • edit privileges for existing share
  • edits don't actually work (shows login in iframe)

@cjmyers
Copy link
Collaborator

cjmyers commented Oct 25, 2019

Add to Collection for submit is broken with the new auth module.

@cjmyers
Copy link
Collaborator

cjmyers commented Nov 1, 2019

throw new ERR_HTTP_HEADERS_SENT('set');
^

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:470:11)
at ServerResponse.header (/Users/myers/git/synbiohub/node_modules/express/lib/response.js:771:10)
at ServerResponse.send (/Users/myers/git/synbiohub/node_modules/express/lib/response.js:170:12)
at ServerResponse.json (/Users/myers/git/synbiohub/node_modules/express/lib/response.js:267:15)
at ServerResponse.send (/Users/myers/git/synbiohub/node_modules/express/lib/response.js:158:21)
at Form.form.on (/Users/myers/git/synbiohub/lib/views/submit.js:105:21)
at Form.emit (events.js:187:15)
at handleError (/Users/myers/git/synbiohub/node_modules/multiparty/index.js:211:12)
at IncomingMessage.onReqAborted (/Users/myers/git/synbiohub/node_modules/multiparty/index.js:190:5)
at IncomingMessage.emit (events.js:182:13)
at abortIncoming (_http_server.js:444:9)
at socketOnClose (_http_server.js:437:3)
at Socket.emit (events.js:187:15)
at TCP._handle.close (net.js:611:12)

@3ach
Copy link
Collaborator Author

3ach commented Feb 3, 2020

I think I have addressed the comments we found in our earlier review of the auth module. I've also rebased it off master to include the OAuth changes and make it mergeable.

@cjmyers
Copy link
Collaborator

cjmyers commented May 6, 2020

Remove menu should be changed back to icon only for now

@cjmyers
Copy link
Collaborator

cjmyers commented May 6, 2020

Exception going to shared with me:

error: (node:44876) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined
at Object.getShared (/Users/myers/git/synbiohub/lib/auth/access.js:130:23)
at module.exports (/Users/myers/git/synbiohub/lib/views/shared.js:55:29)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
error: (node:44876) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
error: (node:44876) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@cjmyers
Copy link
Collaborator

cjmyers commented May 6, 2020

Creating a view only share link shows up in the share settings as view/edit/share

@cjmyers
Copy link
Collaborator

cjmyers commented May 6, 2020

Remove shared ownership then refresh leads to infinite redirections.

@cjmyers
Copy link
Collaborator

cjmyers commented May 6, 2020

Unable to edit public collections with old ownedBy tags

@cjmyers
Copy link
Collaborator

cjmyers commented May 6, 2020

Also cannot edit newly made public submissions

@cjmyers
Copy link
Collaborator

cjmyers commented May 6, 2020

When you make public, edit/share permissions should be migrated to the new URI, view permission can be safely removed.

The user whose graph this object is in, should get edit/share permissions granted to that user when an object is made public.

@cjmyers
Copy link
Collaborator

cjmyers commented May 6, 2020

The ability to make public, you should have share rights and be a curator.

@3ach 3ach force-pushed the auth-module branch 3 times, most recently from b14e707 to f02d6cc Compare May 13, 2020 02:15
@3ach
Copy link
Collaborator Author

3ach commented May 26, 2020

I can't get the empty item bug to reproduce.

@cjmyers
Copy link
Collaborator

cjmyers commented May 26, 2020

Ok, will check this on mine. Is it ready for another test?

@3ach
Copy link
Collaborator Author

3ach commented May 26, 2020 via email

@cjmyers
Copy link
Collaborator

cjmyers commented May 27, 2020

I'm running into the same merge issue. How do I checkout without it wanting to merge, so I can test it?

@3ach
Copy link
Collaborator Author

3ach commented May 27, 2020 via email

@cjmyers
Copy link
Collaborator

cjmyers commented May 27, 2020 via email

@cjmyers
Copy link
Collaborator

cjmyers commented May 27, 2020

Looks like all is good except the confirmation that public is migrating (seems like it might be, since the other issue with sharing seems to work), and the empty objects created by migration.

@cjmyers
Copy link
Collaborator

cjmyers commented May 27, 2020

Doesn't this line in the migration stop public graphs from migrating:

  .filter(ownership => ownership.ownedBy !== graph)

@3ach
Copy link
Collaborator Author

3ach commented May 27, 2020

I'm not sure it's migrating. The public working just shows that it's checking ownedBy and no longer blocking shared access to public. I think the migration issue must have to do with spoofing.

@3ach
Copy link
Collaborator Author

3ach commented May 27, 2020

The graph in that case would be null since it's the public graph, so it would only remove ownedBys which point to a null user.

@cjmyers
Copy link
Collaborator

cjmyers commented May 27, 2020

I just realized another potential problem. You are using GetAllOwnedBy.sparql to get all the URIs that are owned by someone, but this could run into the 10k results limit. Don’t we need to loop this to get all the URIs?

I think this actually explains my non-migration of public. I have the iGEM dataset with much greater than 10k entries. This dataset has myself and James as owners. James is not a user on my system, so you skip migrating these entires. However, James is the owner of the first 10k entries returned. Therefore, it never gets to migrating my ownership for the public entries.

@cjmyers
Copy link
Collaborator

cjmyers commented May 27, 2020

I think I also have a hypothesis why the empty links are being created. I discovered yesterday that our removeCollection does not appear to completely clean out a collection. There appear to be triples being left behind. In my instance, there is a deleted Collection that was shared from a test user to me, and I expect that this is causing odd ownerships to be discovered on incomplete records.

To address this, I think we will need to see if we can refine the query to not pick these up. We might also want to create a migration scheme to remove these dangling entries. This would need to be done VERY carefully, of course. We also need to figure out while removeCollection is leaving remnants.

@cjmyers
Copy link
Collaborator

cjmyers commented May 27, 2020 via email

@3ach
Copy link
Collaborator Author

3ach commented May 27, 2020 via email

@cjmyers
Copy link
Collaborator

cjmyers commented May 27, 2020

Hmm, it would make sense to loop it in the sparql code when now LIMIT/OFFSET is provided, since otherwise, it ends up with these strange missing results issue. We do loop for things like fetch/delete/etc., but it may make sense to simply make this part of sparql.js. This probably should be done, since the maximum number of return entries is something we can change in virtuoso.ini, so we would have variable behavior if people change that otherwise.

@cjmyers
Copy link
Collaborator

cjmyers commented May 28, 2020

Looked into this problem more. The issue is that the new shared.js seems to assume only Collections can be shared. It is using getCollectionMetadata to get metadata instead of the query GetTopLevelMetadata.sparql used in the old version. This means that anything that is not a collection that is shared will not show any metadata.

The 2nd problem is that during migration, the ownedBy is migrated, but there is also a sbh:canView tag that is not considered. It appears in my example, the Collection has this tag while the Collection, its members, and their children have the ownedBy tag. The old shared page would only show the user those with the canView tag. From there, one could navigate to other pages. Namely, it shows a starting point of the share tree. We need something similar here that somehow indicates what is the top of the tree, so it can be displayed on the Shared With Me page, while other objects are accessible but do not need to be displayed on this page. Any thoughts on how to accomplish this one?

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

Successfully merging this pull request may close these issues.

2 participants