Skip to content
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

Secure path generation #2078

Closed
pascalgrimaud opened this issue Jun 14, 2022 · 8 comments · Fixed by #2501
Closed

Secure path generation #2078

pascalgrimaud opened this issue Jun 14, 2022 · 8 comments · Fixed by #2501
Assignees
Labels
area: feature request 💡 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ generator: internal $400 https://www.jhipster.tech/bug-bounties/

Comments

@pascalgrimaud
Copy link
Member

pascalgrimaud commented Jun 14, 2022

By default, path folder should be something like /tmp/jhlite/xxxx, xxxx can be a random uuid
So the cloud version is usable
The value /tmp/jhlite should be in application.properties

Then, we can add a "local" profile, which will disable this feature and allow the user to choose the path folder he/she wants

@pascalgrimaud pascalgrimaud added area: feature request 💡 generator: internal $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $200 https://www.jhipster.tech/bug-bounties/ labels Jun 14, 2022
@pascalgrimaud
Copy link
Member Author

Adding a bounty as we need this, specially @jdubois :)

@hdurix
Copy link
Member

hdurix commented Jun 15, 2022

as discussed with @pascalgrimaud, we'll start with 2 things to make this work:

  • front-end part: instead of a placeholder for project path, init the input box with /tmp/jhlite/{uuid}
  • back-end part: add a spring boot property forcedFolderPath and check at generation the user project path starts with the value of forcedFolderPath

@jdubois
Copy link
Member

jdubois commented Jun 15, 2022

Instead of "/tmp/jhlite" can we have "/jhlite"?
"/tmp" will be deleted if there’s a reboot, and also won’t work as a shared drive (I want to mount an Azure File storage so it’s persistent and can be shared if I scale out with multiple servers).

@hdurix
Copy link
Member

hdurix commented Jun 15, 2022

ok so let me change the spec then:

  • back-end part: add a spring boot property folderPathPrefix and prefix the user project path with the value of folderPathPrefix

In the front-end part, the value will be initialized with /tmp/jhlite/{uuid} and the app will be generated in /jhlite/tmp/jhlite/{uuid}

@hdurix hdurix self-assigned this Jun 15, 2022
@DamnClin
Copy link
Collaborator

I think a spring profile may be better than a property for that since it will be easier to replace adapters implementations if needed

@pascalgrimaud pascalgrimaud added $400 https://www.jhipster.tech/bug-bounties/ and removed $200 https://www.jhipster.tech/bug-bounties/ labels Jul 12, 2022
@pascalgrimaud
Copy link
Member Author

Updated the bounty as it was more work than expected

@hdurix
Copy link
Member

hdurix commented Jul 13, 2022

@jdubois you should now be able to use an env var named APPLICATION_FORCED_PROJECT_FOLDER with the prefix you want :)
This will be used for 2 things:

  • initialize the project folder input with forced-folder+UUID in the front-end
  • check that the chosen project folder is in the forced folder in the back-end

Eventually UX could be better, but for now at least this is secured

@pascalgrimaud
Copy link
Member Author

@hdurix @jdubois : another solution is to use cloud profile, it will have default config /tmp/jhlite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: feature request 💡 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ generator: internal $400 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants