From: Jihoon Chung Date: Thu, 25 Apr 2013 07:43:06 +0000 (+0900) Subject: Implement distinguish security model version X-Git-Tag: submit/tizen_2.2/20130927.091100^2~110 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=984d51fa11d32bb5b5946ffc9ed12f169ef19b92;p=platform%2Fframework%2Fweb%2Fwrt-commons.git Implement distinguish security model version [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] After enable CSP and allow-navigation, WRT should distinguish security model. This needs to avoid conflict between each security model. V1 : only handled by WARP v2 : main resource - allow-navigation sub resource - CSP [SCMRequest] N/A Change-Id: I2c7477d114828085067098df0836227f0e642338 --- diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index 726267e..53a340b 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -409,6 +409,8 @@ DbWidgetHandle WidgetDAO::registerWidgetInfo( row.Set_back_supported(widgetConfigurationInfo.backSupported); row.Set_access_network(widgetConfigurationInfo.accessNetwork); row.Set_pkg_type(regInfo.packagingType.pkgType); + row.Set_security_model_version( + static_cast(widgetConfigurationInfo.securityModelVersion)); Try { diff --git a/modules/widget_dao/dao/widget_dao_read_only.cpp b/modules/widget_dao/dao/widget_dao_read_only.cpp index 1308357..194c1ac 100644 --- a/modules/widget_dao/dao/widget_dao_read_only.cpp +++ b/modules/widget_dao/dao/widget_dao_read_only.cpp @@ -1257,6 +1257,13 @@ PrivilegeList WidgetDAOReadOnly::getWidgetPrivilege() const SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get PrivilegeList") } +WidgetSecurityModelVersion WidgetDAOReadOnly::getSecurityModelVersion() const +{ + WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle); + DPL::OptionalInt result = row.Get_security_model_version(); + return static_cast(*result); +} + #undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN #undef SQL_CONNECTION_EXCEPTION_HANDLER_END #undef CHECK_WIDGET_EXISTENCE diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h index 7f876d2..3c3c943 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h @@ -382,5 +382,11 @@ struct WidgetAppControl }; typedef std::list WidgetAppControlList; + +enum class WidgetSecurityModelVersion +{ + WIDGET_SECURITY_MODEL_V1 = 0, // WARP + WIDGET_SECURITY_MODEL_V2 // CSP, allow-navigation +}; } // namespace WrtDB #endif /* WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_ */ diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h index 9447805..d8336c8 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h @@ -253,6 +253,11 @@ class ConfigParserData }; typedef std::list AllowNavigationInfoList; + enum class SecurityModelVersion { + SECURITY_MODEL_V1 = 0, // WARP + SECURITY_MODEL_V2 // CSP, allow-navigation + }; + LiveboxList m_livebox; StringsList nameSpaces; @@ -319,13 +324,16 @@ class ConfigParserData CategoryList categoryList; // For Account AccountProvider accountProvider; + // security model version + SecurityModelVersion securityModelVersion; ConfigParserData() : flashNeeded(false), minVersionRequired(), backSupported(false), accessNetwork(false), - startFileEncountered(false) + startFileEncountered(false), + securityModelVersion(SecurityModelVersion::SECURITY_MODEL_V1) {} }; } // namespace WrtDB diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h index 0d2e326..1ae5364 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h @@ -821,6 +821,8 @@ class WidgetDAOReadOnly */ TizenPkgId getTizenPkgId() const; PrivilegeList getWidgetPrivilege() const; + WidgetSecurityModelVersion getSecurityModelVersion() const; + }; } // namespace WrtDB diff --git a/modules/widget_dao/orm/wrt_db b/modules/widget_dao/orm/wrt_db index 40360ac..607ec23 100644 --- a/modules/widget_dao/orm/wrt_db +++ b/modules/widget_dao/orm/wrt_db @@ -19,30 +19,31 @@ SQL( ) CREATE_TABLE(WidgetInfo) - COLUMN_NOT_NULL(app_id, INTEGER, PRIMARY KEY AUTOINCREMENT) - COLUMN(widget_type, INT, DEFAULT 1) - COLUMN(widget_id, TEXT, DEFAULT '') - COLUMN(widget_version, TEXT, DEFAULT '') - COLUMN(widget_width, INT, DEFAULT 0) - COLUMN(widget_height, INT, DEFAULT 0) - COLUMN(author_name, TEXT, DEFAULT '') - COLUMN(author_email, TEXT, DEFAULT '') - COLUMN(author_href, TEXT, DEFAULT '') - COLUMN(base_folder, TEXT, DEFAULT '') - COLUMN(webkit_plugins_required, TINYINT, DEFAULT 0) - COLUMN(security_domain, INT, DEFAULT 0) - COLUMN(csp_policy, TEXT, DEFAULT '') - COLUMN(csp_policy_report_only, TEXT, DEFAULT '') - COLUMN(recognized, INT, DEFAULT 0) - COLUMN(wac_signed, INT, DEFAULT 0) - COLUMN(distributor_signed, INT, DEFAULT 0) - COLUMN(min_version, TEXT, DEFAULT '1.0') - COLUMN_NOT_NULL(back_supported, TINYINT, DEFAULT 0) - COLUMN(access_network, TINYINT, DEFAULT 0) - COLUMN(defaultlocale, TEXT, DEFAULT 0) - COLUMN_NOT_NULL(tizen_pkgid, TEXT, DEFAULT '') - COLUMN_NOT_NULL(tizen_appid, TEXT, DEFAULT 0 UNIQUE) - COLUMN(pkg_type, INT, DEFAULT 0) + COLUMN_NOT_NULL(app_id, INTEGER, PRIMARY KEY AUTOINCREMENT) + COLUMN(widget_type, INT, DEFAULT 1) + COLUMN(widget_id, TEXT, DEFAULT '') + COLUMN(widget_version, TEXT, DEFAULT '') + COLUMN(widget_width, INT, DEFAULT 0) + COLUMN(widget_height, INT, DEFAULT 0) + COLUMN(author_name, TEXT, DEFAULT '') + COLUMN(author_email, TEXT, DEFAULT '') + COLUMN(author_href, TEXT, DEFAULT '') + COLUMN(base_folder, TEXT, DEFAULT '') + COLUMN(webkit_plugins_required, TINYINT, DEFAULT 0) + COLUMN(security_domain, INT, DEFAULT 0) + COLUMN(csp_policy, TEXT, DEFAULT '') + COLUMN(csp_policy_report_only, TEXT, DEFAULT '') + COLUMN(recognized, INT, DEFAULT 0) + COLUMN(wac_signed, INT, DEFAULT 0) + COLUMN(distributor_signed, INT, DEFAULT 0) + COLUMN(min_version, TEXT, DEFAULT '1.0') + COLUMN_NOT_NULL(back_supported, TINYINT, DEFAULT 0) + COLUMN(access_network, TINYINT, DEFAULT 0) + COLUMN(defaultlocale, TEXT, DEFAULT 0) + COLUMN_NOT_NULL(tizen_pkgid, TEXT, DEFAULT '') + COLUMN_NOT_NULL(tizen_appid, TEXT, DEFAULT 0 UNIQUE) + COLUMN(pkg_type, INT, DEFAULT 0) + COLUMN(security_model_version, INT, DEFAULT 0) CREATE_TABLE_END() SQL(