-
Notifications
You must be signed in to change notification settings - Fork 56
feat: Delete for community modules #3957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
KonradPietocha
merged 20 commits into
kyma-project:main
from
KonradPietocha:delete-for-community-modules
Jun 26, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
89fcbfd
Add initial changes for delete
KonradPietocha 29d881f
Checking if index is from community
KonradPietocha 3a71c8c
Checking if is it community module in DeleteBox
KonradPietocha 3fa5e6b
Add additional checking while deleting for community
KonradPietocha 321ac93
Add useful comments
KonradPietocha dd6913f
Merge branch 'main' into delete-for-community-modules
KonradPietocha 05ca7e5
Add backend for fetching yaml
KonradPietocha c52e1b8
Merge branch 'main' into delete-for-community-modules
KonradPietocha 6bfe2e9
Add creating urls and delting resources
KonradPietocha 93e1aa3
Check link
KonradPietocha 4159694
Move community enpoint to modules
KonradPietocha 0e8c8eb
Make separate functions for delete
KonradPietocha bb7cc82
Check if url is safe
KonradPietocha 60ed8db
Merge branch 'main' into delete-for-community-modules
KonradPietocha 90fa74c
Show catched error
KonradPietocha e1d7936
Code correction added
KonradPietocha 48d30db
Test deleting
KonradPietocha 2c1736d
Remove unusuful import from test
KonradPietocha 96496ca
Merge branch 'main' into delete-for-community-modules
KonradPietocha e58e7e9
Remove console.log
KonradPietocha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import express from 'express'; | ||
| import cors from 'cors'; | ||
| import jsyaml from 'js-yaml'; | ||
|
|
||
| const router = express.Router(); | ||
| router.use(express.json()); | ||
| router.use(cors()); | ||
|
|
||
| async function handleGetCommunityResource(req, res) { | ||
| const { link } = JSON.parse(req.body.toString()); | ||
|
|
||
| // Validate that link is a string and a valid HTTPS URL, and restrict to allowed domains. | ||
| if (typeof link !== 'string') { | ||
| return res.status(400).json('Link must be a string.'); | ||
| } | ||
|
|
||
| try { | ||
| const url = new URL(link); | ||
| // Only allow HTTPS protocol and restrict to specific trusted domains. | ||
| const allowedDomains = ['github.com']; | ||
| if ( | ||
| url.protocol !== 'https:' || | ||
| !allowedDomains.some(domain => url.hostname.endsWith(domain)) | ||
| ) { | ||
| return res.status(400).json('Invalid or untrusted link provided.'); | ||
| } else { | ||
| const response = await fetch(link); | ||
| const data = await response.text(); | ||
| res.json(jsyaml.loadAll(data)); | ||
| } | ||
| } catch (error) { | ||
| res.status(500).json(`Failed to fetch community resource. ${error}`); | ||
| } | ||
| } | ||
|
|
||
| router.post('/community-resource', handleGetCommunityResource); | ||
|
|
||
| export default router; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.