Security Deposit is legal in Canada as this is a guarantee to the landlord that they are able to recover some losses if anything in the house is being tampered with in the wrong way. Note that they are only able to collect 1/2 months rent as a security deposit and if 1 month is collected, it has to be under certain circumstances.
In a short term lease i.e., less than 1 month, they will still need to collect the deposit and return once you moved out and they have inspected the place. Note that there are some landlords that require you to return the house in the state that they hand it over to you on your first day so please make sure you clarify this with the landlord.