In short, relative (adjectival) clauses (that is, short phrases modifying a noun), の can replace が. There's really not much to say about it, other than that it is only used in very short clauses (usually subject の verb-or-adjective, and that's it), and if it's ambiguous with a "possessive" の than you either can't use it, or it has to "work either way".
You also wouldn't use it if there's any emphasis on the thing before が - the construction kind of makes the whole sub-phrase sound like a single adjective (I mean, that's what it is already, regardless of の vs が - but it sounds more flat with the の, I think)