@friggframework/devtools 2.0.0--canary.428.1c210bc.0 → 2.0.0--canary.428.9de98cd.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1252,6 +1252,7 @@ class AWSDiscovery {
|
|
|
1252
1252
|
|
|
1253
1253
|
return {
|
|
1254
1254
|
defaultVpcId: vpc.VpcId,
|
|
1255
|
+
vpcCidr: vpc.CidrBlock, // Add VPC CIDR for security group configuration
|
|
1255
1256
|
defaultSecurityGroupId: securityGroup.GroupId,
|
|
1256
1257
|
privateSubnetId1: privateSubnets[0]?.SubnetId,
|
|
1257
1258
|
privateSubnetId2:
|
|
@@ -56,6 +56,7 @@ describe('BuildTimeDiscovery', () => {
|
|
|
56
56
|
describe('discoverAndCreateConfig', () => {
|
|
57
57
|
const mockResources = {
|
|
58
58
|
defaultVpcId: 'vpc-12345678',
|
|
59
|
+
vpcCidr: '172.31.0.0/16',
|
|
59
60
|
defaultSecurityGroupId: 'sg-12345678',
|
|
60
61
|
privateSubnetId1: 'subnet-1',
|
|
61
62
|
privateSubnetId2: 'subnet-2',
|
|
@@ -100,6 +101,7 @@ describe('BuildTimeDiscovery', () => {
|
|
|
100
101
|
describe('replaceTemplateVariables', () => {
|
|
101
102
|
const mockResources = {
|
|
102
103
|
defaultVpcId: 'vpc-12345678',
|
|
104
|
+
vpcCidr: '172.31.0.0/16',
|
|
103
105
|
defaultSecurityGroupId: 'sg-12345678',
|
|
104
106
|
privateSubnetId1: 'subnet-1',
|
|
105
107
|
privateSubnetId2: 'subnet-2',
|
|
@@ -225,6 +227,7 @@ describe('BuildTimeDiscovery', () => {
|
|
|
225
227
|
describe('preBuildHook', () => {
|
|
226
228
|
const mockResources = {
|
|
227
229
|
defaultVpcId: 'vpc-12345678',
|
|
230
|
+
vpcCidr: '172.31.0.0/16',
|
|
228
231
|
defaultSecurityGroupId: 'sg-12345678',
|
|
229
232
|
privateSubnetId1: 'subnet-1',
|
|
230
233
|
privateSubnetId2: 'subnet-2',
|
|
@@ -2028,6 +2028,13 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
2028
2028
|
AppDefinition.encryption?.fieldLevelEncryptionMethod ===
|
|
2029
2029
|
'kms'
|
|
2030
2030
|
) {
|
|
2031
|
+
// Validate we have VPC CIDR for security group configuration
|
|
2032
|
+
if (!discoveredResources.vpcCidr) {
|
|
2033
|
+
console.warn(
|
|
2034
|
+
'⚠️ Warning: VPC CIDR not discovered. VPC endpoint security group may not work correctly.'
|
|
2035
|
+
);
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2031
2038
|
// Create security group for VPC endpoints if it doesn't exist
|
|
2032
2039
|
if (
|
|
2033
2040
|
!definition.resources.Resources
|
|
@@ -2040,16 +2047,16 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
2040
2047
|
GroupDescription:
|
|
2041
2048
|
'Security group for VPC endpoints',
|
|
2042
2049
|
VpcId: discoveredResources.defaultVpcId,
|
|
2043
|
-
SecurityGroupIngress:
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2050
|
+
SecurityGroupIngress: discoveredResources.vpcCidr
|
|
2051
|
+
? [
|
|
2052
|
+
{
|
|
2053
|
+
IpProtocol: 'tcp',
|
|
2054
|
+
FromPort: 443,
|
|
2055
|
+
ToPort: 443,
|
|
2056
|
+
CidrIp: discoveredResources.vpcCidr, // Use discovered VPC CIDR
|
|
2057
|
+
},
|
|
2058
|
+
]
|
|
2059
|
+
: [], // Empty array if no VPC CIDR discovered
|
|
2053
2060
|
Tags: [
|
|
2054
2061
|
{
|
|
2055
2062
|
Key: 'Name',
|
|
@@ -7,6 +7,7 @@ jest.mock('./aws-discovery', () => {
|
|
|
7
7
|
return {
|
|
8
8
|
discoverResources: jest.fn().mockResolvedValue({
|
|
9
9
|
defaultVpcId: 'vpc-123456',
|
|
10
|
+
vpcCidr: '172.31.0.0/16', // Add VPC CIDR for security group configuration
|
|
10
11
|
defaultSecurityGroupId: 'sg-123456',
|
|
11
12
|
privateSubnetId1: 'subnet-123456',
|
|
12
13
|
privateSubnetId2: 'subnet-789012',
|
|
@@ -484,6 +485,10 @@ describe('composeServerlessDefinition', () => {
|
|
|
484
485
|
Key: 'Name',
|
|
485
486
|
Value: '${self:service}-${self:provider.stage}-frigg-kms-key'
|
|
486
487
|
},
|
|
488
|
+
{
|
|
489
|
+
Key: 'ManagedBy',
|
|
490
|
+
Value: 'Frigg'
|
|
491
|
+
},
|
|
487
492
|
{
|
|
488
493
|
Key: 'Purpose',
|
|
489
494
|
Value: 'Field-level encryption for Frigg application'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.428.
|
|
4
|
+
"version": "2.0.0--canary.428.9de98cd.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-ec2": "^3.835.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.835.0",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"@babel/eslint-parser": "^7.18.9",
|
|
10
10
|
"@babel/parser": "^7.25.3",
|
|
11
11
|
"@babel/traverse": "^7.25.3",
|
|
12
|
-
"@friggframework/schemas": "2.0.0--canary.428.
|
|
13
|
-
"@friggframework/test": "2.0.0--canary.428.
|
|
12
|
+
"@friggframework/schemas": "2.0.0--canary.428.9de98cd.0",
|
|
13
|
+
"@friggframework/test": "2.0.0--canary.428.9de98cd.0",
|
|
14
14
|
"@hapi/boom": "^10.0.1",
|
|
15
15
|
"@inquirer/prompts": "^5.3.8",
|
|
16
16
|
"axios": "^1.7.2",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"serverless-http": "^2.7.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@friggframework/eslint-config": "2.0.0--canary.428.
|
|
36
|
-
"@friggframework/prettier-config": "2.0.0--canary.428.
|
|
35
|
+
"@friggframework/eslint-config": "2.0.0--canary.428.9de98cd.0",
|
|
36
|
+
"@friggframework/prettier-config": "2.0.0--canary.428.9de98cd.0",
|
|
37
37
|
"aws-sdk-client-mock": "^4.1.0",
|
|
38
38
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
39
39
|
"jest": "^30.1.3",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "9de98cdf6b43272a625ac0ff642f8abda89bb38a"
|
|
72
72
|
}
|