Skip to content

Commit

Permalink
fix!: remove remoteCidr exception block (#987)
Browse files Browse the repository at this point in the history
## Description
BREAKING CHANGE:Remove the generated exception block from the remoteCidr
generation. This change means that a cidr containing the META_IP could
be set.


Conversation with @mjnagel resulted in this implementation but open to
other suggestions if we want to try and lock down allowed IP ranges with
either generation logic, validations, or other.

## Related Issue

Fixes #950

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor
Guide](https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md)
followed
  • Loading branch information
UnicornChance authored Nov 7, 2024
1 parent 7746092 commit 264fbf6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 0 additions & 2 deletions src/pepr/operator/controllers/network/generate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ describe("network policy generate with remoteCidr", () => {
{
ipBlock: {
cidr: "192.168.0.0/16",
except: ["169.254.169.254/32"], // Include the except field here
},
},
],
Expand Down Expand Up @@ -162,7 +161,6 @@ describe("network policy generate with remoteCidr", () => {
{
ipBlock: {
cidr: "10.0.0.0/8",
except: ["169.254.169.254/32"], // Include the except field here
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
*/

import { V1NetworkPolicyPeer } from "@kubernetes/client-node";
import { META_IP } from "./cloudMetadata";

/** Matches a specific custom cidr EXCEPT the Cloud Meta endpoint */
/** Matches a specific custom cidr without any exclusions */
export function remoteCidr(cidr: string): V1NetworkPolicyPeer {
return {
ipBlock: {
cidr,
except: [META_IP],
},
};
}

0 comments on commit 264fbf6

Please sign in to comment.