Monday, August 16, 2010
Hacking Security Considerations by Vatsal patel
Security Considerations
Probably the most overlooked aspect of database design is security, when it should be a
major consideration. By not securing your database and thereby your data, you are asking
for trouble. Not all data is intended for everyone’s eyes, and not everyone should have the
ability to manipulate your data and definitely not your database’s structure. The majority of
your database users will only need and should only be granted read (or select) access. When
designing your database, you should establish a list of policies and users for your database.
A database user is anyone who needs access to any part of your database. The highest level
of user is the database administrator who will have access to all database objects and data.
Other users will only have access to certain objects and data. The average end user will only
have access to certain objects, but should never have the ability to alter your database
structure. It never ceases to amaze us how many organizations have one “global” user that
has complete control of the database. This is typically a bad scenario, not because people
are intentionally malicious, but because they are people and no one is perfect. The impact
of a simple mistake can take hours and even days to reverse, if reversal is possible at all.
Policies are basically rules that define which actions a user can perform on your database.
Most RDMSs enable you to assign a separate set of policies, or rights, for each object in your
database. User rights generally fall into one of six different categories:
SELECT enables the user to view data.
INSERT enables the user to create new data.
UPDATE enables the user to modify existing data.
DELETE enables the user to delete data.
EXECUTE enables the user to execute a stored procedure.
ALTER enables the user to alter database structure.
REVIEW
In order to have a truly active Web site, you need to have some sort of data store from
which to retrieve personalized information. In most cases, this “data store” is a relational
database management system (RDBMS) such as SQL Server, Oracle, or Microsoft Access. A
database can consist of many types of objects such as tables and constraints. Designing the
structure of your tables (and other objects) and their interactions is just as much art as it is
science. However, the database normalization rules provide good guidelines to help you
along your way.
QUIZ YOURSELF
1. What is the importance of the primary key in table design? (See “Designing
a Database.”)
2. What is the difference between a primary key and a foreign key? (See “Designing
a Database.”)
3. What is the purpose of normalization? (See “Normalization of Data.”)
Creating a Database
The first step in building a database with SQL Server is to actually create the database. That’s
right. SQL Server is a piece of software that runs on a computer, or server. Once the SQL Server
software is installed you can create a database (or databases) with the SQL Server software
that is then managed by that SQL Server software. Many people refer to SQL Server as a
database, which it is, sort of. SQL Server is actually an application, a Relational Database
Management System (RDBMS), which can contain multiple databases.
We will be using SQL Server 7.0 to create the database in this session. If you
are using SQL Server 2000, the steps will be slightly different.
OK, let’s create the Music database. You’ll start by creating the database using Enterprise
Manager and perform the following steps:
1. Expand the SQL Server Group item, if it isn’t already expanded, in the Enterprise
Manager tree. Once expanded you should see a list of SQL Servers that are registered
with Enterprise Manager.
2. Right-click the SQL Server in which you want to create the Music database.
3. Select New➪Database. Figure 4-1 illustrates steps 1, 2, and 3.
4. You see the Database Properties dialog box, shown in Figure 4-1. On the General
tab, enter Music in the Name field. The Database Properties dialog box allows you
to control other features of your database such as file growth, maximum database
size, transaction log files, and so on. For the sake of brevity, accept the defaults.
Figure 4-1 Specifying database properties with Enterprise Manager
That’s it. You have created a SQL Server database using Enterprise Manager. If you want
to create
1. Select Start➪Programs➪Microsoft SQL Server➪Query Analyzer to open SQL
Server’s Query Analyzer.
2. You see the Connect to SQL Server dialog box. Select the SQL Server on which you
would like to create the Music database from the SQL Server drop-down box. Select
the Use SQL Server authentication radio button. Now enter the appropriate authentication
information in the Login Name and Password fields as shown in Figure 4-2.
3. In the Query Analyzer window, enter the following T-SQL statement:
USE master
GO
CREATE DATABASE Music ON PRIMARY
( NAME = MusicData,
FILENAME = ‘C:\MSSQL7\data\MusicData.mdf’
)
In the previous script, you may need to alter the FILENAME string so that it
reflects a valid path on your computer.
In step 3, you essentially created a database named Music and specified that the data
should be stored in the MusicData.mdf file located, in this example, in the C:\MSSQL7\data
directory. The CREATE DATABASE statement accepts many other parameters, such as
MAXSIZE, FILEGROWTH, SIZE, and so on. However, again, for the sake of brevity, you used
the SQL Server defaults.
Once you have entered the previous SQL statement in the Query Analyzer
window, hit the F5 button, which will execute the SQL script.
Note
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment