security

Security of Mobile Backend API key

余生长醉 提交于 2020-06-15 21:25:46
问题 Suppose I am developing a mobile application that makes calls to an API server. The API server is secured by an API Key. I cannot hard-code the API Key inside the mobile application because it can be stolen. How can I protect the API key? 回答1: How is that problem usually solved? (It sounds like the API-key you are trying to protect is for an API service that you don't own.) One approach is by using an authentication server. The private API-key is kept on the authentication server and only

How to prevent actions by user role in Angular

十年热恋 提交于 2020-06-12 08:49:04
问题 I already have an AuthService to authenticate user on login and AuthGuard to prevent access if not logged in. Some pages I restrict access by UserProfile/Role but now I need to prevent actions on page. I have roles like "Admin, Manager, Support and Agent", from greater to lower. How to set level only to Manager or Above to edit content on a page that all can access (Support and Agent restrict to view only)? This is my current canActivate method: canActivate(route: ActivatedRouteSnapshot) {

How to prevent actions by user role in Angular

青春壹個敷衍的年華 提交于 2020-06-12 08:48:17
问题 I already have an AuthService to authenticate user on login and AuthGuard to prevent access if not logged in. Some pages I restrict access by UserProfile/Role but now I need to prevent actions on page. I have roles like "Admin, Manager, Support and Agent", from greater to lower. How to set level only to Manager or Above to edit content on a page that all can access (Support and Agent restrict to view only)? This is my current canActivate method: canActivate(route: ActivatedRouteSnapshot) {

SecCertificateCreateWithData always returning null

≯℡__Kan透↙ 提交于 2020-06-12 06:50:08
问题 I'm currently working from the following post. Here is the code: SecCertificateRef certs = NULL; SecPolicyRef policy = NULL; NSString *publicKeyString = @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCeJ8N8fuGShAJnniDg4yuRrxrG61ZF2T24eXSEH87jCJmLbc+MV70AgP/LC8btzSU4FFP56lBmDcmW+Prupf5gO1RXhjPIlET73t5Ny1I3ze+xaShAA9qB0c9dNb26NxVd95wCHNmQhon9qBFmTVZb0CdgscxYcDuLOGskDnATrwIDAQAB"; NSData *publicKeyStringData = [[NSData alloc] initWithBase64EncodedString:publicKeyString options:0]; certs =

How to hide secret keys in Google Colaboratory from users having the sharing link?

安稳与你 提交于 2020-06-12 02:38:11
问题 I written a script that extract some data from an API and build an Excel file. I'm not a dev, it is my first real program ever writted. I hosted the code on Google Colab. There is API secret keys in clear. I want to share it with a Google Drive sharing link to people needing to generate the Excel file so that they can execute it. However I would prefer not to include API secret keys in clear in order to avoid accidental sharings outside of the entreprise. I'm wondering how to hide this... Or

How to sanitize and validate user input to pass a Checkmarx scan

自古美人都是妖i 提交于 2020-06-11 20:12:12
问题 I have an endpoint that receives a String from the client as seen below: @GET @Path("/{x}") public Response doSomething(@PathParam("x") String x) { String y = myService.process(x); return Response.status(OK).entity(y).build(); } Checkmarx complains that this element’s value then "flows through the code without being properly sanitized or validated and is eventually displayed to the user in method doSomething" Then I tried this: @GET @Path("/{x}") public Response doSomething(@PathParam("x")

How to sanitize and validate user input to pass a Checkmarx scan

与世无争的帅哥 提交于 2020-06-11 20:12:08
问题 I have an endpoint that receives a String from the client as seen below: @GET @Path("/{x}") public Response doSomething(@PathParam("x") String x) { String y = myService.process(x); return Response.status(OK).entity(y).build(); } Checkmarx complains that this element’s value then "flows through the code without being properly sanitized or validated and is eventually displayed to the user in method doSomething" Then I tried this: @GET @Path("/{x}") public Response doSomething(@PathParam("x")

Why can't a malicious site obtain a CSRF token via GET before attacking?

萝らか妹 提交于 2020-06-11 18:38:27
问题 If I understand correctly, in a CSRF attack a malicious website A tells my browser to send a request to site B . My browser will automatically include my B cookies in that request. Although A cannot see those cookies, if I'm already authenticated in B the request will look legit, and whatever action was asked will be successfully performed. To avoid this, every time that I visit a page of B containing a form, I receive a CSRF token. This token is associated to my session, so if I make a POST

Is setting ExecutionPolicy to Unrestricted for CurrentUser a security breach?

半腔热情 提交于 2020-06-11 07:52:26
问题 I have a couple of aliases I like to have in my PowerShell on my Windows 10. I want them to persist between sessions, so I have put them in a profile.ps1 file under C:\Users{username}\Documents\WindowsPowerShell. I am getting this annoying "cannot be loaded because running scripts is disabled on this system." error message, and have found this page on how to get rid of it: https://social.technet.microsoft.com/Forums/en-US/3e4a9006-d47d-4e19-96f4-10327ae0c5b1/not-able-to-run-script-in-windows

Java EE security - Not redirected to initial page after login

匆匆过客 提交于 2020-06-09 12:13:48
问题 I just started learning Java EE. My goal is to implement a web portal (with EJB 3 and JSF) for badminton players, where the users can post and analyze their results. To keep it simple (well it turns out it really isn't) I have decided to use the security system the container provides (JBoss as7). After some problem I have managed to get the authentication/authorization to work. However, I have one issue which I haven't been able to solve. When I try to access a protected page I get, as