What terms permit.
WHY IT MATTERS
Using code without complying with its licence creates legal exposure.
WHAT PERMISSIVE LICENCES ALLOW
Use, modification and distribution, with few obligations, usually requiring attribution and retention of the notice.
WHAT COPYLEFT LICENCES REQUIRE
That derived work is distributed under the same terms.
WHY THAT MATTERS COMMERCIALLY
It can require publishing your own source, depending on how the code is used and distributed.
WHAT VARIES
Whether the obligation applies only when distributing, or also when providing a service.
WHAT TO ESTABLISH FOR EVERY DEPENDENCY
Its licence, and what it requires of you.
WHAT TO AUTOMATE
Scanning dependencies for licences.
WHAT TO MAINTAIN
A record of what you use and under what terms.
WHAT TO DO FOR YOUR OWN PROJECT
Choose a licence deliberately, and include it.
WHY
Code published without one grants no rights, so nobody may legally use it.
WHAT TO BE CAREFUL WITH
Copying code found online with no stated licence.
IMPORTANT NOTE
This is general information, not legal advice. Take advice on anything material.