This is what 2008 NEC has to say...
300.22 Wiring in Ducts, Plenums, and Other Air Handling Spaces. The provisions of this section apply to the installation and uses of
electrical wiring and equipment in ducts, plenums, and other
air-handling spaces
(A) Ducts for Dust, Loose Stock, or Vapor Removal. No wiring systems of any type shall be installed in ducts used to transport
dust, loose stock, or flammable vapors. No wiring system of any type
shall be installed in any duct, or shaft containing only such ducts,
used for vapor removal or for ventilation of commercial-type cooking
equipment.
(B) Ducts or Plenums Used for Environmental Air. Only wiring methods consisting of Type MI cable, Type MC cable employing a smooth
or corrugated impervious metal sheath without an overall nonmetallic
covering, electrical metallic tubing, flexible metallic tubing,
intermediate metal conduit, or rigid metal conduit without an overall
nonmetallic covering shall be installed in ducts or plenums
specifically fabricated to transport environmental air. Flexible metal
conduit shall be permitted, in lengths not to exceed 1.2 m (4 ft), to
connect physically adjustable equipment and devices permitted to be in
these ducts and plenum chambers. The connectors used with flexible
metal conduit shall effectively close any openings in the connection.
Equipment and devices shall be permitted within such ducts or plenum
chambers only if necessary for their direct action upon, or sensing
of, the contained air. Where equipment or devices are installed and
illumination is necessary to facilitate maintenance and repair,
enclosed gasketed-type luminaires shall be permitted.
(C) Other Space Used for Environmental Air. This section applies to space used for environmental air-handling purposes other than ducts
and plenums as specified in 300.22(A) and (B). It does not include
habitable rooms or areas of buildings, the prime purpose of which is
not air handling.
FPN: The space over a hung ceiling used for environmental air-handling purposes is an example of the type of other space to
which this section applies.
Exception: This section shall not apply to the joist or stud spaces of dwelling units where the wiring passes through such spaces
perpendicular to the long dimension of such spaces.
(1) Wiring Methods. The wiring methods for such other space shall be limited to totally enclosed, nonventilated, insulated busway having
no provisions for plug-in connections, Type MI cable, Type MC cable
without an overall nonmetallic covering, Type AC cable, or other
factory assembled multiconductor control or power cable that is
specifically listed for the use, or listed prefabricated cable
assemblies of metallic manufactured wiring systems without nonmetallic
sheath. Other types of cables, conductors, and raceways shall be
permitted to be installed in electrical metallic tubing, flexible
metallic tubing, intermediate metal conduit, rigid metal conduit
without an overall nonmetallic covering, flexible metal conduit, or,
where accessible, surface metal raceway or metal wireway with metal
covers or solid bottom metal cable tray with solid metal covers.
(2) Equipment. Electrical equipment with a metal enclosure, or with a nonmetallic enclosure listed for the use and having adequate
fire-resistant and low-smoke-producing characteristics, and associated
wiring material suitable for the ambient temperature shall be
permitted to be installed in such other space unless prohibited
elsewhere in this Code.
Exception: Integral fan systems shall be permitted where specifically identified for such use.
After reading subsection (C), it looks like nonmetallic cable is not allowed in ducts unless it's in conduit.
Equipment and devices shall be permitted within such ducts or plenum chambers only if necessary for their direct action upon, or sensing of, the contained air.
Which means you can't have equipment in the ducts that is not part of the HVAC system itself. So a junction box for a light, would not be allowed (unless the light is inside the duct for maintenance purposes).
If your local government follows National Electrical Code (NEC), then you should not install a junction box for the light in the duct. If you don't follow NEC, it's still probably a bad idea. The boxes and cable are a good place for dust, dirt, and debris to collect. And the cables and equipment could be damaged during duct cleaning.