Securing Dataverse with an Adapted Command Design Pattern. Gustavo Durand, Michael Bar-Sinai, Merce Crosas SecDev - September 26, 2017

Similar documents
Dataverse: Modular Storage and Migration to the Cloud

The Open Monolith. Keeping Your Codebase (and Your Headaches) CON3449. Matthew sbgrid.

DATAVERSE FOR JOURNALS

Demos: DMP Assistant and Dataverse

Helping Journals to Upgrade Data Publications for Reusable Research

Dataverse and DataTags

Update on Dataverse Dryad-Dataverse Community Meeting. Mercè Crosas, Elizabeth Quigley & Eleni Castro. Data Science > IQSS > Harvard University

A Data Sharing System

Mercè Crosas, Ph.D. Chief Data Science and Technology Officer Institute for Quantitative Social Science (IQSS) Harvard

Science Panel Discussion presentation: "A Data Sharing Story"

DATA SHARING FOR BETTER SCIENCE

Fast Track to EJB 3.0 and the JPA Using JBoss

SHARING YOUR RESEARCH DATA VIA

CO Java EE 7: Back-End Server Application Development

Developing Applications with Java EE 6 on WebLogic Server 12c

EUDAT-B2FIND A FAIR and Interdisciplinary Discovery Portal for Research Data

Institutional Repository using DSpace. Yatrik Patel Scientist D (CS)

Meet. Brian Stansberry Principal Software Engineer, Red Hat, Inc. June 10, Friday, June 14, 13

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

DOIs for Research Data

Java EE 6: Develop Business Components with JMS & EJBs

RADAR. Establishing a generic Research Data Repository: RESEARCH DATA REPOSITORY. Dr. Angelina Kraft

OracleAS 10g R3: Java Programming

Seam 3. Pete Muir JBoss, a Division of Red Hat

Astronomy Dataverse: enabling astronomer data publishing.

Data publication and discovery with Globus

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Chapter 5 Object-Oriented Programming

The Materials Data Facility

Harvard s Dataverse Network:

AJDT: Getting started with Aspect-Oriented Programming in Eclipse

Persistent Identifier the data publishing perspective. Sünje Dallmeier-Tiessen, CERN 1

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

Welcome to the Pure International Conference. Jill Lindmeier HR, Brand and Event Manager Oct 31, 2018

Dataverse 4.0 & Beyond. Eleni Castro > Ins/tute for Quan/ta/ve Social Science (IQSS), Harvard University

Seam. Pete Muir JBoss, a Division of Red Hat.

Java EE 6: Develop Web Applications with JSF

SUN Sun Certified Enterprise Architect for J2EE 5. Download Full Version :

Java SE7 Fundamentals

Courses For Event Java Advanced Summer Training 2018

BPMN Processes for machine-actionable DMPs

Java EE 7 Recipes for Concurrency. Presented By: Josh Juneau Author and Application Developer

JVA-163. Enterprise JavaBeans

Java EE 6 - Update Harpreet Singh GlassFish Portfolio Product Manager

Java EE 7: Back-End Server Application Development

Cross-Platform Data Models and API Using grpc

Magento Technical Guidelines

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

1Z Oracle. Java Enterprise Edition 5 Enterprise Architect Certified Master

Improve and Expand JavaServer Faces Technology with JBoss Seam

EUDAT B2FIND A Cross-Discipline Metadata Service and Discovery Portal

Advanced Java Programming

Implementation of Open-World, Integrative, Transparent, Collaborative Research Data Platforms: the University of Things (UoT)

ENCAPSULATION. private, public, scope and visibility rules. packages and package level access.

CO Java EE 6: Develop Database Applications with JPA

Java Enterprise Edition

Liferay Architecture

EUDAT. A European Collaborative Data Infrastructure. Daan Broeder The Language Archive MPI for Psycholinguistics CLARIN, DASISH, EUDAT

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

Service Oriented Architectures Visions Concepts Reality

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Design Patterns Reid Holmes

SDC Design patterns GoF

open source community experience distilled

DataSTORRE Deposit Guide

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

Managing Data in the long term. 11 Feb 2016

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

SUN. Java Platform Enterprise Edition 6 Web Services Developer Certified Professional

Metadata Ingestion and Processinng

DESIGN PATTERN - INTERVIEW QUESTIONS

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP

Services to Make Sense of Data. Patricia Cruse, Executive Director, DataCite Council of Science Editors San Diego May 2017

Component-based Architecture Buy, don t build Fred Broks

Atelier Java - J2. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

