@@ -230,6 +230,42 @@ describe("noteSecurityWarnings gateway exposure", () => {
230230 expect ( message ) . not . toContain ( "CRITICAL" ) ;
231231 } ) ;
232232
233+ it ( "recognizes trusted-proxy as an explicit auth mode without certifying readiness" , async ( ) => {
234+ const cfg = {
235+ gateway : {
236+ bind : "lan" ,
237+ trustedProxies : [ "192.0.2.10" ] ,
238+ controlUi : { allowedOrigins : [ "https://control.example.test" ] } ,
239+ auth : {
240+ mode : "trusted-proxy" ,
241+ trustedProxy : {
242+ userHeader : "x-forwarded-user" ,
243+ allowUsers :
[ "[email protected] " ] , 244+ } ,
245+ } ,
246+ } ,
247+ } satisfies OpenClawConfig ;
248+
249+ const findings = await collectSecurityWarnings ( cfg , { } ) ;
250+ const exposureFindings = findings . filter ( ( finding ) =>
251+ finding . checkId . startsWith ( "gateway.bind_" ) ,
252+ ) ;
253+ expect ( exposureFindings ) . toEqual ( [
254+ expect . objectContaining ( {
255+ checkId : "gateway.bind_network_accessible" ,
256+ severity : "warn" ,
257+ detail : expect . stringContaining ( "configured authentication boundary" ) ,
258+ remediation : expect . not . stringContaining ( "openclaw doctor --fix" ) ,
259+ } ) ,
260+ ] ) ;
261+
262+ await noteSecurityWarnings ( cfg ) ;
263+ const message = lastMessage ( ) ;
264+ expect ( message ) . not . toContain ( "without authentication" ) ;
265+ expect ( message ) . toContain ( "direct Gateway access is restricted" ) ;
266+ expect ( message ) . toContain ( "openclaw security audit --deep" ) ;
267+ } ) ;
268+
233269 it ( "warns when OPENCLAW_GATEWAY_TOKEN env conflicts with gateway.auth.token config (#74271)" , async ( ) => {
234270 process . env . OPENCLAW_GATEWAY_TOKEN = "env-token-123" ;
235271 const cfg = {
0 commit comments