When you create any system, you must test it. For example, if you build a server, you hire a penetration tester (essentially a ethical hacker) to evaluate it. The tester uses their knowledge of the system's vulnerabilities to try to exploit them and then reports back on the findings.
If you've chosen a reputable tester, it's unlikely, but there's always a chance they could explore your system, decide "this system sucks," and turn against you. Instead of helping, they might use their knowledge in an attempt to destroy it.
This is analogous to what Lucifer was. Lucifer's role was to serve as the tester of the system—specifically, the tester of humanity. What we now call Satan is the "fallen" version of Lucifer, but before his fall, he performed this function on behalf of God. There aren't many stories about Lucifer before the fall, but one appears in the Old Testament's Book of Job, where he asks God for permission on what he can and cannot do to test Job. He was still subservient to God, working on his behalf. As the tester, Lucifer knew the vulnerabilities of humans, since that was his purpose.