Appendix A - Glossary(of OO software term s)

B2SAFE metadata management

Certification. F. Genova (thanks to I. Dillo and Hervé L Hours)

The Data Curation Profiles Toolkit: Interview Worksheet

09. Component-Level Design

Historization and Versioning of DDI-Lifecycle Metadata Objects

Integrating Legacy Assets Using J2EE Web Services

SEAD Data Services. Jim Best Practices in Data Infrastructure Workshop. Cooperative agreement #OCI

Module 8 The Java Persistence API

Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas

"Charting the Course... Mastering EJB 3.0 Applications. Course Summary

Introduction to Seam. Pete Muir. JBoss, a division of Red Hat

JSR-303 Bean Validation. Emmanuel Bernard Doer JBoss, a Division of Red Hat

Vision of J2EE. Why J2EE? Need for. J2EE Suite. J2EE Based Distributed Application Architecture Overview. Umair Javed 1

Data Citation and Scholarship

Web Application Development Using Spring, Hibernate and JPA

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition

OCP JavaEE 6 EJB Developer Study Notes

Web Application Development Using Spring, Hibernate and JPA

Orbis Cascade Alliance Content Creation & Dissemination Program Digital Collections Service. Enabling OAI & Mapping Fields in Digital Commons

Archive II. The archive. 26/May/15

The DOI Identifier. Drexel University. From the SelectedWorks of James Gross. James Gross, Drexel University. June 4, 2012

object/relational persistence What is persistence? 5

Oracle Exam 1z0-898 Java EE 6 Java Persistence API Developer Certified Expert Exam Version: 8.0 [ Total Questions: 33 ]

Oracle Fusion Middleware 11g: Build Applications with ADF I

Transcription:

Securing Dataverse with an Adapted Command Design Pattern Gustavo Durand, Michael Bar-Sinai, Merce Crosas SecDev - September 26, 2017

Introduction An application design that enforces permission-based policies Supports declarative syntax for stating Action X on object Y requires permissions P 1..P n With dynamic overrides when needed based on an adaptation of the classic Command Pattern

What we ll cover Dataverse Intro, Technology, Features, Background Adapting the Command Pattern The Pattern in Practice

Dataverse

Dataverse An open-source platform to publish, cite, and archive research data Built to support multiple types of data, users, and workflows Developed at Harvard s Institute for Quantitative Social Science (IQSS) since 2006 Development funded by IQSS and with grants, in collaboration with institutions around the world 15 on the core team - developers, designers, UI/UX, metadata specialists, curation manager

Dataverse Community 26 installations around the world

Dataverse Community 40+ code contributors outside of the Core Team Hundreds of members of the Dataverse Community - developers, researchers, librarians, data scientists Dataverse Google Group Dataverse Community Calls Dataverse Community Meeting

Dataverse Technology Glassfish Server 4.1 Java SE8 Java EE7 - Presentation: JSF (PrimeFaces), RESTful API - Business: EJB, Transactions, Asynchronous, Timers - Storage: JPA (Entities), Bean Validation Storage: Postgres, Solr, File System / Swift / S3 ~95K Lines of code

Dataverse Features - Data Persistent IDs / URLs DataCite / Handle Automatically Generated Citations with attribution Compliant with FAIR and data citation principles Domain-specific Metadata Versioning File Storage Local / Swift (OpenStack) / S3 (Amazon)

Dataverse Features - Users Multiple Sign In options Native Shibboleth OAuth (ORCID) Dataverses within Dataverses Branding Widgets

Dataverse Features - Workflows Permissions Access Controls and Terms of Use Publishing Workflows Private URLs Upload / Download Workflows Browser Dropbox Rsync (for big data packages )

Dataverse Features - Interoperability APIs SWORD Native Harvesting (OAI-PMH) Client Server

Dataverses and Datasets What is a Dataverse or Dataset? Image created by: Eleni Castro

Permissions / Roles Robust Permission System: System Roles Custom Roles (can be defined per installation) Groups Explicit IP Shibboleth Inheritance dataverse -> dataset dataset -> file

Adapting the Command Pattern

Adapting the Command Pattern Commands specify: o which permissions are required to execute them, o which model objects are involved o what is the context in which the command was submitted A central command execution engine that can verify that a command should indeed be executed prior to invoking it. Circumvents the need for sprinkling multiple permission checks at various places in the code

Adapting the Command Pattern This design ensures that: Users are only able to perform actions they have permissions to perform Developers must explicitly state which permissions are required to run each command To the extent that static permissions declaration is used, the permissions required to run each command are declaratively documented in the code

