Skip to content

Commit

Permalink
[Gitar] Updating TypeScript files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitar committed Sep 18, 2024
1 parent 14ff13f commit 5a4859a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
40 changes: 0 additions & 40 deletions src/lib/middleware/secure-headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,50 +86,10 @@ const secureHeaders: (config: IUnleashConfig) => RequestHandler = (config) => {
originAgentCluster: false,
xDnsPrefetchControl: false,
});
const apiHelmet = helmet({
hsts: {
maxAge: hoursToSeconds(24 * 365 * 2), // 2 non-leap years
includeSubDomains: true,
preload: true,
},
contentSecurityPolicy: {
directives: {
defaultSrc:
helmet.contentSecurityPolicy
.dangerouslyDisableDefaultSrc,
fontSrc: null,
styleSrc: null,
scriptSrc: null,
imgSrc: null,
connectSrc: null,
mediaSrc: null,
objectSrc: null,
frameSrc: null,
upgradeInsecureRequests: null,
scriptSrcAttr: null,
baseUri: null,
formAction: null,
frameAncestors: ["'none'"],
},
},

crossOriginEmbedderPolicy: false,
crossOriginResourcePolicy: false,
crossOriginOpenerPolicy: false,
originAgentCluster: false,
xXssProtection: false,
xDnsPrefetchControl: false,
xFrameOptions: { action: 'deny' },
});

return (req, res, next) => {
if (req.method === 'OPTIONS') {
return next();
} else if (
req.path.startsWith(`${config.server.baseUriPath}/api/`) &&
config.flagResolver.isEnabled('stripHeadersOnAPI')
) {
apiHelmet(req, res, next);
} else {
defaultHelmet(req, res, next);
}
Expand Down
1 change: 0 additions & 1 deletion src/lib/types/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export type IFlagKey =
| 'advancedPlayground'
| 'filterInvalidClientMetrics'
| 'disableMetrics'
| 'stripHeadersOnAPI'
| 'signals'
| 'automatedActions'
| 'celebrateUnleash'
Expand Down
1 change: 0 additions & 1 deletion src/server-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ process.nextTick(async () => {
embedProxyFrontend: true,
anonymiseEventLog: false,
responseTimeWithAppNameKillSwitch: false,
stripHeadersOnAPI: true,
celebrateUnleash: true,
featureSearchFeedbackPosting: true,
userAccessUIEnabled: true,
Expand Down

0 comments on commit 5a4859a

Please sign in to comment.