File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ export function addAstro(Prism: typeof import('prismjs')) {
3131 . replace ( / < S P R E A D > / g, function ( ) {
3232 return spread ;
3333 } ) ;
34+ // nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
35+ // Built from static Prism token sources, not user input.
3436 return RegExp ( source , flags ) ;
3537 }
3638
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ export function deserializeRouteData(rawRouteData: SerializedRouteData): RouteDa
8888 return {
8989 route : rawRouteData . route ,
9090 type : rawRouteData . type ,
91+ // nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
92+ // This pattern is serialized from Astro's own route manifest.
9193 pattern : new RegExp ( rawRouteData . pattern ) ,
9294 params : rawRouteData . params ,
9395 component : rawRouteData . component ,
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ export function getPattern(
4141 if ( addTrailingSlash === 'never' && base !== '/' ) {
4242 initial = '' ;
4343 }
44+ // nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
45+ // The pattern is assembled from escaped route segments generated by Astro.
4446 return new RegExp ( `^${ pathname || initial } ${ trailing } ` ) ;
4547}
4648
Original file line number Diff line number Diff line change @@ -332,6 +332,8 @@ function onPageLoad(cb: () => void) {
332332function appendSpeculationRules ( url : string , eagerness : PrefetchOptions [ 'eagerness' ] ) {
333333 const script = document . createElement ( 'script' ) ;
334334 script . type = 'speculationrules' ;
335+ // nosemgrep: javascript.lang.security.audit.unknown-value-with-script-tag.unknown-value-with-script-tag
336+ // This writes JSON via textContent, not executable JavaScript source.
335337 script . textContent = JSON . stringify ( {
336338 prerender : [
337339 {
Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ const getViteResolveAlias = (settings: AstroSettings) => {
8989 // id is already the wildcard part (e.g., 'extra.css' for '@styles/*')
9090 // resolvedValues still have the * in them, so replace * with id
9191 for ( const resolvedValue of resolvedValues ) {
92+ // nosemgrep: javascript.lang.security.audit.incomplete-sanitization.incomplete-sanitization
93+ // `id` is the wildcard capture from the alias match and only substitutes the tsconfig `*`.
9294 const resolved = resolvedValue . replace ( '*' , id ) ;
9395 const stats = fs . statSync ( resolved , { throwIfNoEntry : false } ) ;
9496 if ( stats && stats . isFile ( ) ) {
Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ export function remotePatternToRegex(
9595 regexStr += '([?][^#]*)?' ;
9696 }
9797 try {
98+ // nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
99+ // This only validates the generated pattern before handing it to Netlify.
98100 new RegExp ( regexStr ) ;
99101 } catch {
100102 logger . warn (
Original file line number Diff line number Diff line change @@ -183,6 +183,8 @@ export default function (dir, opts = {}) {
183183 if ( opts . dotfiles ) ignores . push ( / \/ \. \w / ) ;
184184 else ignores . push ( / \/ \. w e l l - k n o w n / ) ;
185185 [ ] . concat ( opts . ignores || [ ] ) . forEach ( ( x ) => {
186+ // nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
187+ // This mirrors sirv's developer-supplied ignore patterns.
186188 ignores . push ( new RegExp ( x , 'i' ) ) ;
187189 } ) ;
188190 }
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ type Props = {
1616const StaticHtml = ( { value, name, hydrate = true } : Props ) => {
1717 if ( ! value ) return null ;
1818 const tagName = hydrate ? 'astro-slot' : 'astro-static-slot' ;
19+ // nosemgrep: typescript.react.security.audit.react-dangerouslysetinnerhtml.react-dangerouslysetinnerhtml
20+ // Astro passes framework-rendered HTML through this adapter boundary intentionally.
1921 return h ( tagName , { name, dangerouslySetInnerHTML : { __html : value } } ) ;
2022} ;
2123
You can’t perform that action at this time.
0 commit comments