The Command Design Pattern Encapsulate a request as an object, thereby letting you parameterize other objects with different requests, queue or log requests, and support undoable operations. GoF, 1994 Thus enabling to use code as data

The Command Design Pattern Business logic implemented in Command Subclasses Code Reuse Controllers become thinner, mostly preparing commands from view/network request and submitting them to the CommandEngine for execution Security by Design Each command is annotated with requires permissions Permissions tested by the engine - single place, single implementation Auditing: Engine logs all executed commands Testable

Command, Adapted public interface Command<R> { R execute( CommandContext ctxt ) throws CommandException; Map<String,DvObject> getaffecteddvobjects(); Map<String,Set<Permission>> getrequiredpermissions(); DataverseRequest getrequest(); } execute() is where the work is done. Injected objects are made available via CommandContext getaffecteddvobjects() and getrequiredpermissions() detail which objects are affected and what permissions are needed to affect them getrequest() allows the permission system to detect which permissions the user has.

Sample Command: Delete a Role @RequiredPermissions( Permission.ManageDataversePermissions ) public class DeleteRoleCommand extends AbstractVoidCommand { private final DataverseRole doomed; public DeleteRoleCommand(DataverseRequest arequest, DataverseRole doomed ) { super(arequest, doomed.getowner()); this.doomed = doomed; } } @Override protected void executeimpl(commandcontext ctxt) throws CommandException { for ( RoleAssignment ra : ctxt.roles().roleassignments(doomed.getid()) ) { ctxt.roles().revoke(ra); } ctxt.roles().delete(doomed.getid()); }

Sample Command Usage: Delete a Role @DELETE @Path("{id}") public Response deleterole( @PathParam("id") Long id ) { DataverseRole role = rolessvc.find(id); if ( role == null ) { return notfound( "role with id " + id + " not found"); } else { try { execcommand( new DeleteRoleCommand(createDataverseRequest(findUserOrDie()), role)); return okresponse("role " + id + " deleted."); } catch (WrappedResponse ex) { return ex.refineresponse( "Cannot delete role " + id + "." ); } } }

Results of execcommad Executing a command has 4 possible results: Issued command makes no sense (e.g. delete published data) IllegalCommandException Wrapped in WrappedResponse: 403 FORBIDDEN Issuing user is not permitted to perform the command PermissionException Wrapped in WrappedResponse: 401 UNAUTHORIZED General Server Error CommandException Wrapped in WrappedResponse: 500 INTERNAL_SERVER_ERROR Plus, logging. Works Return the result of the command (Java object)

Command Composition Commands can be composed of other commands: @RequiredPermissions({}) public class GetLatestAccessibleDatasetVersionCommand extends AbstractCommand<DatasetVersion>{ private final Dataset ds;... @Override public DatasetVersion execute(commandcontext ctxt) throws CommandException { try { return ctxt.engine().submit(new GetDraftDatasetVersionCommand(getRequest(), ds)); } catch(permissionexception ex) {} return ctxt.engine().submit( new GetLatestPublishedDatasetVersionCommand(getRequest(),ds)); } } } /!\ Code cleaned for clarity

Dynamic Permissions Permissions can be defined at runtime: @RequiredPermissions({}) public class GetDatasetCommand extends AbstractCommand<Dataset>{... @Override public Map<String,Set <Permissions>> getrequiredpermissions(){({ if ( dataset.isreleased() ) { return Collections.emptySet(); } else { return Collections.singelton(Permission.ViewUnpublishedDataset)); } } } /!\ Code cleaned for clarity

The Pattern in Practice

The Pattern in Practice Used in Dataverse since 2015 o Largest effort was coding the engine and infrastructure o Provided to developers with a few basic examples o No discernible performance issues Discovered that we needed the ability to define the permissions at runtime

The Pattern in Practice - Benefits Benefits Straightforward to refactoring existing code o Basic commands are simple o Business logic already existed; just needed to be transferred Existing knowledge of annotations o Standard practice in Java Makes code maintenance easier

The Pattern in Practice - Challenges Challenges Motivating developers to use this pattern o In particular external developers Providing a good understanding of each of the different kinds of exceptions Ensuring proper use of command composition and dynamic permissions o In the beginning, wrote too many commands, instead of trying to find commonality

Thank you! Discussion / Comments / Questions? Securing Dataverse with an Adapted Command Design Pattern Gustavo Durand Michael Bar-Sinai Merce Crosas