Drupal Minimum elementen voor een module Een eerste module Een eerste theme Theming binnen modules



Vergelijkbare documenten
Het beheren van mijn Tungsten Network Portal account NL 1 Manage my Tungsten Network Portal account EN 14

Settings for the C100BRS4 MAC Address Spoofing with cable Internet.

General info on using shopping carts with Ingenico epayments

Leeftijdcheck (NL) Age Check (EN)

Icoon/Icon Betekenis Description. Change scheduling Online. Gaat offline op (datum/tijd) Online. Going offline on (date/time)

Zo kan je linken maken tussen je verschillende groepen van gegevens.

beginnen met bloggen (kleine workshop Wordpress)

2019 SUNEXCHANGE USER GUIDE LAST UPDATED

Activant Prophet 21. Prophet 21 Version 12.0 Upgrade Information

MyDHL+ ProView activeren in MyDHL+

Web Application Security Hacking Your Way In! Peter Schuler & Julien Rentrop

DRUPAL Dev Training, dag 1. Introductie

CBSOData Documentation

MyDHL+ Uw accountnummer(s) delen

Firewall van de Speedtouch 789wl volledig uitschakelen?

Shipment Centre EU Quick Print Client handleiding [NL]

EM6250 Firmware update V030507

[BP-ebMS-H-000] Welke versie van Hermes moet er gebruikt worden?

EM7680 Firmware Update by OTA

Drupal theming. 28 april CVO Crescendo

Chapter 4 Understanding Families. In this chapter, you will learn

Procedure Reset tv-toestellen:

1. Drupal 8 installatie uittesten op Symplytest.me

L.Net s88sd16-n aansluitingen en programmering.

Handleiding Zuludesk Parent

MyDHL+ Van Non-Corporate naar Corporate

