Skip to content
Playground(another site)

bynk.parse.duplicate_security

Error A service declares more than one security { } policy.

A service has one security policy, and it sets the security headers (hsts, nosniff) stamped on every response. Two blocks could set them differently, and the reader would not know which holds, so the second is refused. Merge them into one. cors, limits and json follow the same rule (bynk.parse.duplicate_cors, bynk.parse.duplicate_limits, bynk.parse.duplicate_json).

Example

service api from http {
security { hsts: 180.days }
security { nosniff: true } // ✗ a second `security`
on GET("/a") () -> Effect[HttpResult[Int]] by Visitor { … }
}
service api from http {
security { hsts: 180.days, nosniff: true } // ✓ one policy
on GET("/a") () -> Effect[HttpResult[Int]] by Visitor { … }
}

In the Book

See also

  • The grammar rule it governs: service_decl.
  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.duplicate_security shows the same from the installed toolchain, without a network.