Understanding Content Security

In response to growing threats from viruses and worms, Microsoft launched a security initiative in early 2002, called Trustworthy Computing, to focus on making all its products safer to use. In an email sent to employees, Bill Gates summed up the seriousness of the initiative:

“In the past, we’ve made our software and services more compelling for users by adding new features and functionality, and by making our platform richly extensible. We’ve done a terrific job at that, but all those great features won’t matter unless customers trust our software. So now, when we face a choice between adding features and resolving security issues, we need to choose security. Our products should emphasize security right out of the box, and we must constantly refine and improve that security as threats evolve.”

Prior to Access 2003, it was quite possible for a malicious person to send you a database file that contained code that could damage your system. As soon as you opened the database, the harmful code would run—perhaps even without your knowledge. Alternatively, the programmer could embed dangerous code in a query, form, or report, and your computer would be damaged as soon as you opened that object. In version 11 (Access 2003), you were presented with a series of confusing dialog boxes when you opened an unsigned database file if you had left your macro security level set to Medium or High. After wading through the various dialog boxes, you could still be left with a database you were unable to open.

Access 2007 improved upon the security model by adding a component to the Access interface called the Trust Center. This security interface is far less confusing and intrusive than the Access 2003 macro security feature. With a security level set to High in Access 2003, you would not be able to open any database files because all Access databases could have some type of macros, Visual Basic for Applications (VBA) code, or calls to unsafe functions embedded in their structure. Access 2010 further improves upon the Access 2007 security model by adding Trusted Documents. Any database with queries is considered unsafe by Access 2010 because those queries could contain expressions calling unsafe functions. In Access 2010, each database file opens without presenting you with a series of dialog boxes as in Access 2003. Depending on where your file is located on the local computer drive or network share, Access silently disables any malicious macros or VBA code without any intrusive dialog box messages.

Note

The sample databases included on the companion CD are not digitally signed, because they will become unsigned as soon as you change any of the queries or sample code. We designed all the sample applications to open successfully, but each displays a warning dialog box if the database is not trusted. If you have installed the database in an untrusted location, the application displays instructions in the warning dialog box that you can follow to enable the full application. See Enabling Content by Defining Trusted Locations, for information about defining trusted locations.

When you open an existing database or template, you might see a Security Warning message displayed in the Message Bar, just below the Quick Access Toolbar and ribbon, as shown in Figure 2-24. This message notifies you that Access has disabled certain features of the application because the file is not digitally signed, the file is not a trusted document, or the file is located in a folder that has not been designated as trusted.

To ensure that any restricted code and macros function in this database, you must manually tell Access to enable this content by clicking the Enable Content button on the Message Bar. After you click this button, Access closes the database and then reopens the file to enable all content. Access does not display the Message Bar after it reopens the file, and all functions, code, and macros are now allowed to run in this specific database. Access also adds this database to its list of trusted documents.

If your database is not currently trusted, Access displays the Security Warning information on the Info tab of the Backstage view, as shown in Figure 2-25. Note that if you have enabled the content of the database you are viewing or if the file is located in a folder that has been designated as trusted, Access does not display the Security Warning information on the Info tab of the Backstage view.

When you click the Enable Content button under Security Warning, Access displays two options—Enable All Content and Advanced Options, as shown in Figure 2-26. When you click Enable All Content, Access adds this database to its list of trusted database files. Each time you open this database from this point on, Access does not disable the content for that database. Note that if you move this database to a different file location on your computer, Access disables the content again when you open the database.

Click Advanced Options under Enable Content, and Access opens a dialog box, called Microsoft Office Security Options, as shown in Figure 2-27. This dialog box warns you that this file’s content cannot be verified because a digital certificate was not found.

You can choose to have Access 2010 continue to block any harmful content by leaving the default option set to Help Protect Me From Unknown Content (Recommended). By having Access block any harmful content, you can be assured that no malicious code or macros can execute from this database. However, you also have to realize that because Access blocks all Microsoft Visual Basic code and any macros containing a potentially harmful command, it is quite possible that this application will not run correctly if you continue to let Access disable potentially harmful functions and code. To have Access discontinue blocking potentially harmful content, you must select the option Enable Content For This Session. After you select that option and click OK, Access closes the database and then reopens the file to enable all content. Access does not display the Message Bar after it reopens the file, and all functions, code, and macros are now allowed to run in this specific database.

You might have noticed a link to the Trust Center in the lower-left corner of the Microsoft Office Security Options dialog box. You can also open the Trust Center from the Info tab of the Backstage view by clicking the Trust Center Settings link beneath Security Warning, as discussed earlier. We will discuss the Access Options dialog box later in this chapter; see Modifying Global Settings via the Access Options Dialog Box.

Click Open The Trust Center in the Microsoft Office Security Options dialog box to view the advanced security settings. If the Security Warning on the Info tab of the Backstage view is not currently available, click the File tab and then click Options on the Backstage view. In the Access Options dialog box, click the Trust Center category on the left and then click Trust Center Settings. In the Trust Center dialog box, shown in Figure 2-28, you see nine categories of security settings.

Briefly, the categories are as follows:

You can permanently enable the content in a database that is not trusted by defining a folder on your hard drive or network that is trusted and then placing the database in that folder. Alternatively, you can define the folder where the database is located as trusted. You define trusted locations in the Trust Center dialog box.

To define a trusted location, click the File tab on the Backstage view and then click Access Options. In the Access Options dialog box, click the Trust Center category and then click Trust Center Settings. Access displays the Trust Center dialog box. Click the Trusted Locations category to see its options, as shown in Figure 2-29.

Click Add New Location. Access now displays the Microsoft Office Trusted Location dialog box, as shown in Figure 2-30.

Click Browse and locate the folder that you want to designate as trusted. You have the option of designating any subfolders in that directory as trusted without having to designate each individual folder within the hierarchy. Enter an optional description you want for this folder, and click OK to save your changes. The new location you just specified now appears in the list of trusted locations. Microsoft recommends you do not designate the root folder for your Windows installation (for example, C:\ on a standard installation) as a trusted location. You should instead designate only the individual folders you want trusted.

If you later decide to remove this folder as a trusted location, select that location, as shown in Figure 2-29, and then click Remove. Any Access databases in that folder are now treated as unsafe. Figure 2-29 also shows two check boxes at the bottom of the dialog box. The first check box allows you to define network locations as trusted locations. Microsoft recommends you not select this check box because you cannot control what files others might place in a network location. The second check box disables all Trusted Location settings and allows content only from trusted publishers.