In this paper, the secure communication model is considered in cognitive relay network. An intelligent reflecting surface (IRS) which is deployed on unmanned aerial vehicle (UAV) is applied to cognitive relay of communication link between secondary internet of things (SIoT) devices and secondary user (SU). However, the presence of secondary eavesdropper (SE) causes security issue for cognitive communication network. Therefore, the problem of average secrecy rate maximization is formulated through the joint design of UAV trajectory, SIoT signal transmission power and IRS passive beamforming without affecting the communication quality among primary users (PUs). Nevertheless, it is infeasible to obtain optimal solution directly for original problem which is non-convex. An efficient algorithm is proposed to solve complex and non-convex problem. Simulation result demonstrates that the proposed algorithm can enhance the average secrecy rate more effectively, and can maximally rise by approximately 108% in comparison with other schemes.