Scan subversion files and data for virus

Can we scan the data in the subversion repository ?
This was a big doubt I had in my mind for quite a long time.

svnlook
helps us to verify our data. There are ways to verify the data is virus-free before commiting it to the subversion repo.
This can be done by making use of the pre-commit script.

cd PATH_TO_REPOS/hooks
cp pre-commit.tmpl pre-commit

Now we can edit the pre-commit script as needed, either to verify our data or any other purpose.

chmod u+x pre-commit # It needs to be executable

The pre-commit hook gives you an opportunity to catch the transaction just before it becomes a revision.

Here is a sample shell script where I’m making the transaction to sleep for some time.

#!/bin/sh
# PRE-COMMIT HOOK

REPOS=”$1″
TXN=”$2″

SVNLOOK=/home/prabhugs/csvn/bin/svnlook

$SVNLOOK changed -t “$TXN” “$REPOS” | grep xxx #checking for the box xxx and make it sleep for 30
if [ $? = 0 ]
then
sleep 30
fi

$SVNLOOK changed -t “$TXN” “$REPOS” | grep yyy #checking for the box yyy and make it sleep for 60
if [ $? = 0 ]
then
sleep 60
fi

exit 0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s