Drupal 7 tip: voeg overal contextual links toe Gepubliceerd op Dominique De Cooman (

open standaard hypertext markup language internetprotocol transmission control protocol internet relay chat office open xml

B1 Woordkennis: Spelling

LDAP Server on Yeastar MyPBX & tiptel 31xx/32xx series

Introductie in flowcharts

Y.S. Lubbers en W. Witvoet

MyDHL+ Tarief berekenen

Webapplication Security

L.Net s88sd16-n aansluitingen en programmering.

What is the advantage of using expression language instead of JSP scriptlets and JSP expressions?

FOD VOLKSGEZONDHEID, VEILIGHEID VAN DE VOEDSELKETEN EN LEEFMILIEU 25/2/2016. Biocide CLOSED CIRCUIT

Netwerkprinter Dell 1320C installeren op Ubuntu LTS - Lucid Lynx

Sophie van Solinge CMS32

EM7580 Firmware Update by Micro SD card

/ /

Als u dit dan probeert te doen dan zal hij zeggen dat de versie van Silverlight al geïnstalleerd is.

1. Voor het installeren wordt geadviseerd een backup te maken van uw database en bestanden.

CBSOData Documentation

Je website (nog beter) beveiligen met HTTP-Security Headers

TOEGANG VOOR NL / ENTRANCE FOR DUTCH : lator=c&camp=24759

bla bla Guard Gebruikershandleiding

RECEPTEERKUNDE: PRODUCTZORG EN BEREIDING VAN GENEESMIDDELEN (DUTCH EDITION) FROM BOHN STAFLEU VAN LOGHUM

150 ECG-problemen (Dutch Edition)

Find Neighbor Polygons in a Layer

Lichtgewicht CSS design voor Drupal 6

Website beoordeling facebook.com

Registratie- en activeringsproces voor de Factuurstatus Service NL 1 Registration and activation process for the Invoice Status Service EN 10

ETS 4.1 Beveiliging & ETS app concept

Oracle client 1.2 voor ixperion 1.3 en hoger

Telenet Hotspot: login flow. Baalse Hei

Voorbeelden van Drupal websites

Website beoordeling feedbackvote.com

Handleiding Installatie ADS

Blackboard Toetsvragen maken in Word

AVG / GDPR -Algemene verordening gegevensbescherming -General data Protection Regulation

Veel gestelde vragen nieuwe webloginpagina

Calculator spelling. Assignment

Luister alsjeblieft naar een opname als je de vragen beantwoordt of speel de stukken zelf!

Interaction Design for the Semantic Web

EM7680 Firmware Update by Micro SD card or USB

Website review kamernet.nl

OUTDOOR HD BULLET IP CAMERA PRODUCT MANUAL

Wij beloven je te motiveren en verbinden met andere studenten op de fiets, om zo leuk en veilig te fietsen. Benoit Dubois

EM7680 Firmware Update by Micro SD card

WEBSECURITY INFORMATICA STUDENTENWERKING. Gemaakt door Bryan De Houwer en Yuri Moens

Joomla! vs Facebook (en andere Social Media)

Intermax backup exclusion files

Handleiding Meldportaal Ongebruikelijke Transacties - pg 2. Manual for uploading Unusual Transactions - Reporting Portal - pg 14

Datamodelleren en databases 2011

ContentSearch. Deep dive

EM7680 Firmware Auto-Update for Kodi 17.2

Installatie instructies

Vrijgeven van volledige gedetailleerde technische cookies

Zo werkt het in de apotheek (Basiswerk AG) (Dutch Edition)

Understanding and being understood begins with speaking Dutch

Ius Commune Training Programme Amsterdam Masterclass 15 June 2018

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE. Toets Inleiding Kansrekening 1 8 februari 2010

How to install and use dictionaries on the ICARUS Illumina HD (E652BK)

CENTEXBEL CLIENTS WEB

The first line of the input contains an integer $t \in \mathbb{n}$. This is followed by $t$ lines of text. This text consists of:

Van 'gastarbeider' tot 'Nederlander' Prins, Karin Simone

Workshop Joomla nivo 1 op 14 november 2015.doc

Cambridge Assessment International Education Cambridge International General Certificate of Secondary Education. Published

Object Oriented Programming

De originele blogpost kunt u lezen op is-een-van-de-grootste-wordpress-updates-ooit/

Hunter-CRM. Documentatie Handleiding Spamfilter

MARTINA. Wist je dat..? Truckjes en weetjes in Drupal Artikels, lengte en aantal op frontpagina (en welkomtekst zonder lees meer )

Registratie- en activeringsproces voor de Factuurstatus Service NL 1 Registration and activation process for the Invoice Status Service EN 11

Profile visitors NRC Q

Appendix A: List of variables with corresponding questionnaire items (in English) used in chapter 2

Hoe met Windows 8 te verbinden met NDI Remote Office (NDIRO) How to connect With Windows 8 to NDI Remote Office (NDIRO

Multi user Setup. Firebird database op een windows (server)

Transcriptie:

Basiscursus door Michaël Zenner Drupal Minimum elementen voor een module Een eerste module Een eerste theme Theming binnen modules Hooks Menusystem Users, nodes en comments Form API 1

2

Core Modules HOOKS Themes Nodes Blocks De core (kern) is de verzameling van modules, templates en databankschema's die standaard deel uitmaakt van Drupal. Je vindt de coremodules via Beheren Site constructie > Modules (http://www.example.com/admin/build/modu les). 3

Een module is een toepassing binnen een Drupalwebsite die bepaalde functionaliteiten biedt. Vb: Zoeken, blogs, forums, gebruikersbeheer, statistieken, meertaligheid, Google Analytics: het zijn allemaal modules die je aan of uit kunt zetten in je website. Een module bestaat uit één of meerdere PHP bestanden soms aangevuld met CSS stijlbladen. Hooks mag je zien als een manier om in te haken op een Drupal actie. Vb: Een user meld zich aan op de site; dan start drupal de hook_user Om op dit moment iets uit te voeren zal je in je module de functie: examplemodule_user() user() gebruiken Je zal dus de placeholder hook vervangen door de modulenaam: examplemodule_user 4

Een template is een verzameling PHP, CSS bestanden en afbeeldingen die samen het ontwerp van je website bepalen. De Nederlandse vertaling van het woord template is enigzins verwarrend omdat een template in de Engelstalige documentatie theme heet vandaar ik doorheen de opleiding ook van theme zal spreken. Een node (Engels voor knoop) is een inhoudselement van je website. bit Een pagina, een nieuwsartikel, een blogpost, een forumbericht of een recept: in een Drupalwebsite zijn het allemaal nodes. Een node bestaat minimaal uit een titel en een stuk tekst (de body) en is identificeerbaar door een uniek nummer. > > NID (node id) Elke node in het systeem kun je bekijken aan de hand van zijn id (via de url http://www.example.com/node/1234). 5

Een blok (in het Engels block) ) is een navigatie of inhoudselement dat in een regio van de template getoond kan worden. Je kiest zelf of en in welke regio een blok zichtbaar is. Alle menu's van je website zijn blokken. De meeste modules bevatten ook blokken, we zullen in een eerste modulevoorbeeld een block maken. Bestanden 6

Includes Misc Modules Profiles Scripts Sites Themes Index.php > The PHP page that serves all page requests on a Drupal installation. In de folders /sites/all; / ;/sites/default;/ /sites/sitenaam plaats je contributed modules en themes. Folders zelf te maken: contrib,contrib_patched, custom Settings.php (copy van default.settings.php) Files 7

Modulenaam.info ; $Id$ name = "Page example" description = "Een voorbeeld van menu hook" core = 6.x package = Opleiding Modulenaam.module Bevat de phpcode van die module 8

Versions 4.6 6 hook_block($op = 'list', $delta = 0, $edit = array()) Hiermee declareer je blocks binnen je module http://api.drupal.org/api/function/hook_block /6 9

hook_menu() _ () Definitie van een menuitem en de pagina callbacks. 10

Themenaam.info Page.tpl.php Node.tpl.php Block.tpl.php Styles en javascript Custom tpl s tplsvb node onsnieuws.tpl.phponsnieuws php 11

hook_theme($existing, $type, $theme, _ ( g, yp,, $path) Registreer een module s theme implementatie 12

Swentel & mzenner Original presentation: Neil Drumm, Matt Cheney, Ezra Gildesgame, Greg Knaddison write secure code eat your vegetables floss daily 13

be afraid 14

drupal core is really good with security. drupal contrib is hit or miss. not fully policed. custom code is often the worst. an important difference: http versus https http data can be read by anyone (this includes cookie data) to be secure: 1. SSL Certificate http://drupal.org/project/securepages http://drupal.org/project/securepages_prevent_hijack 15

Take actions on your behalf without you knowing. Probe entire network. Pwn your site Pwn other sites used by visitors to your site In short: pwn the world. (scared enough yet?) do not: drupal _ set_ message("surprise ". $tainted); do: drupal_set_message(t("surprise @s", array('@s' => $tainted))); @ - filtered % - filtered with emphasis! - no filter, use for image tags or other pre-filtered data 16

do not: print '<a href="'. $tainted. '">'. $more_ unsafe. '</a>'; do: print l($more_unsafe, $tainted); It's the lowercase letter L. Filters text Filters URLs for "safe" protocols drupal_set_title($tainted, CHECK_PLAIN); o in D7.x only Form select options Not automatically filtered drupal_set_message Form checkbox & radio options watchdog (depends on use) and more (do your research) 17

do: check_plain Taxonomy terms, content types For content that should not contain HTML Turns & into & do: check_markup($data, $filter) Node/comment bodies, profile text fields, etc. i.e. contain markup But...admins can mess up the filters :( do: filter_xss_admin($data) Site mission, messages from admin settings Contain markup, providing an input selector is overkill Lets through lots of stuff... Try to insert some javascript alerts in your forms.. 18

node_access() http://api.drupal.org/api/function/node_access/6 user_access() http://api.drupal.org/api/function/user_access/6 19

Understand hook_menu access control. Like we seen in the example -> page_example_perm 'access arguments' => array('access foo'), db_rewrite_sql() db_rewrite_sql() provides a method for modules to extend your SQL queries. For example, a module which controls access to nodes will need to limit the results of your queries, removing any nodes for which a visitor does not have the required set of access permissions. If you do not make use of db_rewrite_sql(), access control modules won't be able to modify or extend your SQL queries, and you may inadvertently expose content that is meant to be restricted. It's good practice to always make use of db_rewrite_sql(). 20

Be sure to test. function my_form_submit($form, &$form_state) { if (!user_ access('administer foo')) { // Deny them access. drupal_access_denied(); } $stuff = $form['la']['dee']['dah']; db_query("delete from {bar} WHERE baz = %s", $stuff); } 21

function my_form_submit($form, &$form_state) { if (!user_ access('administer foo')) { // Deny them access. drupal_access_denied(); } $stuff = $form['la']['dee']['dah']; db_query("delete from {bar} WHERE baz = %s", $stuff); } User Impersonation 22

global $user; $user->uid =... nor global $user; $user = user_load(1); global $user; $temp_user = $user; session_save_session(false); $user = user_load(1); // Action here. $user = $temp_user; session_save_session(true); 23

$account = user_load(1); What I prefer the easy way Do Email security@drupal.org Be responsive Do not Tell others about the issue Commit security fixes Try to make a release Post an issue on Drupal.org 24

Basic premise: Everything may enter the database, it is YOU who decides what goes to the screen. SQL attacks: db_query: variable placeholders Node access: db_rewrite_sql Forms: no direct post confirmation forms instead of direct links (csrf) -> Cross site request forgery, also known as a one click attack or session riding and abbreviated as CSRF Returning output: check_ markup vs check_plain vs filter_xss vs filter_xss_admin Beware of $_POST : not sanitized from FAPI (eg: selections, hidden, values) Validation always done server side, do not rely on javascript alone 25

CCK: try to use $content from cck Implement cck formatters Template: cck direct use: $value >field['safe'] instead of $value >field['value'] Template: cck: content_format(); Other: check_markup vs check_plain vs filter_xss vs filter_xss_admin Setup sane defaults Do not set FULL HTML Setup sane defaults: Do not set FULL HTML as default (unless you want sweet spanking) User better formats module to set defaults per role 26

Tools: burp (spider between request & browser) XSS attacks CSRF attacks Documentation: Writing secure code http://drupal.org/writing-secure-code p g Hardening APIs UI improvements Education 27

http://drupal.org/security/secure-configuration http://drupal.org/writing-secure-code p g http://drupal.org/security-team http://groups.drupal.org/security-scanner-component-andbest-practices http://www.owasp.org http://crackingdrupal.com 28