let's say a friendly aircraft were to fly in front of you when you had sight lock turned on; would the missile fire at the friendly aircraft, or is there a piece of technology in the friendly aircraft which registers that it's with you?
There is indeed an important piece of technology which "registers that with you". The piece of technology is called an IFF, which stands for Identification Friend of Foe. Read more about the IFF here.
would the missile fire at the friendly aircraft implies the missile is making the decision to fire autonomously, but this was not the case in the F-16 as recently as 10 years ago. Most US fighter aircraft (and probably fighter aircraft of other countries) give a great deal of control of the missile to the pilot. The idea behind this is autonomous systems sometimes behave in unintended ways, and a missile shot is just too important not to be directly controlled by the pilot during at least the initial phases, such as during the decision to fire.
After the decision to fire is made and the missile leaves the firing aircraft, there are autonomous systems which eventually take over (sometimes immediately). However, the sky is large, and planes are small. The likelihood that a friendly aircraft would accidentally become the new target after an enemy was originally targeted is very low. Sometimes concern for such as missile lock transfer is a consideration for close-range shots. However, the vast majority of missile shots in a modern air battle engagement occur in situations where the aircraft are separated by large distances. So let's talk about those shots occurring far away, called BVR shots, or Beyond Visual Range missile shots. Read more about BVR here.
The decision to employ a missile by shooting beyond visual range is analogous to the decision of a jury to convict someone in court - except the decision is made by perhaps one or two people (pilot and/or weapons officer) in just a few seconds using some rules of engagement. The court analogy works because the decision really is a judgement call, and there are many pieces of evidence to weigh in the decision.
Technology is a pilot's best friend when making this decision. IFF is probably considered the golden standard for shooting a hostile aircraft, however not all fighters have IFF interrogation capability on board. Even fighters with IFF interrogation capability may rely on other information as well. Is the firing aircraft on one side of a border or demarcation line / political state border while the potentially hostile aircraft is on the other line, perhaps inside another nation's borders? So location can help. However, during a fight where aircraft are mixed together, location becomes less helpful. There are other technological means for determining that an aircraft is hostile, but virtually all of those means are US state secrets and therefore cannot be discussed on StackExchange (unfortunately). Let's focus on IFF since IFF is the most useful tool, and the basic functionality of IFF is not a secret.
Every friendly aircraft is programmed before flight with a secret cryptographic code prior to takeoff. The pilot is not involved in this programming. Instead, someone from the maintenance unit goes around to all the aircraft perhaps an hour or two prior to takeoff and loads the secret code into the jet's IFF computer system. When the pilot shows up, the IFF code is set and ready to go. Part of the pre-flight check in a fighter aircraft is to check the IFF to make sure the code is loaded properly. If that sounds cool, it's because it is cool. Civilian pilots don't have a step in their pre-flight checklist to make sure a cryptographic key is loaded correctly to prevent them from getting shot down.
The cryptographic system involving the IFF is analogous to a digital certificate used in internet communication. How do you know if Amazon.com is really Amazon.com and not some spoof? How do you know you are actually talking with your bank online and not some impostor? Your browser uses cryptography to interrogate the server at Amazon.com, and if Amazon didn't use a valid key to encrypt its messages, then your browser will tell you it can't verify Amazon is authentic. There are two parts to this system: the interrogator and the responder. The responder in the IFF system is called a Transponder in the civilian world, because it "transmits" a "response". The military just calls it an IFF because the military loves acronyms. As mentioned before, not all fighter aicraft have IFF interogators. However, every aircraft in the battle space has an IFF responder.
could that potentially be used against you in modern day aerial warfare?
Could defeating the IFF system be used against you? If I had knowledge of such a thing occurring, then I certainly could not discuss it here. I will respond to this hypothetical question with a question: Could attacking and exploiting any cryptographic security system cause problems for the users who depend upon that system to make decisions? I'll leave that up to your imagination.
This abstract discussion of some of the technology behind modern rules of engagement for fighter aircraft can be dry. So I'll end my answer with a photo of the button an F-16 pilot pushes to fire the missile (it's not the trigger - the trigger fires the gun). Maybe off topic, but there is research indicating people remember better when learning with pictures.