Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@thelok
Copy link
Contributor

@thelok thelok commented Sep 22, 2015

When on a email details page, clicking the plus sign (+) normally creates an indicator. This was broken because in emails/views.py the indicator types were being set to the following types which are not in the vocabulary anymore. So when you try to create an indicator it complains that it is not a valid indicator type.

               if header_field in ("from_address, sender, reply_to"):
                   ind_type = "Address - e-mail"
               elif header_field in ("originating_ip", "x_originating_ip"):
                   ind_type = "Address - ipv4-addr"
               else:
                   ind_type = "String"

I updated the code to use the new vocabulary types by putting the types in the correct locations in the email_details.html template and updating the back end to also grab the new field.

I strongly suggest reviewing the code to make sure nothing is wrong because I haven't done much with the indicator stuff after the removal of STIX/CyBOX.

@thelok
Copy link
Contributor Author

thelok commented Sep 22, 2015

Fixes #586

…use one side of the relationship exists. However, if both sides of the relationship exists then do nothing.
@thelok
Copy link
Contributor Author

thelok commented Sep 22, 2015

OK so I made another change, while taking a look at issue #586 I ran into the issue where I couldn't create a relationship because I got into a situation where only the "right side" had a relationship (i.e. unidirectional relationship).

Just because you have a unidirectional relationship doesn't mean you should fail to create a relationship, just create the other side of the relationship.

Anyways, take a look at this, if you decide not to take this specific fix then I have no problem with backing out the change but I will be keeping this fix in my repo.

@thelok
Copy link
Contributor Author

thelok commented Sep 22, 2015

One last note about the unidirectional relationships... I was able to recreate my issue by very rapidly clicking all 10 plus signs (+) on the email details page. There is some sort of race condition where some of the relationships on the left side are overwritten or are not created, therefore you get the situation where you have a unidirectional relationship from the right side instead of the bidirectional relationship. I'm not going to fix this issue here.

@brlogan
Copy link
Contributor

brlogan commented Sep 22, 2015

I think it might be better to repair the broken relationship by grabbing the data from the existing half, rather than adding a new half that doesn't match the other half. At least, that's the way I handled it. Thoughts?

@apolkosnik-old
Copy link
Contributor

Working on a PR already

apolkosnik-old added a commit to apolkosnik-old/crits that referenced this pull request Sep 22, 2015
The issue was mentioned in crits#607... reason, ind_type passed to handle_indicator_ind() was not using the new vocabulary, and it was bombing out in validate_indicator_value()
@apolkosnik-old
Copy link
Contributor

The indicator_from_header_field() was assigning old IndicatorTypes, I've converted it to the new style Vocabulary, works like a charm.

@thelok
Copy link
Contributor Author

thelok commented Sep 22, 2015

@brlogan I'm not opposed to copying the data from the other half of the relationship as long as you can assume that half is 'correct'

@frbapolkosnik Actually my fix already takes care of this, the client side code passes in the indicator type. The types are already defined in emails/handlers/get_email_detail() in the "email_fields" variable.

@brlogan
Copy link
Contributor

brlogan commented Sep 22, 2015

The existing half should be the most correct. It will have the analyst that originally formed (attempted to form?) the relationship, and the original date. It may be important to maintain this history, rather than muddying it by having different halves.

…elationship, copy the found relationship's data to "repair" the missing link.
@thelok
Copy link
Contributor Author

thelok commented Sep 22, 2015

Ok, pushed up some new logic to copy the existing relationship's data if only half of the relationship is found.

mgoffin added a commit that referenced this pull request Oct 1, 2015
Email Create Indicator Fix Plus Sign (+)
@mgoffin mgoffin merged commit 52a1928 into crits:master Oct 1, 2015
@seanthegeek
Copy link

Just tested it. All headers worked except reply-to.

@apolkosnik-old
Copy link
Contributor

Well, trying to add an email address in the form of "Test2 [email protected]" will not work for any of the email address fields.

@mgoffin
Copy link
Contributor

mgoffin commented Oct 1, 2015

Because it's not a valid email address.

@apolkosnik-old
Copy link
Contributor

"Test2 [email protected]"

@seanthegeek
Copy link

See PR #612

@mgoffin
Copy link
Contributor

mgoffin commented Oct 1, 2015

Still not a valid address?...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants